sidebar on category pages
-
I got this terrific bit of code from https://www.kisaso.com/technology/thesis-customization-selected-category-posts-without-sidebar/
function kish_picture_page_no_sidebar() { global $post; $cats=get_the_category($post->ID); foreach($cats as $cat) { if($cat->cat_name=='Pictures') { if (is_single()) {?> <style> #sidebars { display: none; border: none; } #container {width:940px} #content {width:100%; background} #content_box { background:none; } #content_box img{max-width:850px;height:auto;} </style> <?php } } } } add_filter('thesis_hook_before_html', 'kish_picture_page_no_sidebar');
I can modify it in 2 ways.
by removingif (is_single())
it will remove the side bar from all of the ‘pictures’ category pagesby removing all of the following and one bracket at the end, it will remove the side bar from all category pages, which is what I’m after.
if($cat->cat_name=='Pictures') { if (is_single())
However, (there’s always a however!) I want the sidebar on my home page.
Can someone please tell me how to write this code so it says
except for home page, remover sidebar from all category pages.
failing this, can it say:
if the category is pictures, gardens or birds,
then remove sidebar.Thanks heaps you lovely php person, very grateful.
- The topic ‘sidebar on category pages’ is closed to new replies.