Archived topic
category page sidebar has 3 columns, should be a single column
7 replies · Started by Cathryn on January 8, 2023
Hi,
Between the customizer and the Elements areas, I've been going back and forth trying to set my blog pages like so:
General blog page -- just content (no sidebar) with masonry excerpts, 3 columns. [WORKS FINE]
Single post page -- content, right sidebar (with 2 widgets - recent posts & categories) [WORKS FINE]
Category page -- content, right sidebar, same as above. [THIS IS WONKY]
What's happening is the category sidebar has 3 columns! Please see here: https://www.ace4safetrails.org/category/agencies/
Sorry, but it's really confusing going between the 2 areas - customizer and elements to adjust things... Can you please shed some light on this?
thank you.
Hi Cathryn,
The Query Loop Block isn't intended to appear on archive pages - thus, the issue. Try adding this snippet:
add_filter( 'post_class', function( $classes ) {
if ( ! is_admin() && in_array( 'gb-query-loop-item', $classes ) ) {
$index = array_search('generate-columns',$classes);
if($index !== FALSE){
unset($classes[$index]);
}
}
return $classes;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
It should fix the issue.
Let us know how it goes.
Sorry, Fernando, I added the snippet, it's been activated but there's no change:
https://www.ace4safetrails.org/category/agencies/
Thanks again for your help!!
I see. Can you provide admin login credentials? I'll take a closer look.
Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
OK, information provided.
I modified the code above. Can you try updating the code you have with that?
Thank you, this worked. I understand that normally, the archive pages wouldn't pull in the 'recent posts', but we're just getting started so the pages are rather empty and this looks very nice for now.
I appreciate your help!
You're welcome, Cathryn!