ioannisM-2
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Slow loading
1
2
Started by: Timothy
in: Toolset Professional Support
Problem: Looping over repeating image field generates n^2 calls to Toolset_Utils::get_attachment_id_by_url Solution: Update to the latest version of Types. |
4 | 21 | 6 years ago | ||
Toolset Forms Notification Email Filters have stopped working
1
2
Started by: Darryl
in: Toolset Professional Support
Problem: Send notification emails based on a form field, all email notifications were sent, ignoring the filters. Solution: This should be fixed in the latest version of Toolset form plugin 2.0.2.1, you can download it here: Relevant Documentation: |
2 | 21 | 6 years, 3 months ago | ||
Make Field required on form
Started by: FuChan
in: Toolset Professional Support
Problem: Solution: |
2 | 5 | 6 years, 5 months ago | ||
How to customize custom date datepicker field with Toolset CRED form.
Started by: Dido
in: Toolset Professional Support
Problem: The start date must be a date in the future and the end date must be greater then the start date. Is there a way to make sure people don't make. Solution: You can find proposed solution, in this case, with the following reply: Relevant Documentation: |
3 | 11 | 6 years, 5 months ago | ||
Create a View of related posts on a taxonomy archive
Started by: Tcoffee
in: Toolset Professional Support
Problem: I would like to display a list of related posts on a taxonomy term archive. Related posts should be posts with terms that are siblings of the current archive term. Solution: function get_term_parent_func($atts) { $a = shortcode_atts( array( 'taxonomy' => '', 'return' => 'id' ), $atts ); $taxonomy = $a['taxonomy']; $parent_id = 0; if( is_tax( $taxonomy ) ) { $taxObj = get_queried_object(); $tax = isset($taxObj->taxonomy) ? $taxObj->taxonomy : 0; $term = isset($taxObj->term_id) ? $taxObj->term_id : 0; $parent_slugs = get_term_parents_list( $term, $tax, array('format'=>'slug', 'link'=>FALSE, 'inclusive'=>FALSE, 'separator'=>',')); $parent_slugs = explode(',', $parent_slugs); $depth = sizeof($parent_slugs) - 1; $parent_slug = ($depth === 0) ? $taxObj->slug : $parent_slugs[$depth-1]; if( $a['return'] == 'id' ) { $parent = get_term_by( 'slug', $parent_slug, $tax ); $parent_id = isset($parent->term_id) ? $parent->term_id : $taxObj->term_id; return $parent_id; } if( $a['return'] == 'slug' ) { return $parent_slug; } } return $parent_id; } add_shortcode("get_term_parent", "get_term_parent_func"); - Pass that value into your View of posts as a shortcode attribute: [wpv-view name="products-in-parent-term" wpvproductcat="[get_term_parent taxonomy='product_cat' return='slug']"] - Register the get_term_parent shortcode in Toolset > Settings > Third party shortcode arguments add_filter( 'wpv_filter_query', 'not_this_term_filter',99,3 ); function not_this_term_filter( $query_args, $views_settings, $view_id) { $view_ids = array( 1234 ); $tax = 'product-categories'; $taxObj = get_queried_object(); $tax = isset($taxObj->taxonomy) ? $taxObj->taxonomy : 0; $term_id = isset($taxObj->term_id) ? $taxObj->term_id : 0; if (in_array($view_id, $view_ids)){ $query_args['tax_query'][] = array( 'taxonomy' => $tax, 'field' => 'id', 'terms' => $term_id, 'operator' => 'NOT IN' ); } return $query_args; } Relevant Documentation: |
2 | 9 | 6 years, 5 months ago | ||
Hiding filter labels if no choices are available
Started by: scottL-3
in: Toolset Professional Support
Problem: On the client site a View includes filter controls which in some circumstances may not have any available options, and the filter label should be hidden in such circumstances. Solution: Examples are given below (the exact code will depend on the filters and their settings). |
2 | 3 | 6 years, 5 months ago | ||
How to update custom field value by current date with Toolset Form
Started by: FuChan
in: Toolset Professional Support
Problem: Solution: You can find proposed solution, in this case, with the following reply: Relevant Documentation: |
3 | 11 | 6 years, 5 months ago | ||
Pricing View filter in parametric search
Started by: Paul
in: Toolset Professional Support
Problem: I would like to add a filter to my custom search View that has options with different price ranges. For example, Less than 50, 50 - 100, and 100+. Solution: There is not an easy way to accomplish this in Toolset using a standard price filter. You would have to create a separate custom field that holds a value that represents each price range, then filter based on that custom field. To automate the process, you could use a hook like save_post or pmxi_saved_post to check the current price and update the value automatically: function post_saved( $post_id, $post, $update ) { $range = 0; $price = get_post_meta( $post_id, 'wpcf-price', true); if( $price < 50000 ) { $range = 1; }else if( $price >= 50000 && $price <= 100000 ) { $range = 2; } else if( $price > 100000 ) { $range = 3; } update_post_meta( $post_id, 'wpcf-sort-price', $range); } add_action( 'pmxi_saved_post', 'post_saved',10,1); Relevant Documentation: |
2 | 4 | 6 years, 5 months ago | ||
Pre-Querying a Parametric Custom Search View
Started by: paulJ-9
in: Toolset Professional Support
Problem: I have a custom search View that includes a taxonomy filter with only two options. I would like to create another custom search View and predefine the selected taxonomy filter in both Views, and I would like to prevent Users from choosing a different taxonomy term in the filter. Solution: You can combine a custom search View with predefined Query Filters. Set up the other filters as needed, then add your predefined taxonomy term Query Filter. You may have to expose the Query Filter panel by going to Screen Options in the top right corner of the View editor screen. |
2 | 3 | 6 years, 5 months ago | ||
Make Field Required Depending on Value of A Custom Field
Started by: julieP in: Toolset Professional Support |
2 | 3 | 6 years, 5 months ago | ||
Link to a Gallery thumbnail
Started by: domenicoS in: Toolset Professional Support |
2 | 4 | 6 years, 5 months ago | ||
How can I limit Custom Search result to EXACT MATCH of the custom post title?
1
2
Started by: PaulS4783
in: Toolset Professional Support
Problem: Solution: You can find proposed solution, in this case, with the following reply: Relevant Documentation: |
2 | 19 | 6 years, 5 months ago | ||
bulk editing relationships in the new toolset 3 format
1
2
Started by: meirk in: Toolset Professional Support |
2 | 17 | 6 years, 6 months ago | ||
Radio buttons show different elements
Started by: RafaelL7560
in: Toolset Professional Support
Problem: Can I possibly query the radio buttons that have just been clicked? For example, there are 2 radio buttons and Radio Button 1 should display something specific and click on Radio Button 2 should display something else. Is this perhaps possible? Solution: It needs some custom JS codes, I suggest you follow Jquery document to setup the JS codes: See similar thread: Relevant Documentation: |
2 | 10 | 6 years, 6 months ago | ||
Single select taxonomy terms in form
Started by: ruudd
in: Toolset Professional Support
Problem: I would like to include a single select field for selecting a taxonomy term in CRED. The taxonomy is flat, not hierarchical. Solution: CRED does not support a single select field for flat taxonomies, so you can either convert the taxonomy to a hierarchical taxonomy or you can use a generic field and the CRED API. Relevant Documentation: |
2 | 11 | 6 years, 7 months ago |
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Cred Form – Huge amount of deleted images remain in Media Library
Started by: ioannisM-2 in: Toolset Professional Support |
3 | 15 | 5 years, 12 months ago | ||
Unable to create new child posts for any parent
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 8 | 6 years, 4 months ago | ||
Cred – Autodraft issue: Unable to create new child of any parent
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 9 | 6 years, 5 months ago | ||
Validate that the parent has specific term/field value
Started by: ioannisM-2
in: Toolset Professional Support
Problem: I have a Form that creates child posts. I would like to use the cred_form_validate API to ensure that the parent post chosen in the Form has specific terms and custom field values. Solution: Use custom code to query the parent post and compare its terms and custom field values. add_filter('cred_form_validate','validate_parent_consultant',10,2); function validate_parent_consultant($field_data, $form_data) { list($fields,$errors)=$field_data; //error_log(print_r($fields, true)); $forms = array( 6 ); // validate if correct CRED form ID if ( in_array( $form_data['id'], $forms ) ) { // edit these 6 lines as needed $parent_field_post_name = '@consultant-event_parent'; $parent_field_name = '@consultant-event.parent'; $checkbox_slug = 'parent-checkbox-field'; $taxonomy_slug = 'consultant-taxonomy'; $taxonomy_terms = array('a', 'b'); $test_cbs = array( 'a', 'b', 'c' ); // get the parent ID from the form field $parent_id = $_POST[$parent_field_post_name]; // check if parent has all matching checkboxes $vals = types_render_field($checkbox_slug, array( "separator"=>",", "id"=>$parent_id)); $any = strlen($vals) > 0 ? explode(',', $vals) : array(); $cbs_match = sizeof($any) > 0 && sizeof(array_intersect( $any, $test_cbs)) == sizeof($test_cbs); // Test if the parent has all the right term(s) $matching_terms = []; foreach($taxonomy_terms as $tax_term) { if( is_object_in_term( $parent_id, $taxonomy_slug, $tax_term ) ){ $matching_terms[]= $tax_term; } } $terms_match = sizeof($matching_terms) == sizeof($taxonomy_terms); // combine parent validations if( !$cbs_match || !$terms_match ) { $errors[$parent_field_name] = __('Select a different parent post.', 'your-theme-domain'); } } //return result return array($fields,$errors); } Relevant Documentation: |
3 | 9 | 6 years, 5 months ago | ||
Update Parent Field when submitting child post form
Started by: ioannisM-2
in: Toolset Professional Support
Problem: I have a Form that creates new child posts. I would like to use the cred_save_data API and the new Post Relationships API to update a custom field value in the parent post. I also have a Form that edits a parent post. I would like to use the APIs to update custom field values in all its child posts. Solution: function consultant_data_action($post_id, $form_data) { if ($form_data['id']==30) { $consultant = toolset_get_related_post( $post_id, 'relationship-slug', 'parent' ); $update = 500; update_post_meta($consultant, 'wpcf-updated-consultant-field', $update); } } add_action('cred_save_data', 'consultant_data_action',10,2); To update all children from the parent post Form: function reverse_consultant_data_action($post_id, $form_data) { if ($form_data['id']==23) { $rels = toolset_get_related_posts( $post_id, 'consultant-job', 'parent', 1000000, 0, array(), 'post_id', 'child' ); foreach($rels as $rel) { update_post_meta($rel, 'wpcf-update-me', 500); } }} add_action('cred_save_data', 'reverse_consultant_data_action',10,2); Relevant Documentation: |
2 | 10 | 6 years, 5 months ago | ||
Allow only one submission of the form
Started by: ioannisM-2
in: Toolset Professional Support
Problem: I would like to use cred_before_save_data to prevent a User from submitting the same form multiple times to create multiple posts, or to edit the same post more than once. Solution: The cred_before_save_data hook should not be used to validate form submissions. Instead, use the cred_form_validate hook. This will allow you to return meaningful error messages to the front-end of the site. Here is an example showing how to prevent a User from creating more than one post, or how to prevent a User from editing a post where a specific custom field already has a value: add_filter('cred_form_validate','profile_exists_validation',10,2); function profile_exists_validation($error_fields, $form_data) { global $current_user; //field data are field values and errors list($fields,$errors)=$error_fields; //uncomment this if you want to print the field values //print_r($fields); //validate if specific form if ($form_data['id']==12345) { //check custom field value if (isset($fields['wpcf-sel1']['value']) && $fields['wpcf-sel1']['value']!='') { //set error message for my_field $errors['wpcf-sel1']='This custom field has already been defined for the post.'; } //check if current User is already the author of a "Profile" custom post $args = array( 'author' => $current_user->ID, 'orderby' => 'post_date', 'order' => 'ASC', 'posts_per_page' => 1, 'post_type' => 'profile' ); $profiles = get_posts( $args ); if ( sizeof($profiles) > 0 ) { //set error message for post title $errors['post_title'] = 'Profile already exists, so you cannot create another one.'; } } //return result return array($fields,$errors); } Relevant Documentation: |
2 | 5 | 6 years, 5 months ago | ||
Custom url Format not working
Started by: ioannisM-2 in: Toolset Professional Support |
1 | 2 | 6 years, 5 months ago | ||
Real Time Views
Started by: ioannisM-2
in: Toolset Professional Support
Problem: Is there a way to create a real time view that shows the posts that are published in real time without refreshing the page? Solution: There isn't such a built-in feature within Views plugin, and it need to be done in the client's browser side, see the solution in post: Relevant Documentation: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-view |
2 | 5 | 6 years, 5 months ago | ||
Performance Layouts vs Beaver Builder
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 3 | 6 years, 6 months ago | ||
Solr & Redis Compatibility with toolset plugins
Started by: ioannisM-2
in: Toolset Professional Support
Problem: Solution: You would have to set that up yourself, meaning using the pre_get_posts hook to add that parameter to the required queries. Relevant Documentation: |
2 | 2 | 6 years, 10 months ago | ||
Toolset Rest Api Support
1
2
Started by: ioannisM-2
in: Toolset Professional Support
Problem: Solution: Unfortunately no we currently don't have full REST support. What we have currently is for exposing the custom post types to the api for view purposes only. |
12 | 17 | 6 years, 11 months ago | ||
Author fields in Query Filter for Posts
1
2
Started by: ioannisM-2 in: Toolset Professional Support |
3 | 16 | 7 years ago | ||
View by Url Parameter not Working
Started by: ioannisM-2
in: Toolset Professional Support
Problem: I am trying to set up a view by url parameter. I have created the custom user field "test" that holds the ids of the posts but I do not know how to create the link that will output the ids in url. Initially I used this code in the view template: <a href="?test=[types usermeta='test' user_current='true' separator=',' output='raw'][/types]">show posts with ids same with the values from the custom field test</a> The posts appear seperated by a comma in the url like: I visited this url: Solution: Please try this: <a href="?test=[types usermeta='test' format='FIELD_NAME[]=FIELD_VALUE' user_current='true' separator='&'][/types]">show posts with ids same with the values from the custom field test</a> And test again. Relevant Documentation: |
2 | 4 | 7 years ago | ||
Author fields in Posts Parametric Search
Started by: ioannisM-2 in: Toolset Professional Support |
3 | 5 | 7 years ago | ||
Users Views & Pagination Issue
Started by: ioannisM-2
in: Toolset Professional Support
Problem: So here is how I did my test: I added 2.741 users to my website and 2.741 posts. Then I created a post view and a user view with exactly the same fields. According to query monitor, the user View needs 3.8 sec to generate the page (196 KB) when the post view needs 6.36 sec (188 KB). Big difference, right? When I paginated my views sth very strange happened. The user view now needs 2.34 sec from 3.8 sec (188 KB) to create the page when the post view needs just 0.2 sec (13 KB) from 6.36 sec (188 KB) Why may this is happening? Why the post view has so big difference when it is paginated and the user view remains almost the same? Is this a bug or am I missing a setting? I am developing a site that may be huge in the future with a lot of users registered to it, so I would like to avoid adding extra content that is not needed. Ideally I would like to use just the user view without adding extra custom fields and custom post type for the creation of the profiles. Is there a way to make the user view faster like is happening with the post view when it is paginated? Solution: and uses WP_User_Query to query the users in tatabase table "wp_users" 1) In the database table "wp_posts", there are lots number of columns 2) The class WP_Query support cache feature: So it conducts the issues you mentioned above. Q2) Is there a way to make the user view faster like is happening with the post view when it is paginated? 2) How to Use Views Custom Search on Large Sites 3) Working with Caching Plugins Relevant Documentation: |
2 | 3 | 7 years ago |