Remove sidebar on posts in a category?
-
Hi all, I am attempting to make all of the posts that are in a category have full page with no sidebar.
To be be clear: I am not referring to a category page of posts; I am referring to individual posts, that are all in the same category. For example, I want the posts in the category “Newsletter” to have a full page on the post, because the sidebar makes it difficult to read the embedded .pdf newsletter.
I’ve searched a bit with no answer: everything I find is to remove a sidebar on category posts pages, not the individual posts themselves. My category pages can have the sidebar.
Thanks in advance for any direction!
-
generally, start by creating a child theme.
then, you could edit single.php in the child theme, and wrap the sidebar call into a conditional statement based on
is_single() && in_category( 'newsletter' )…or, you could add a filter to ‘body_class’ to add a new CSS class, for example
.no-sidebar, also based on a conditional statement withis_single() && in_category( 'newsletter' )… and then use this CSS class in your styles to hide the sidebar and stretch the content…Thank you for your reply. Child theme – check! I always make child themes for css, but have rarely delved into php, and even then it was a couple years ago so I’m basically going in blind!
I regret not including more info, but I truly thought there was a blanket answer out there, and offering a link wouldn’t be relevant.
Here is a link to one of the newsletters in the Newsletters category, the parent theme is Frontier, child theme Frontier Child with only a .css file:
http://www.reaching-out.info/mar-apr-2017/Everything you wrote up there is greek, but I don’t see a single.php in the theme’s files under Appearance/Editor/Frontier. Does this mean I should use a different theme?
Theme Files
style.css
funcitons.php
editor-style.css
includes – genericons,options-framework,slider
responsive.css
rtl.css
404.php
author.php
comments.php
footer.php
forum.php
header.php
index.php
loop-blog.php
loop-single.php ??
options.php
page-blank.php
page-c.php
page-cs.php
page-sc.php
page-scs.php
page-sitemap.php
sidebar-left.php
sidebar-right.php
slider.php
languages – readme.txt
license.txt
readme.txt
The topic ‘Remove sidebar on posts in a category?’ is closed to new replies.