WordPress.org

Forums

WP Framework
Multiple Sidebars in WP Framework? (3 posts)

  1. 9fay
    Member
    Posted 4 years ago #

    I just upgraded to the newest version of WP Framework and I am having difficulty setting up multiple sidebars (which i was able to set up in the previous version).

    I have edited the custom-functions.php file to include the code:

    register_sidebar( array(
    'name' => __( 'Sidebar 1', t() ),
    'id' => 'sidebar-1',
    'description' => __( 'Asides widget area.', t() ),
    'before_widget' => '<section id="%1$s" class="widget %2$s">',
    'after_widget' => '</section>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>',
    ) );

    I then created a new “sidebar-1.php” file in which I copied all the code from “sidebar.php”. I then edited the line

    * WordPress Template: Sidebar

    changing it to

    * WordPress Template: Sidebar 1

    I then changed on of my custom templates (which is basically a copy of ‘page.php’ with an extra line of code near the top)

    <?php get_template_part( 'sidebar' ); ?>

    to

    <?php get_template_part( 'sidebar-1' ); ?>

    However, the page continues to show the “aside” sidebar that is default for the theme.
    I know in the older version for this to work I also had to edit the line in “sidebar-1.php”

    if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar() ) : ?>

    to

    if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar(1) ) : ?>

    So I am assuming that there is more I need to edit in my new “sidebar-1.php”, but with the new ‘do_action’ commands I am at a loss as to what I should be editing.
    Any help would be greatly appreciated.

    http://wordpress.org/extend/themes/wp-framework/

  2. SpankMarvin
    Member
    Posted 4 years ago #

    Could be wrong, but isn't the built-in WordPress method easier? I.e., created a new sidebar file called sidebar-whatever.php and then, in your template file, call get_sidebar('whatever');

    Or am I missing something else that you are trying to do?

    John

  3. 9fay
    Member
    Posted 4 years ago #

    Hey John,
    Thanks for replying. :)
    Aside from trying to maintain consistency in the code of the theme I am using, the get_sidebar() command is ineffective for the same reason that the get_template_part(sidebar-1) is ineffective. I'm assuming (and I could be wrong, but it is the only thing that is still differing from my previous installation of the last version of wp-framwork) that it is from lack of a if (!function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar(1) ) : ?> in the sidebar-1.php file. Because the developers are not using that traditional code I neither know where to put said function in the new sidebar-1.php file or even better yet how to create the same effect while maintaining code consistency (which is really what I'm after). If you compare the code from the last version of wp-framwork and the new version for the sidebar.php file you should see what I am talking about.
    Tracy

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic