• For a specific lay-out I needed to remove the default Sidebar and add a specific one, one not defined in Simple Sidebars but in functions.php. Before the 2.0.x versions and Genesis 2.0.x all I had to do is unhook via the following code

    remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    add_action( 'genesis_sidebar', 'befrank_nieuwsbericht_sidebar' );
    /**
     * Replace default sidebar with news specific
     */
    function befrank_nieuwsbericht_sidebar() {
    	dynamic_sidebar( 'nieuwsbericht-sidebar' );
    }

    but this doesn’t seem to work anymore. Any clue on why this happens? It just outputs the default genesis_do_sidebar.

    http://ww.wp.xz.cn/plugins/genesis-simple-sidebars/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Ron Rennick

    (@wpmuguru)

    You are probably doing it too early. ss__do_sidebar is hooked in the get_header hook:

    add_action( 'get_header', 'ss_sidebars_init' );

    Thread Starter Remkus de Vries

    (@defries)

    Odd, this worked in the older versions just fine. Wrapped the remove inside a function and hooked in later. Works fine now. Thank Ron!

    Hi Ron,
    Interesting info, thanks. I ran into the same type of problem, but altering the timing didn’t fix it. I tracked it down…. silly Woo Commerce… as soon as I disabled Genesis Connect for Woo Commerce, it started working again. I looked through its code, and found the smoking gun! So this is the command if you have Genesis Connect for Woo:

    remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );

    All these plugns pining for attention! 🙂 Maybe this will help someone else. I may pop all this on my blog. 🙂

    Cheers,
    Dave

    Thanks. Same problem… I usually hook layout changes to genesis_meta and couldn’t figure out why it wasn’t working after GSS was activated.

    I’ll hook in late to get_header or to genesis_before_content_sidebar_wrap

    I’d like to hook into this thread. Just to help others who might have the same problem.

    Didn’t get it to work, but eventually I did.

    The solution was to first remove the ss_sidebar and then the genesis_do_sidebar.

    This code will remove the Primary sidebar:

    remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );

    This code will not remove the Primary sidebar.

    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    remove_action( 'genesis_sidebar', 'ss_do_sidebar' );

    Marcel,
    That’s interesting… change the order to make it stick! 🙂

    I did end up writing a short article to handle removal of sidebars when using Woo Commerce or Genesis Simple Sidebars.
    http://davidchu.net/blog/removing-genesis-sidebars/

    I know there are other sidebar plugins akin to Genesis Simple Sidebars, but for any theme, not just Genesis ones, and I would guess that they also have their own “interfering” hooks.

    Dave

    In response to flamenco’s post. I was able to get it working with this code. I had to change the priority and location of the action hook.

    add_action('get_header','os_change_genesis_sidebar', 11);  //11 used as priority to match woo connect genesis integration
    function os_change_genesis_sidebar() {
    	remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );	//special remove hook for when genesis simple sidebars & Genesis Woo Connect plugin is active
        }

    You’ll see the woo connect genesis plugin file for genesis-simple-sidebars.php in the sp-plugins-integration folder. First few lines deals with the integration/

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Removing Sidebars doesn't work in code’ is closed to new replies.