- This topic has 10 replies, 3 voices, and was last updated 6 years, 2 months ago by
Paul.
-
AuthorPosts
-
September 1, 2017 at 1:37 pm #377571
Paul
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 https://docs.generatepress.com/article/sidebar-layout/ was last updated on December 24, 2016.
September 1, 2017 at 2:24 pm #377600Leo
StaffCustomer SupportHi there,
That should still work as nothing has changed there.
Can you link me to a page that’s not working?
Thanks!
September 1, 2017 at 2:51 pm #377606Jamal
Hi Paul and Leo
I think what needs to be checked here is if
is_singular && in_category
September 2, 2017 at 10:35 am #377947Paul
You got it Jamal! Thanks so much.
September 2, 2017 at 10:55 am #377962Paul
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.
September 2, 2017 at 10:58 am #377966Leo
StaffCustomer SupportHmm the function shouldn’t have anything to do with page headers.
Can you link us to the page?
September 2, 2017 at 11:06 am #377973Paul
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.
September 2, 2017 at 11:13 am #377975Paul
Leo,
Click on any post in http://dev.ayurvedacollege.com/articles/ — 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: http://dev.ayurvedacollege.com/student-papers/ — 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.
September 2, 2017 at 5:43 pm #378087Leo
StaffCustomer SupportHmm this page is just a normal static page and not a post? http://dev.ayurvedacollege.com/student-papers/
September 3, 2017 at 10:27 am #378391Paul
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.
September 3, 2017 at 12:09 pm #378443Paul
I’ve moved this separate issue over to a new thread at https://generatepress.com/forums/topic/new-page-header-not-working-properly/
Will tag the initial problem here as resolved. Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.