With the Views plugin you can create different Views elements to display all your custom types and content on the front-end, without coding. You can also create powerful parametric searches and add pagination to your content lists.
When you ask for help or report issues, make sure to tell us the options of your View.
Viewing 15 topics - 1,816 through 1,830 (of 1,853 total)
Problem:
The user would like to display repeatable groups in a custom post type, but the view renders all the child posts from all posts rather than the child from the current post.
Solution:
When displaying a repeatable group, make sure to choose the correct relationship for the view, the relationship is holding the repeatable group to the assigned custom post type. Check this screenshot https://prnt.sc/sym45z
Problem:
The user has a grid view and would like to add a static element(add button) as the last grid cell when the view has results less than 18.
Solution:
The best/easy way is to hook into the view and test how many results it has, if less than 18, we'll inject a default post.
Inside the loop we'll create a condition to display a different content template for that default post.
A sample code to inject the post is:
add_filter( 'wpv_filter_query_post_process', 'jts_inject_draft_promo', 10, 3 );
function jts_inject_draft_promo( $query, $view_settings, $view_id ) {
// replace this with the default/draft promo post idate
$default_promo_id = 123;
if ( $view_id == 784 ) {
if ( $query_post_count < 18 ) {
$default_promo = get_post( $default_promo_id );
$query->found_post[] = $default_promo;
$query->found_count = $query->found_count + 1;
}
}
return $query;
}
A sample code to conditionally display a different Elementor template for the default post is: