Black Friday sale! Get up to 25% off GP Premium! Learn more ➝

[Resolved] Custom Sidebar Layout Filter Not Working

Home Forums Support [Resolved] Custom Sidebar Layout Filter Not Working

Home Forums Support Custom Sidebar Layout Filter Not Working

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #377571

    Hi Tom and Leo;

    I tried using a sidebar filter in my child theme’s functions.php file to remove all sidebars from posts with the category slug ‘student-articles’ but it’s not working; the globally set right sidebar still shows on all these category posts. I flushed the cache too.

    Here’s my code:

    add_filter( 'generate_sidebar_layout','tu_custom_category_sidebar_layout' );
    function tu_custom_category_sidebar_layout( $layout )
     	// If we are on a category, set the sidebar
     	if ( is_category( 'student-articles' ) )
     	 	return 'no-sidebar';
     	// Or else, set the regular layout
     	return $layout;

    Any ideas? Maybe it’s not compatible with the current GP release? I note the article at was last updated on December 24, 2016.

    Customer Support

    Hi there,

    That should still work as nothing has changed there.

    Can you link me to a page that’s not working?



    Hi Paul and Leo

    I think what needs to be checked here is if is_singular && in_category


    You got it Jamal! Thanks so much.


    Weird thing happened since I posted this request yesterday. Now my custom page headers aren’t working at all. I removed the above function from my functions file and still no custom page headers.

    Customer Support

    Hmm the function shouldn’t have anything to do with page headers.

    Can you link us to the page?


    Update: I can set a GLOBAL page header to all posts successfully, but when I assign a different custom page header style to a specific category of posts, the global page header style is displayed on those category’s single posts instead. Can’t seem to override the global one by category.



    Click on any post in — these are all set to a Global page header (General Articles page header) with a Green background.

    Compare to the ‘student-articles’ category posts at: — this category uses a custom page header (Student Articles page header) with a Blue background. As you can see, the Global Green page header is being rendered instead even though that category has been set to the Student Articles page header.

    Customer Support

    Hmm this page is just a normal static page and not a post?


    Click on any one of the posts listed on that page to see the problem, Leo. Each one of those posts should have a Blue header with white H1 title in it.

    General articles (accessed via /articles) should have a Green header with title instead.


    I’ve moved this separate issue over to a new thread at

    Will tag the initial problem here as resolved. Thanks.

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