Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Emily,
Would you mind allowing me to have admin access too the site so that I can check on this for you ?
The private fields have been enabled for your next response.
Thanks,
Shane
Hi Shane
Thanks for offering to have a look. What I'm going to do is set up a test version of the site which I will then give you access to. I'll be in touch shortly with the details.
Cheers, Emily
Hi Shane
Could you switch the private fields on again please so I can give you access to the dev site?
Cheers, Emily
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Emily,
Sorry for the delay in response.
Here are the private fields once more.
Thanks,
Shane
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Emily,
Thank you for the credentials.
Have a look at the link here hidden link
I assume this is exactly what you want.
I achieved this by using 2 additional views and removing the loop output content on the archive and replace it with a view.
Firstly I created the view here.
hidden link
This view will list out the Posts of only the parent category when the hook below is applied.
add_filter( 'wpv_filter_query', 'not_all_my_children_term_filter',99,3 );
function not_all_my_children_term_filter( $query_args, $views_settings, $view_id) {
$view_ids = array( 70 );
if (in_array($view_id, $view_ids)){
foreach($query_args['tax_query'] as $tq) {
if( isset( $tq['taxonomy'] ) ){
$tax = $tq['taxonomy'];
$term = get_term_by('id', $tq['terms'], $tax);
$termChildren = isset( $term->term_id ) ? get_term_children($term->term_id, $tax) : null;
$query_args['tax_query'][] = array(
'taxonomy' => $tax,
'field' => 'id',
'terms' => $termChildren,
'operator' => 'NOT IN'
);
}
}
}
return $query_args;
}
Next I added this view to the archive so it lists out only the posts of the parent.
I then created a second view that will list out the posts of the child view.
hidden link
Then I added this view to the view you are using to list out the sub categories so that each post can be listed under the relevant sub category.
Please let me know if this helps.
Thanks,
Shane
Hi Shane
That looks perfect! I think you've gone a little further than I expected, but I love that it's all on the same page. I will have a go at recreating this on the main domain and we should then be good to go!
Thanks for your help with this, you've been amazing. I'm not closing the ticket for the moment as I would like to have a go at recreating it first - I'll let you know when I've done that successfully.
Best wishes, Emily
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Emily,
Happy I was able to assist you.
Please let me know if you need any clarity on this.
Thanks,
Shane
Thanks Shane, all sorted. Thanks for your help with this, your help was very much appreciated.