I am not exactly sure what do you mean or how should this work exactly?
under my classified ads, there is a category that I want to exclude. Is there a way to do that?
If this is on the [adverts_list] you can exclude a category by adding the code below to your theme functions.php file
add_filter( "adverts_list_query", "exclude_category");
function exclude_category( $args ) {
if( ! is_array( $args["tax_query"] ) ) {
$args["tax_query"] = array();
}
$args["tax_query"][] = array(
'taxonomy' => 'advert_category',
'field' => 'term_id',
'terms' => array( 1000 ),
'operator' => 'NOT IN'
);
return $args;
}
just replace 1000 with actual ID of a category you want to exclude.
very helfull, how do i hide also those categories in widget?
Unfortunately, the widget does not have any filters, the only way to edit the list of categories there would be to open a file wpadverts/includes/class-widget-categories.php and modify the widget() function (most likely you will want to change params passed to get_terms function).
Note that if you will update WPAdverts the changes in this file will be overwritten, so it would be best to copy this code and use it to create your own custom categories widget.