WordPress.org

Ready to get started?Download WordPress

Forums

Removing sidebar from pages (9 posts)

  1. spiralea5
    Member
    Posted 1 year ago #

    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?

    Thanks
    http://www.mylovetoulouse.com

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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/

  3. spiralea5
    Member
    Posted 1 year ago #

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

    thanks

  4. jengossman
    Member
    Posted 1 year ago #

    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.

  5. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    @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.

  6. spiralea5
    Member
    Posted 1 year ago #

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

  7. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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; }
  8. spiralea5
    Member
    Posted 1 year ago #

    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 :(

  9. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags