Remove Simple Sidebar from home.php

Community Forums Forums Design Tips and Tricks Remove Simple Sidebar from home.php

This topic is: resolved

This topic contains 9 replies, has 3 voices, and was last updated by  optimus203 6 months, 4 weeks ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #31904

    xtego
    Participant
    Post count: 8

    I previously removed the primary sidebar from home.php using the following line:

    remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ );

    This worked great, however, as I continued to work on the site it became clear to me that I was going to have to use different sidebars on different pages.  I added Genesis Simple Sidebars.  This was a perfect solution for what I needed.  However, now the primary sidebar is back on my home page.  Apparently the line above has no bearing when you are using simple sidebars.  What do I need to do to remove the primary sidebar generated by simple sidebars on the homepage only (home.php)?  I am assuming it is another simple one-liner, but i’m having trouble figuring it out.  Can anyone help me out?

    Thanks in advance!

    #31909

    braddalton
    Participant
    Post count: 9210

    You’d need a conditional tag.

    [php]
    !is_home()
    [/php]

    Or try this: http://wordpress.org/extend/plugins/genesis-layout-extras/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #31911

    xtego
    Participant
    Post count: 8

    Genesis Layout Extras would work nicely, however, I need to maintain the secondary sidebar.  There is no option for “Content-Secondary” that I see.

     

    Can you explain where I would use the conditional tag?… (you’ll have to forgive me, I’m not much of a coder)

     

    Thanks!

    #31914

    braddalton
    Participant
    Post count: 9210

    You’d need to post this in the plugin forum and David will answer you quickly. Its to do with the plugin.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #31919

    xtego
    Participant
    Post count: 8

    I shouldn’t have to use Genesis Layout Extras.  All I have to do is remove the Primary Sidebar from one page.  I’ve done it before with a single line added to home.php when I was using the default sidebars.  Simple Sidebars obviously has a different name for the action.  I’m trying to figure out what that is.

    I’ve tried adding the following line to home.php, but to no avail:

    remove_action(‘genesis_sidebar’, ‘ss_do_sidebar’);

     

    #31922

    xtego
    Participant
    Post count: 8

    I figured it out.  I made changes to genesis-simple-sidebars/plugin.php.  I replaced these lines:

    function ss_sidebars_init() {
         remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ );
         remove_action( ‘genesis_sidebar_alt’, ‘genesis_do_sidebar_alt’ );
         add_action( ‘genesis_sidebar’, ‘ss_do_sidebar’ );
         add_action( ‘genesis_sidebar_alt’, ‘ss_do_sidebar_alt’ );

    }

    with this (based off of your original suggestion):

    function ss_sidebars_init() {
         if (!is_home()) {

              remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ );
              remove_action( ‘genesis_sidebar_alt’, ‘genesis_do_sidebar_alt’ );
              add_action( ‘genesis_sidebar’, ‘ss_do_sidebar’ );
              add_action( ‘genesis_sidebar_alt’, ‘ss_do_sidebar_alt’ );

              }

    }

    This, in effect, maintains the standard sidebars for the home page, while all other pages get simple sidebars.   Thanks for pointing me in the right direction.

    #31924

    braddalton
    Participant
    Post count: 9210

    You could filter it out on the homepage using a conditional tag in a custom function.

    Just remember to copy that file locally so you can upload it when the plugin updates. Not really best practice.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #85870

    optimus203
    Participant
    Post count: 22

    So is there a custom function solution for this problem? I have the same issue and would like to try to avoid modifying the plugin code.

    #86922

    braddalton
    Participant
    Post count: 9210

    Try this:
    [php]
    //* Force full width content layout
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #86982

    optimus203
    Participant
    Post count: 22

    Thanks Brad. That was the filter I found on another site. Works like a charm. Thanks for the time and info.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.