davidH-33
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 |
---|---|---|---|---|---|
Custom shortcode in Elementor shortcode or text widget
Started by: davidH-33 in: Toolset Professional Support |
2 | 3 | 3 years, 1 month ago | ||
Error when "check_if_allowed_by_user_role" shortcode is displayed without log in
Started by: davidH-33 in: Toolset Professional Support |
2 | 5 | 3 years, 1 month ago | ||
Displaying view that shows only items related to user role of logged user
Started by: davidH-33 in: Toolset Professional Support |
3 | 8 | 3 years, 1 month ago | ||
Frontend filtering for Event – filter each day based on CPF Datetime
Started by: davidH-33
in: Toolset Professional Support
Problem: Solution: [wpv-control-postmeta values=",23/07/2021,24/07/2021,25/07/2021" display_values="Every day,Friday 23.07.2021,Saturday 24.07.2021,Sunday 25.07.2021" field="wpcf-screening-date" type="select" source="custom" url_param="wpv-day"]> add_filter( 'wpv_filter_query', 'default_this_month_inclusive', 10, 3 ); function default_this_month_inclusive ( $query, $view_settings, $view_id ) { if( $view_id == 1784 ) { $selected_start = 0; // strtotime('0:00:00'); $selected_end = 9999999999; // determine if user has selected a start or end date, and destroy those meta query items if ( isset($query['meta_query']) ) { foreach($query['meta_query'] as $key => $meta) { if(isset($meta['key']) && $meta['key'] == 'wpcf-screening-date'){ // get a timestamp that represents 12:00 am on the event start date $selected_start = strtotime(date($meta['value']) . ' 0:00:00'); unset($query['meta_query'][$key]); } if(isset($meta['key']) && $meta['key'] == 'wpcf-screening-date'){ // get a timestamp that represents 11:59:59 pm on the event end date $selected_end = strtotime(date($meta['value']) . ' 23:59:59'); unset($query['meta_query'][$key]); } } } $args = array( 'relation' => 'AND', array( 'key' => 'wpcf-screening-date', 'value' => $selected_end, 'compare' => '<=', 'type' => 'numeric' ), array( 'key' => 'wpcf-screening-date', 'value' => $selected_start, 'compare' => '>=', 'type' => 'numeric' ) ); // add these arguments to your meta query $query['meta_query'] = isset($query['meta_query']) ? $query['meta_query'] : []; $query['meta_query'][] = $args; } return $query; } Relevant Documentation: |
2 | 5 | 4 years ago | ||
Filter stops working when displayed on mapped subdomain
Started by: davidH-33 in: Toolset Professional Support |
2 | 3 | 4 years, 10 months ago | ||
Displaying page with with the listing View filtered by term
Started by: davidH-33
in: Toolset Professional Support
Problem: Setup default value of checkbox field in custom search form. Solution: You can pass URL parameter to view, for example: Relevant Documentation: |
2 | 3 | 5 years, 7 months ago | ||
Displaying featured image of previous and next post on single post page
Started by: davidH-33
in: Toolset Professional Support
Problem: I would like to display "next post" and "previous post" links on my single post template. I would like to access the featured image of each of those posts to use in the links. Solution: There's nothing built-in to Toolset that will do this for you, but for a very simple case I have a custom shortcode you can use. Add this to a new code snippet, or to your child theme's functions.php file: function ts_get_adjacent_post_id_func($atts) { global $post; $atts = shortcode_atts([ 'previous' => false ], $atts); $adjacent = get_adjacent_post( false, '', $atts['previous']=='true'); return isset( $adjacent->ID ) ? $adjacent->ID : ''; } add_shortcode("ts_get_adjacent_post_id", "ts_get_adjacent_post_id_func"); Now you have a shortcode you can use like this: Previous post featured image: [wpv-post-featured-image item="[ts_get_adjacent_post_id previous='true']"] Next post featured image: [wpv-post-featured-image item="[ts_get_adjacent_post_id]"] There is a quirk here you should be aware of. Basically on the first post, the previous ts_get_adjacent_post_id will return no value. However, if you put no value in the wpv-post-featured-image shortcode "item" attribute, the featured image from the current post will be displayed. Similarly on the last post, the next ts_get_adjacent_post_id shortcode will return no value. Therefore, you should use a conditional that tests whether the previous or next post ID is the empty. If so, then you should hide the previous or next featured image shortcode. Relevant Documentation: |
2 | 3 | 5 years, 8 months ago | ||
Displaying image only for custom term
Started by: davidH-33 in: Toolset Professional Support |
2 | 5 | 5 years, 9 months ago | ||
Filtering View with shortcode
Started by: davidH-33
in: Toolset Professional Support
Problem: I would like to filter a View by the title of the current post, using a shortcode attribute. Solution: You can embed one Views shortcode inside another Views shortcode to apply a filter. Relevant Documentation: |
2 | 4 | 5 years, 9 months ago |