Conversation
supportHi please can you add feature or new parameter to hide categories with empty ads or zero ads in [adverts_categories] shortcode, I created lots of categories but I dont want users viewing empty categories without ads, only the categories containing ads should be visible. Thanks
Hi, you can hide the empty categories by adding the below code snippet in your theme functions.php file (or even better by creating a new blank plugin and pasting the code there https://wpadverts.com/blog/how-to-use-code-snippets-in-wordpress/ ) add_filter( "adverts_categories_query", function( $args ) { $args["hide_empty"] = 1; return $args; } );
Thanks a lot the code worked, but does not work for sub categories when using (show=all) parameters
For sub-categories you will need another code snippet add_filter( "adverts_categories_query_sub", function( $args ) { $args["hide_empty"] = 1; return $args; } );
Thanks a lot
Hi, you can hide the empty categories by adding the below code snippet in your theme functions.php file (or even better by creating a new blank plugin and pasting the code there https://wpadverts.com/blog/how-to-use-code-snippets-in-wordpress/ ) add_filter( "adverts_categories_query", function( $args ) { $args["hide_empty"] = 1; return $args; } );
Thanks a lot the code worked, but does not work for sub categories when using (show=all) parameters
For sub-categories you will need another code snippet add_filter( "adverts_categories_query_sub", function( $args ) { $args["hide_empty"] = 1; return $args; } );
Thanks a lot