you could use the conditional tags, for instance in_category('scrapbook'), in single.php to exclude the call for the sidebar;
and the same probably in header.php, to add a special css class to the body tag, to style the content width.
http://codex.wordpress.org/Conditional_Tags
http://codex.wordpress.org/Conditional_Tags#A_Category_Page
Thanks for the reply! I’m not the best with coding, but I normally get there after a day of trial and error. Will this code open up the posts as full width?
Also do I have to edit any css?
cheers π
That’s the top bit of code in my single.php but I have no idea where to put conditional tags π
<?php get_header(); ?>
<div id="content" class="col-full">
<div id="main" class="col-left">
<?php if ( function_exists( "yoast_breadcrumb" )) { yoast_breadcrumb('<div id="breadcrumb"><p>','</p></div>'); } ?>
<?php if (have_posts()) : $count = 0; ?>
<?php while (have_posts()) : the_post(); $count++; ?>
<div class="post">
<h1 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1><?php if(get_the_tags()) { ?> <?php the_tags('Tags: ', ', '); } ?>
<?php if(get_the_tags()) { ?> <?php the_tags('Tags: ', ', '); } ?>
<p class="date">
<span class="day"><?php the_time('j'); ?></span>
<span class="month"><?php the_time('M'); ?></span>
</p>
step 1:
to add a special body class to single posts with the category ‘scrapbook’:
edit header.php and find:
<body <?php body_class(); ?>>
change it to:
<?php if( is_single() && in_category('scrapbook') ) { ?>
<body <?php body_class('scrapbook'); ?>>
<?php } else { ?>
<body <?php body_class(); ?>>
<?php } ?>
step 2:
edit style.css and add:
body.scrapbook #sidebar { display: none; }
body.scrapbook #main.col-left { width:100%; }
hopefully, this is all that needs to be changed;
good luck π
Cheers for the help! I’m afraid that didn’t work π the posts are still opening with a side bar π
there should not be a space between body and .scrapbook in style.css;also there is no # before body
see the styles in my last reply.
I’m an idiot. You’re a hero.
Thankyou!
Hey again,
I seem to be having the same problem but with a different theme. I did everything you said and it worked on the last theme but for some reason it doesn’t seem to be working now π
Also my sidebar messes up and doesn’t display “popular” “comments” “featured” or the “tag cloud” on any page other than the home page π
Any suggestions?
cheers
Could this be applied to a page rather than a category?
I have managed to remove the sidebar using a custom template where I just removed the sidebar line of code, but the page doesn’t take advantage of the extra space left behind by the sidebar.
If anyone can help me sort out the gallery page at http://www.easy10.co.uk i would be most grateful.
Thanks