Add another sidebar to twentyten theme? (7 posts)

  1. greatdanemaniac
    Posted 6 years ago #

    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 =)

  2. Metin Saylan
    Posted 6 years ago #

    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.

  3. Michael
    Forum Moderator
    Posted 6 years ago #

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

  4. wpweaver
    Posted 6 years ago #

    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.

  5. Ruthie1
    Posted 5 years ago #

    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.

  6. esmi
    Forum Moderator
    Posted 5 years ago #

    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.

  7. Ruthie1
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic