Views is a WordPress plugin that lets you display post relationships.
In our user guides, you can find more information on how to display child posts, related posts, brother pages, fields of parents and fields of grandparents.
When you ask for help or report issues, make sure to tell us the type of the relationship you are trying to build and the structure of your data.
Viewing 15 topics - 766 through 780 (of 808 total)
Problem: I have two custom post types in a parent/child relationship. On the child single post Content Template, I include some information from the parent post by inserting another Content Template. Then after the parent post information I want to show custom fields from the child post. However, the custom fields do not appear, and the post context appears to remain the parent post.
Solution: Instead of inserting the parent post Content Template directly into the child post Content Template, use a View filtered by post ID, supplied by a shortcode attribute. Then insert your parent post Content Template in the Loop Output of this nested View.
Problem:
How to check URL param with [wpv-conditional] shortcode to display conditional content
Solution:
You can use [wpv-conditional] shortcode to dispaly conditional output and to grab the URL param value you should use the shortcode [wpv-search-term].
Problem: I would like to create custom post statuses. I would also like to show custom icons on the front-end of the site that visually represent each post status.
Solution: Toolset does not currently provide the ability to create custom post statuses, so custom code or another plugin will be required.
You can use Bootstrap's glyphicons and conditional HTML to display different icons based on the post status. Here's an example:
The issue here is that the user wanted to filter his view by a taxonomy but his view is returning no results.
Solution:
This usually happens when the criteria that is being search for is not met. I would check that the taxonomy that you are using to filter is available on the CPT that you are filtering.
Problem:
How to filter by fields of related posts?
Solution:
It is currently not possible, but is a feature that will become possible after the update to Types 3.0 and related Toolset plugin updates. It won't make the cut for the initial release, but is one of the first features that will be added thereafter.
Problem: I created a View of results filtered by post relationship. When this View is shown on the site, all results are shown until someone selects a filter. I would like to only show results that belong to a specific grandparent.
Solution: You can use a URL parameter to predefine a grandparent post ID, or you can add some custom code that hides all results until at least one filter is selected. Here is that custom code:
add_filter( 'wpv_filter_query_post_process', 'drop_empty_search_query_post_process', 10, 3 );
function drop_empty_search_query_post_process( $query, $view_settings, $view_id ) {
$ids = array(1234,5678);
if (in_array($view_id, $ids)){
if (
// taxonomy filter needs to check for not '0' as well as not empty
( isset($_GET['wpv-relationship-filter-fr-region']) && $_GET['wpv-relationship-filter-fr-region'] != '0' )
||
// taxonomy filter needs to check for not '0' as well as not empty
( isset($_GET['wpv-relationship-filter-int-country']) && $_GET['wpv-relationship-filter-int-country'] != '0' )
) {
} else {
$query->posts = array();
$query->found_posts = 0;
$query->post_count = 0;
}
}
return $query;
}
Replace 1234,5678 with a comma-separated list of Views where you want to apply this custom filter.
Display a child post filed in a parent view inside a table, where the parent view render using data from both parent and child custom posts
The issue i have is that the table i create need to display content from parent and child posts
do i need to insert view inside a view? i.e. in the table cell insert a view of a child to display one field?
Solution:
You are right, it needs a nested view, you need to create a child view, and put the child view into one table cell of the parent view, but I suggest you use only one table cell to display the child view, and the table sort feature won't be able to work in this cell.