Tell us what you are trying to do?
I added a taxonomy view but it is displaying all the subcategories on the frontend search bar. I want by default to open the main category but I don't want the text label to be visible in the filter view. Instead, I want only 3 categories Fertility - Maternity - Support & administration visible in the filter view + to add a search field with drop-down menu with all the subcategories on the same div
Is there any documentation that you are following?
I was searching but I didn't find anything and I didn't find a way to filter this
Is there a similar example that we can see?
I do not know
What is the link to your site? hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
In the taxonomy view's query filter settings, you can set the parent filter to 'None' as shown in the attached screenshot.
This will give you the list of all the parent terms, without the child terms.
regards,
Waqar
Hello again Waqar,
It doesn't work this way. I have custom view Team top members and posts with all the team members. When I use the suggested from your setup I cannot see them.
Thanks for writing back.
To better understand the setup and suggest the next steps, I'll need to see how this view and the terms are set up in the admin area.
Can you please share temporary admin login details, in reply to this message?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
Hello Waqar,
I hope you can find some time to look into my issue with the front-end display filtering.
Best,
Charitos
Thank you for sharing the access details.
I see that there are two views used on the 'Our Team' page.
1). Team Top Members:
This is a taxonomy view to show the 'Team Top Positions' taxonomy terms.
2). Team Bottom Members:
This is a post view to show the list of 'Team Members' posts.
For what you're trying to achieve for the upper top section, you'll need a post view and not a taxonomy view. That is because our goal is to show the 'Team Members' posts and not just the taxonomy terms.
I would recommend creating a duplicate of the view 'Team Bottom Members' and using that for this upper top section too. The difference would be that this view will be using the taxonomy filter for the 'Team Top Positions' and not the 'Team Bottom Positions'.
Once this view is ready and working, let me know and I'll assist you with some custom script to show only the parent-level taxonomy terms (Fertility - Maternity - Support & administration) in this view's filter.
Hi Waqar,
I did it, I tried to add filters to the subcategories but it won't show the team members if I hide it from the search.
Best,
Vessy
Hi Waqar,
Did you have time to look at the filtering solution?
Best,
Charitos
Thank you for sharing this update.
I've added the following CSS code in the view 'Team Top Members' and now, it is only showing the sub-parent level term options:
form[name="wpv-filter-155"] .form-group input[name="wpv-top-position"],
form[name="wpv-filter-155"] .form-group label {
display:none;
}
form[name="wpv-filter-155"] .form-group label[for="top-position-fertility"],
form[name="wpv-filter-155"] .form-group label[for="top-position-maternity"],
form[name="wpv-filter-155"] .form-group label[for="top-position-support"] {
display:block;
}
Hi Waqar,
Thank you for the filters but this still doesn't display all the items by default when I load the page. I mean, when I load the page I want all the team members to be shown. When I press 'Fertility' to filter only the fertility team members, the same for the other 2 categories.
Best,
Charitos
Hi Waqar,
I managed to solve my problem. I adjusted the filters in the functions.php:
// filters for all team members by priority category
add_filter( 'wpv_filter_query', 'filter_include_cat_fn_159', 1000 , 3 );
function filter_include_cat_fn_155( $query_args, $view_settings ) {
if ( isset( $view_settings['view_id'] ) && $view_settings['view_id'] == 155 ) {
if ( empty( $query_args['tax_query'] ) ) {
$query_args['tax_query'][0]['taxonomy'] = 'top-position';
$query_args['tax_query'][0]['field'] = 'slug';
$query_args['tax_query'][0]['terms'] = array( 'expert-doctors', 'embryologists', 'midwives', 'nurses', 'care-taker', 'administration', 'accounting', 'services' );
$query_args['tax_query'][0]['operator'] = 'IN';
$query_args['tax_query'][0]['include_children'] = '';
$query_args['tax_query']['relation'] = 'AND';
}
}
return $query_args;
}
add_filter( 'wpv_filter_query', 'filter_include_cat_fn_159', 1000 , 3 );
function filter_include_cat_fn_159( $query_args, $view_settings ) {
if ( isset( $view_settings['view_id'] ) && $view_settings['view_id'] == 159 ) {
if ( empty( $query_args['tax_query'] ) ) {
$query_args['tax_query'][0]['taxonomy'] = 'bottom-position';
$query_args['tax_query'][0]['field'] = 'slug';
$query_args['tax_query'][0]['terms'] = array( 'expert-doctors', 'midwives', 'nurses', 'care-taker', 'admin', 'accounting', 'services' );
$query_args['tax_query'][0]['operator'] = 'IN';
$query_args['tax_query'][0]['include_children'] = '';
$query_args['tax_query']['relation'] = 'AND';
}
}
return $query_args;
}
I have the view I wanted.
Thank you for the help. Much appreciated.
Best,
Charitos