Is it possible to limit the quantity of categories listed in the categories widget? There will be too many at some point to fit.
Hey Tanja,
Thank you for the inquiry.
Are you using the default Categories widget? If so, you can add this filter in the functions.php file:
function avf_widget_categories_args_mod( $cat_args, $instance ) {
$cat_args['number'] = 10; // Limit to 10 categories.
return $cat_args;
}
add_filter( 'widget_categories_args', 'avf_widget_categories_args_mod', 10, 2 );
Best regards,
Ismael
Thank you!
.
Thank you. There are two instances of the default Categories widget in use. One needs all categories listed, the other needs up to 10. How can that be done?
The functions.php file updated didn’t work. 11 entries show in the list.
Hi,
Your login in not working, but there is not a way to use the same Categories Widget twice on the same page and have two different results, such as one showing all results and the other only showing 10 with the PHP code.
Perhaps if you added a custom class to the one that you only want to show 10, some css could be used to hide all others, but I can’t find an example page on your site to examine.
Best regards,
Mike