Include Sidebar Generator plug-in into my WP theme

I’m trying to include this plug-in:

http://wordpress.org/extend/plugins/sidebar-generator/

Read More

Into my wordpress theme. As many people around the internet said, I just included the sidebar_generator.php file into my functions.php. The ‘Sidebars’ menu appears under appearance, but no matter what I do, If I click on it nothing happens (just like it was linked on a ‘#’).

If I install the plug-in through the wordpress interface everything works, I need to have it integrated though.

Any help?

Thank you

Related posts

Leave a Reply

2 comments

  1. You shouldn’t need a plugin to have extra sidebars. You should be able to build a theme template with as many sidebars as you want. When I’m creating a custom theme in WordPress I use a variation of the 960 CSS Grid (another good one is the newer 1140px CSS Grid System, which is fluid).

    To register your sidebars to accept widgets, insert this code in your functions.php file:

    // Widget Areas //
    if ( function_exists('register_sidebars') ) {
        // Primary sidebar widget
        register_sidebar( array(
            'name' => __( 'Blog Sidebar', 'unique' ),
        'id' => 'blog-sidebar',
        'description' => __( 'The sidebar widget area for the blog.', 'unique' ),
        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widget-title">',
        'after_title' => '</h2>',
    ) );
    
    register_sidebar( array(
        'name' => __( 'Left Sidebar', 'unique' ),
        'id' => 'left-sidebar',
        'description' => __( 'The left sidebar widget area for pages.', 'unique' ),
        'before_widget' => '<li id="%1$s" class="greenGradient widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widget-title greenbar center">',
        'after_title' => '</h2>',
    ) );
    
    register_sidebar( array(
        'name' => __( 'Right Sidebar', 'unique' ),
        'id' => 'right-sidebar',
        'description' => __( 'The right sidebar widget area for pages.', 'unique' ),
        'before_widget' => '<li id="%1$s" class="redGradient widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widget-title redbar center">',
        'after_title' => '</h2>',
    ) );
    

    }
    In this case, I have a registered sidebar for just the blog, then one each for a right sidebar and a left sidebar.

    In my theme directory I have three sidebar.php files. The blog sidebar file is the default sidebar.php file. The other two are named sidebar-left.php and sidebar-right.php. Each sidebar has it’s appropriate code as follows:

       <?php // blog widget area
            if ( is_active_sidebar( 'blog-sidebar' ) ) : ?>
            <ul>
                <?php dynamic_sidebar( 'blog-sidebar' ); ?>
            </ul>
        <?php endif; // end blog widget area ?>
    

    Wrap this code inside your divs in the sidebar and be sure you change the ‘blog-sidebar’ name to the one for each sidebar.

  2. Looking for function admin_menu and edit in that line. Just replace __FILE__ by sidebar-generator.

    Interpretation: If you use sidebar generator as a plugin, __FILE__ means sidebar-generator, but if you include it in some directory of your themes, the constant __FILE__ may change to something different (such as inc, includes… or something else)