siteorigin / so-widgets-bundle

The SiteOrigin Widgets Bundle gives you all the elements you need to build modern, responsive, and engaging website pages. Using the Widgets Bundle, you can quickly and effortlessly add buttons, sliders, heroes, maps, images, carousels, features, icons, and so much more.
https://siteorigin.com/widgets-bundle/
94 stars 66 forks source link

Blog: Add `siteorigin_widgets_blog_filter_categories_output` #2005

Closed AlexGStapleton closed 1 month ago

AlexGStapleton commented 1 month ago

This PR adds the siteorigin_widgets_blog_filter_categories_output. This filter allows developers to modify the output category list for posts.

Test snippet to filter out non-top-level categories:

add_filter( 'siteorigin_widgets_blog_filter_categories_output', function( $categories ) {
    if ( empty( $categories ) ) {
        return $categories;
    }

    return array_filter( $categories, function( $category ) {
        return $category->parent === 0;
    } );
}, 10, 1 );