WordPress.org

Ready to get started?Download WordPress

Forums

Simple Page Specific Sidebars
[resolved] This might help someone (3 posts)

  1. tegansnyder
    Member
    Posted 1 year ago #

    In order to get this to work with my theme I had to modify my themes sidebar.php file to look like this:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php
    $is_custom = get_post_meta($post->ID, 'is_custom', true );
    
    if( $is_custom == 'y'){
    
    	dynamic_sidebar('page-sidebar-' . $post->ID);
    
    } else {
    
    	dynamic_sidebar('sidebar-primary');
    
    }
    ?>

    I'm using the Roots theme: http://www.rootstheme.com/

    http://wordpress.org/extend/plugins/page-specific-sidebars/

  2. ivycat
    Member
    Plugin Author

    Posted 1 year ago #

    Seriously cool comment, Tegan. Thanks!

    We use Roots quite a bit and will work on making this plugin work automatically without having to do anything special.

    Cheers!

  3. Daniel Gilfoy
    Member
    Plugin Contributor

    Posted 1 year ago #

    Hell tegan,

    Every theme (and even themes with different versions) names their default sidebar something different. Since this plugin overwrites the old sidebar with the new, depending upon the page, it needs the sidebar slug to work.

    I actually developed this plugin on a dev site using the roots theme. It was an older version, pre-bootstrap even, and so the default was using that slug. To be compatible with other themes (I couldn't find a way to programatically detect the primary slug) I added a settings page where you can enter in your primary slug.

    For instance, I noticed on a newer (not sure if newest) version of roots, the primary sidebar is called roots-sidebar. I added this and it worked.

    You can still add this to the theme's sidebar file still, that of course does work too.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.