Support » How-To and Troubleshooting » Removing sidebar from pages

Removing sidebar from pages

  • Hello,

    I’m trying to remove the sidebar from certain pages in my site. The trouble is the code for my sidebar is in footer.php and not page.php. I was hoping I could just make a custom template and do it that way, but now I’m stuck. Any ideas?


Viewing 8 replies - 1 through 8 (of 8 total)
  • Michael


    Forum Moderator

    you could try to wrap the call of the sidebar into a conditonal statement using the is_page() conditional tag; http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    please contact the developer of your theme (wpshower ?) for support with details;

    this forum only fully supports themes from http://wordpress.org/extend/themes/

    ok great, I’ll try that and contact the developer if all else fails.


    Please assist better – how an I remove a sidebar from one or two, not all, of my pages? I have searched and searched for answers on multiple situations and have had absolutely no luck and no responses.



    Forum Moderator

    @jengossman – please start a new thread per http://codex.wordpress.org/Forum_Welcome#Where_To_Post

    You can do so here: http://wordpress.org/support/forum/how-to-and-troubleshooting#postform

    These forums don’t work well to have more than one person per thread. Also be sure to include a link to your site in your new thread.

    That worked great, thanks! Now I just need to increase the width of the content on those pages.



    Forum Moderator

    as your theme does not use body_class(), you will possibly need to inject a custom css class (.full-width) into the div <div id="container" class="clear"> (this might be in page.php or header.php ?) for those pages, using the same conditional tags as for the sidebar; then use that css class to create specific styles for the ‘full-width’ pages.

    example, to be added into style.css of your child theme:

    .full-width #content { width: auto; }
    .full-width .post-content { margin-right: 30px; }
    .full-width .entry .post-comms { right: 30px; }

    ok now I’m lost. I found the <div id=”container” class=”clear”> in header.php, but I’m not sure which bit of code to put in here or where to put the conditional tags. My skills are a bit limited 🙁



    Forum Moderator

    try to change the line to:

    <div id="container" class="clear<?php if( is_page(array(1,2,3,4,5)) ) echo ' full-width'; ?>">

    insert your own relevant page IDs instead of 1,2,3,4,5

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Removing sidebar from pages’ is closed to new replies.