fahimS-2
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
form submit count
Started by: fahimS-2
in: Toolset Professional Support
Problem: I have 2 custom fields called 'Rating' and 'Count' in a custom field group assigned to a Custom post type. I want to update the 'Rating' and 'Count' fields whenever a user submits a new rating. The desired formula for updating the 'Rating' field is 'Rating = (Rating * Count + New Rating Value Given By User)/(Count+1)', and for the 'Count' field, 'Count = Count + 1'. Solution: Add the following code to your functions.php or custom plugin file: // Attach the 'update_rating_and_count' function to the 'cred_before_save_data' hook add_action('cred_before_save_data', 'update_rating_and_count', 10, 2); // Define the 'update_rating_and_count' function function update_rating_and_count($form_data) { // Check if the form submitted has the correct ID (Replace 600 with your Toolset form ID) if ($form_data['id'] == 600) { // Check if the '_cred_cred_prefix_post_id' field exists in the form data if (isset($_POST['_cred_cred_prefix_post_id'])) { // Get the post ID from the form data $post_id = $_POST['_cred_cred_prefix_post_id']; // Get the current rating and count values from the post meta $rating = (float) get_post_meta($post_id, 'wpcf-rating', true); $count = (int) get_post_meta($post_id, 'wpcf-count', true); // Get the new rating value submitted by the user $new_rating = (float) $_POST['wpcf-rating']; // Calculate the new average rating value using the provided formula $new_rating_value = ($rating * $count + $new_rating) / ($count + 1); // Update the submitted rating value with the new average rating value $_POST['wpcf-rating'] = $new_rating_value; // Increment the count by 1 $new_count = $count + 1; // Update the count value in the post meta update_post_meta($post_id, 'wpcf-count', $new_count); } } } Replace 600 with your Toolset form ID, and ensure the field names in the code match your setup. This code attaches the 'update_rating_and_count' function to the 'cred_before_save_data' hook. When a form with the specified ID (in this case, 600) is submitted, the function retrieves the current rating and count values for the post being edited. It then calculates the new average rating value based on the user's submitted rating and updates the rating and count values in the post meta. Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data |
2 | 16 | 1 year, 8 months ago | ||
Open in new tab Post Link With A Title
Started by: fahimS-2
in: Toolset Professional Support
Problem: The user wants to create an archive where the Post Link With A Title opens in a new tab, but the switch in the settings is not working. Solution: To achieve this, use an HTML block instead of the Paragraph block and add the following code: <a href="[wpv-post-url]" class="ptitle" target="_blank">[wpv-post-title]</a> This code uses [wpv-post-url] for the post URL and [wpv-post-title] for the post title. The target="_blank" attribute ensures the link opens in a new tab. For CSS customization, apply styles to the "ptitle" class: .ptitle { } |
2 | 3 | 1 year, 8 months ago | ||
Removed custom field data in frontend
Started by: fahimS-2
in: Toolset Professional Support
Problem: The user had a custom field group called 'cf' with a number custom field called 'count'. They had two custom post types called 'saas' and 'saas1', both with posts containing data in the 'count' custom field. After removing the 'cf' custom field group from 'saas1', the user still saw the 'count' value displayed on the frontend. They wanted to stop displaying the 'count' value without deleting it. Solution: Create a separate Elementor layout for 'saas' and 'saas1'. In the layout for 'saas', don't use the 'cf' custom field group. Continue to use 'cf' in the 'saas1' Elementor layout. This way, the 'count' values won't be displayed for the 'saas' post type while still being available for the 'saas1' post type. |
2 | 3 | 1 year, 8 months ago | ||
Which Relevanssi plugin to install
Started by: fahimS-2
in: Toolset Professional Support
Problem: Relevant Documentation: Moreover, please make sure to read our documentation related: https://toolset.com/course-lesson/searching-texts-in-custom-fields-with-toolset-and-relevanssi/ |
2 | 3 | 1 year, 8 months ago | ||
custom search view with double query
Started by: fahimS-2 in: Toolset Professional Support |
2 | 5 | 1 year, 8 months ago | ||
multiple author archive pages
Started by: fahimS-2 in: Toolset Professional Support |
2 | 5 | 1 year, 8 months ago | ||
author page archive custom posts not showing
Started by: fahimS-2 in: Toolset Professional Support |
2 | 6 | 1 year, 8 months ago | ||
export custom codes
Started by: fahimS-2 in: Toolset Professional Support |
3 | 5 | 1 year, 8 months ago | ||
Create archive pages for categories
Started by: fahimS-2 in: Toolset Professional Support |
2 | 5 | 1 year, 8 months ago | ||
How to export toolset views
Started by: fahimS-2 in: Toolset Professional Support |
2 | 11 | 1 year, 8 months ago | ||
Custom field value change automatically
Started by: fahimS-2 in: Toolset Professional Support |
2 | 3 | 1 year, 8 months ago | ||
Export Custom Taxonomies
Started by: fahimS-2 in: Toolset Professional Support |
2 | 7 | 1 year, 8 months ago | ||
Author page not showing custom posts?
Started by: fahimS-2
in: Toolset Professional Support
Problem: Solution: To show custom post types on the author page, create a custom author archive page using Toolset Views. This allows you to choose which post types should be included. Follow the guide on customizing WordPress Archives: Additionally, go to Toolset > Post Types, select the post type in question, and under the "Sections to display when editing" section, make sure to check the "Author" checkbox. Relevant Documentation: https://toolset.com/documentation/getting-started-with-toolset/customize-post-archives/ |
2 | 5 | 1 year, 8 months ago | ||
Slug Problem For Hierarchical Custom Post Types
Started by: fahimS-2
in: Toolset Professional Support
Problem: When a custom post type is set as hierarchal it is not possible to upload media with the same slug. Solution: That is true for all posts and pages in WordPress. Please avoid uploading images with the same name as the posts slug. |
2 | 4 | 1 year, 9 months ago | ||
And Logic Between Category Checkboxes
Started by: fahimS-2 in: Toolset Professional Support |
3 | 7 | 1 year, 9 months ago |