Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1478812

    Is it possible to limit the quantity of categories listed in the categories widget? There will be too many at some point to fit.

    #1478831

    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

    #1478869

    Thank you!

    #1478873

    .

    • This reply was modified 1 day, 18 hours ago by Sandy.
    #1478875

    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?

    #1478877

    The functions.php file updated didn’t work. 11 entries show in the list.

    #1478929

    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

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.