• I have a separate page for a specific category called “scrapbook

    The page displays the posts totally fine, but when I click on a post I want it to open as a full width page.

    Is this possible? It’s just the posts of that specific category that I want to open as full width.

    Thanks for any help!

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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

    Thread Starter royb121

    (@royb121)

    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 πŸ™‚

    Thread Starter royb121

    (@royb121)

    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 πŸ˜‰

    Thread Starter royb121

    (@royb121)

    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.

    Thread Starter royb121

    (@royb121)

    I’m an idiot. You’re a hero.

    Thankyou!

    Thread Starter royb121

    (@royb121)

    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

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Full width page for specific category’ is closed to new replies.