Kostas
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 |
---|---|---|---|---|---|
Select population is limited to 10 parent posts
Started by: Kostas in: Toolset Professional Support |
2 | 5 | 1 year, 7 months ago | ||
Search view stopped working after translation with wpml
Started by: Kostas in: Toolset Professional Support |
3 | 13 | 3 years, 8 months ago | ||
View which filters on YYYY-MM
Started by: Kostas
in: Toolset Professional Support
Problem: I have a custom field that holds date-like values in the format YYYY-MM. I would like to add a Query Filter to my View based on this custom field, and set it up so that the results are from the current year and the previous two years. Solution: Use the wpv_filter_query PHP filter to find date fields "like" the 3 most recent years: // Filter a View by date-like custom field value YYYY-MM, show only results from current year and two previous years // https://toolset.com/forums/topic/view-which-filters-on-yyyy-mm/ add_filter( 'wpv_filter_query', 'tssupp_yyyy_mm_two_years_ago', 99, 3 ); function tssupp_yyyy_mm_two_years_ago( $query_args, $views_settings, $view_id) { $view_ids = array( 123 ); // your view ID or IDs $date_field_slug = 'field-slug'; // your date field slug // --------- you should not edit below this line --------------------- if (in_array($view_id, $view_ids)){ $year = date('Y'); $query_args['meta_query'] = array( 'relation' => 'OR', 'year1_clause' => array( 'key' => 'wpcf-'.$date_field_slug, 'compare' => 'LIKE', 'type' => 'STRING', 'value' => $year ), 'year2_clause' => array( 'key' => 'wpcf-'.$date_field_slug, 'compare' => 'LIKE', 'type' => 'STRING', 'value' => ($year-1) ), 'year3_clause' => array( 'key' => 'wpcf-'.$date_field_slug, 'compare' => 'LIKE', 'type' => 'STRING', 'value' => ($year-2) ) ); } return $query_args; } Relevant Documentation: |
2 | 7 | 3 years, 9 months ago | ||
Custom field conditionally stopped displaying
Started by: Kostas
in: Toolset Professional Support
Problem: Solution: The solution is to use a custom shortcode that will return the row value from the database. // The shortcode needs to be added in Toolset->Settings->Custom Code. add_shortcode('meta', 'meta_fun'); function meta_fun($atts){ global $post; $atts = shortcode_atts(array( 'field' => NULL, ), $atts); extract($atts); if( NULL === $field ) return; // return "Voila"; return get_post_meta($post->ID, $field, true); } // How to use it inside the view [meta field="wpcf-production-year-month"] Relevant Documentation: |
2 | 5 | 3 years, 9 months ago | ||
Occasionally custom post fields are stored twice in the wp_postmeta table
Started by: Kostas in: Toolset Professional Support |
2 | 5 | 4 years, 9 months ago | ||
Custom post expiration time issue
Started by: Kostas in: Toolset Professional Support |
3 | 7 | 5 years, 6 months ago | ||
Post Expiration Date issue
Started by: Kostas in: Toolset Professional Support |
2 | 8 | 5 years, 6 months ago | ||
"Posts" are printed twice in "Post Types" of "Access Control"
Started by: Kostas in: Toolset Professional Support |
2 | 9 | 5 years, 8 months ago | ||
Disable query_var?
Started by: Kostas
in: Toolset Professional Support
Problem: Solution: In our document it gives the example "mysite.com/?post_type=example" which is incorrect. What this attribute is meant to disable is querying for a post in that post type using the post's slug, example "example.com/?book=life-of-pi" where book is the post type and life-of-pi is the slug of the single post. |
2 | 8 | 5 years, 11 months ago | ||
How to modify view’s query on fly
1
2
Started by: Kostas
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution, in this case, with the following reply: Relevant Documentation: |
2 | 31 | 6 years ago | ||
Radio not checked in search form with default
Started by: Kostas
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution, in this case, with the following reply: Relevant Documentation: |
2 | 8 | 6 years ago | ||
Conditional search how to
Started by: Kostas in: Toolset Professional Support |
2 | 11 | 6 years, 1 month ago | ||
How to replace a cred form select input field with a php snippet
Started by: Kostas
in: Toolset Professional Support
Problem: Solution: |
2 | 6 | 6 years, 2 months ago | ||
Pass a variable to a view
Started by: Kostas
in: Toolset Professional Support
Problem: Use third party shortcode insider Views shortcode [wpv-view]. Solution: The shortcode within shortcode is a feature of Views plugin, you can register your own custom shortcode here: Go to Toolset->Settings and click on the Front-end Content tab. Look for the section called Third-party shortcode arguments Relevant Documentation: https://toolset.com/documentation/user-guides/shortcodes-within-shortcodes/ |
2 | 3 | 6 years, 3 months ago | ||
Filter by user’s custom field
Started by: Kostas
in: Toolset Professional Support
Problem: Solution: Set the view filter for this custom field to be filtered by a shortcode parameter. Then you can follow the example below. [wpv-view name='my-view' param="[wpv-user field='wpcf-year']"] Now you need to replace param with the correct shortcode parameter name and the wpcf-year with the correct slug for the custom field. You should add the slug with the wpcf- prefix attached. |
2 | 10 | 6 years, 7 months ago |