Support » Themes and Templates » Add another sidebar to twentyten theme?

  • Is it possible to do that? and what is the code for it?

    I’ve seen tutorials on how to add another sidebar into themes, but I don’t know if it’s possible with the twentyten theme.

    Please help =)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes it is possible. Just add this code to your functions.php file and it will add the sidebar to your theme:

    function add_my_sidebars(){
    	register_sidebar( array(
    		'name' => 'My sidebar',
    		'id' => 'my-sidebar',
    		'description' => 'Just a little description',
    		'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    } add_action('widgets_init', 'add_my_sidebars');

    Then add this simple code to your theme template (eg. sidebar.php) :

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

    ID values should match.



    Forum Moderator

    @susanne4711 of the german wordpress forum mentioned an article (and tutorial) about a three column TwentyTen theme:

    Not hard to do, but the CSS styling is critical.

    If you want to see it working, and perhaps check out the code, you could look at my Twenty Ten child theme, Twenty Ten Weaver. The code that does it is right at the top of functions.php, and the styling is in the style.css.

    Second sidebar solution not working.
    I tried what you suggested adding “function add…” to functions.php and changed the My sidebar to sidebar2. I have a sidebar2 template as well but I’m not sure I need it if I can add widgets w/o establishing a new template.

    I’m not sure I added in the right place since I don’t know php. I added after the second widget areas like so:

    [code moderated as per forum rules – please use the pastebin.
    if you post amall amounts of code here directly, please mark the code using backticks or the code button.]

    Then I put this in both my sidebar.php and sidebar2.php because, as I said, I don’t know if I need a second template. Again, perhaps I put it in the wrong place.
    <?php dynamic_sidebar('sidebar2'); ?>

    sidebar2 is NOT showing up in the widgets page.

    Thanks for your help.



    Forum Moderator

    Don’t edit the Twenty Ten theme! Your changes will be over-written the next time you upgrade WordPress or the theme. For this reason, it is recommended that you consider creating a child theme for your customisations.

    Yes, I know you’re right. This particular blog is just a learning process but I WILL take the steps to create a child theme.

    Be that as it may, I don’t know why I can’t see sidebar2 in the widgets screen. I tried several different methods.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add another sidebar to twentyten theme?’ is closed to new replies.