Support » Theme: ColorMag » exclude category from widget

  • Hi, I wrote this code to exclude articles from a specific category from the featured post slider widget, but it doesn’t work. Do you have any suggestions?

    function exclude_category_from_slider($args) {
    	$exclude = "16";
    	$args["exclude"] = $exclude;
    
    	return $args;
    }
    
    add_filter("colormag_featured_posts_slider_widget","exclude_category_from_slider");
    
    • This topic was modified 6 months, 4 weeks ago by FabriSS.
    • This topic was modified 6 months, 4 weeks ago by FabriSS.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @fabriss ,

    I apologize for the delay.

    Could you please let me know if you have created a custom hook for this? If you have not then the code above will not work as only using add_filter() will not make any changes in your site unless an apply_filter() is used for that.

    You can, however, edit your post and choose the category of the post as “Uncategorized” if you want to remove it from a specific category. But remember that not only it will remove the post from the slider but also from other widgets or pages as well.

    Regards,
    ThemeGrill Support Team

    Thread Starter FabriSS

    (@fabriss)

    Hi Bikalpa

    the hook is colormag_featured_posts_slider_widget already included in colormag. Am I wrong to call him back?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘exclude category from widget’ is closed to new replies.