I am trying to display related posts of the same taxonomy on the taxonomy archive page. I have created a custom Taxonomy called "Locations" that is hierarchical. For example:
Washington
-- King County
-- Seattle
For the posts I created, I have checked ONLY the Seattle term for locations on several posts, not the King County and Washington parent terms.
I have also created a view to display posts with a Taxonomy filter set to "Set by the current archive page". So my expectation is that when I load archive pages, I will either see Seattle posts or not. For example:
Expectation:
Washington Archive Page - Should not see Seattle posts
-- King County Archive Page - Should not see Seattle posts
-- Seattle - Should See Seattle posts
However, I see the Seattle posts on all 3 levels of the Archive pages.
Furthermore, I would expect that if my post has both Seattle and King County selected, then the corresponding archive pages for Seattle and King County would also show those posts while the Washington archive page would not (since I didn't select Washington)
How do I show posts that only have on the archive pages where I have only selected the same taxonomy (e.g. Seattle selected on the Seattle Archive page and not the parent pages)?
However, now it only shows on the child page. If I have a post that has Thurston County AND Seattle selected, it will only show on the Seattle archive page, not the Thurston County page.
Can I've example URLs on what URL you want to include the child term post or on what URLs it should not display what posts and what not and share admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
- lien caché - Should display "Mortgage Calculator" only
- lien caché Should display "Mortgage Calculator" only
- lien caché Should display "Mortgage Calculator" AND "About Yelm"
Do you mean that when displaying any of the child term archive page - you want to dispaly parent term posts as well on child term archive page.
Lets consider the following example: lien caché
- only posts belongs to term "washington"
- lien caché
On above child term archive page you want to display posts belongs to term:
thurston-county + ( washington) (if any post attached to parent term)
- lien caché
On above child term archive page you want to display posts belongs to term:
yelm + ( thurston-county + washington) (if any post attached to these parent terms)
But just for this particular view. For other views I am displaying children taxonomies. I have a view called "Child Taxonomy Links" that works fine as is.
As you are using the following view to filter the post based on the current post archive term:
=> lien caché
You should remove any other code you added as I've added the following view's filter code to exclude the child to "Custom Code" section offered by Toolset:
=> lien caché
add_filter( 'wpv_filter_query', 'func_exclude_children_post__view_taxonomy', 99, 3 );
function func_exclude_children_post__view_taxonomy( $query_args, $view_settings, $view_id ) {
$target_view_ids = array(617);
if (in_array($view_id,$target_view_ids) and !empty($query_args['tax_query']) ){
$query_args['tax_query'][0]['include_children'] = 0;
}
return $query_args;
}