WordPress.org

Ready to get started?Download WordPress

Forums

Twentyeleven theme. Supress right side bar on certain pages. (6 posts)

  1. Pvteyez
    Member
    Posted 1 year ago #

    I want to ad googlead sense to my sight. I added a right sidebar to the theme and figured out where to paste the google code. I'd like the static home page to display with no sidebar and no ads. Can I supress the side bar on just that one page?

  2. gerald@WPcustoms
    Member
    Posted 1 year ago #

    yes that`s no problem

    <?php
    if ( is_home() ) {
        // This is a homepage
    } else {
        // This is not a homepage
    }
    ?>

    http://codex.wordpress.org/Function_Reference/is_home
    http://codex.wordpress.org/Function_Reference/is_front_page

  3. Pvteyez
    Member
    Posted 1 year ago #

    That seems simple enough. Now where would I find the code that diaplays the sidebar? I'm assuming that if I nest it in the "else" side of that statement I'll be good to go. I hate to sound stupid but after 25 years of coding this is my first effort with wordpress and php so I'm feeling pretty clueless. I've been a programmer since the abacus, but my knowledge of php is limited to spelling it!

  4. gerald@WPcustoms
    Member
    Posted 1 year ago #

    no problem - the codex is your new homepage then :)
    http://codex.wordpress.org/Function_Reference/get_sidebar
    you`ll find nearly everything in there for custom modifications

  5. Pvteyez
    Member
    Posted 1 year ago #

    Thanks again. I'll leave this thread open until I have a chance to implement the change later today. Great support resource you folks have here!

  6. Pvteyez
    Member
    Posted 1 year ago #

    I wanted to play with this on my own before aaking for help again but...

    I've activated the "content on left" option in twentyeleven which gives me a right sidebar. Then I go back and try to find where that right side bar is implemented and bypass it with:

    if ( is_home() ) {
    // Do nothing and return to the code
    } else {
    // All the wp code for the sidebar here
    }

    I've tried doing this in sidebar.php, theme-funtions.php in the includes folder and a few other spots. It doesn't generate an error but it continues to allocate space for the sidebar on my home page which is what I'm trying to eliminate. Basically I'm trying to preserve the one column look on the home page while having a sidebar for adsense everywhere else.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.