• Hi,

    I’m new to WP and have a question related to the Main Sidebar. I’m using Twelve Eleven template which has only one Main Sidebar and I need two.

    I’ve modified the function.php file and added the following code which has created new sidebar called Main Sidebar10. I’ve also created a file called sidebar10-page.php and added its reference into the function.php.

    My problem is that when I go into a page I can’t see the Main Sidebar10 as option in the Template.

    Any suggestion?
    Thanks for your help
    Marco

    register_sidebar( array(
    ‘name’ => __( ‘Main Sidebar10’, ‘twentyeleven’ ),
    ‘id’ => ‘sidebar-10’,
    ‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => “</aside>”,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’,

Viewing 3 replies - 1 through 3 (of 3 total)
  • btw: do not edit Twenty Eleven directly, but create a child theme first, to work with; http://codex.wordpress.org/Child_Themes

    http://codex.wordpress.org/Widgetizing_Themes

    the posted code would only bring the new widget area into dashboard – appearance – widgets.

    you still need to programm a space to output the widgets into a template or a new sidebar file;

    http://codex.wordpress.org/Function_Reference/dynamic_sidebar

    created a file called sidebar10-page.php

    what is the code of that file?
    (for posting code – see http://codex.wordpress.org/Forum_Welcome#Posting_Code )

    Thread Starter marco80

    (@marco80)

    Hi and thanks for your quick reply.

    THis is the code I put in sidebar10-page.php

    <?php
    /**
    * Template Name: Sidebar Template
    * Description: A Page Template that adds a sidebar to pages
    *
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0
    */

    get_header(); ?>

    <div id=”primary”>
    <div id=”content” role=”main”>

    <?php while ( have_posts() ) : the_post(); ?>

    <?php get_template_part( ‘content’, ‘page’ ); ?>

    <?php comments_template( ”, true ); ?>

    <?php endwhile; // end of the loop. ?>

    </div><!– #content –>
    </div><!– #primary –>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    please read http://codex.wordpress.org/Forum_Welcome#Posting_Code for posting code, and apply those guidelines.

    this line

    <?php get_sidebar(); ?>

    will call the default sidebar.php;

    to call your new widget area, you need to create a different sidebar file, for example sidebar-ten.php and call it with

    <?php get_sidebar('ten'); ?>

    in this sidebar file, you need to use for instance

    <?php dynamic_sidebar('sidebar-10'); ?>

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

The topic ‘Add new Sidebar’ is closed to new replies.