• Resolved carmeljune

    (@carmeljune)


    There has been some discussion on this, but not enough to fully explain how it can be done. I would like to choose which pages have the sidebar, and on the others have no sidebar at all. I’m sure it can be done, but could someone please explain how?

    If it is a matter of coding, please tell what page to go to as well as how to modify the code.

    much appreciated,
    cj

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter carmeljune

    (@carmeljune)

    oh, I’m using iCandy theme … is the answer in there? I’ve been working on this all day, learning a lot, but not getting anywhere with this main problem. Would really appreciate some help, even if anyone knows that it can’t possibly be done. The blog it just my name, https://www.carmeljames.com

    most likely you can get rid of the sidebar by taking it out of the code. Look at page.php by going to “Appearance” -> “Editor” -> “Page.php” (should be listed on the right)

    search for <?php get_sidebar(); ?> and delete it.

    <?php get_sidebar(); ?> inserts the code in sidebar.php and inserts it at that point

    If you want to have it on certain pages generated by lets say page.php but not all of them, you can make an if. Like this:
    <?php if( is_page(array(7, 13, 15, 17, 19)) ):?>
    <div class=”blabla”><?php get_sidebar(); ?></div>
    <?php else: endif; ?>

    Or something like that! This requires that you know the ids of the pages you want to include Or exclude though.

    Thread Starter carmeljune

    (@carmeljune)

    thanks bnr289 and mYrAn, good suggestions, but it still leaves the space for the side bar, it doesn’t allow the page to fill out.

    I didn’t think this would be so uncommon/difficult. When I look at blogs with side bars, it seems so wasteful to have the information repeated on every page.

    That’s because your post container has a fixed width, so even if you remove the sidebar it still has the same width. You’re going to want it to be automatic, so it fills the space even when the sidebar isn’t there.

    Thread Starter carmeljune

    (@carmeljune)

    that sounds like what I want … any idea how I do this?

    Thread Starter carmeljune

    (@carmeljune)

    I have found 2 solutions for this .. one costs, thesis theme, but it’s a good theme, really worth looking at for the way it organises modifications in custom files that aren’t changed when making updates.
    But the other is a neat bit of code from this page:
    https://www.kisaso.com/technology/thesis-customization-selected-category-posts-without-sidebar/

    Thread Starter carmeljune

    (@carmeljune)

    This is the final solution

    function kish_picture_page_no_sidebar() {
     global $post;
     if ( !is_category() ) return;
     $cats=get_the_category($post->ID);
     foreach($cats as $cat) {
     if( in_array($cat->cat_name,array("Birds", "Gardens", "Technology")) ) {
     {?>
     <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');

    Thread Starter carmeljune

    (@carmeljune)

    resolved … change.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘how to remove sidebar from selected pages’ is closed to new replies.