Ready to get started?Download WordPress


Want to add a right sidebar to my site (5 posts)

  1. pbusardo
    Posted 2 years ago #

    Hello! I'm running a slightly modified version of the ReviewIt theme at tasteyourjuice.com.

    I would like to add a right handed sidebar to the theme and be able to access it via the control panel in order to drop widgets into it, etc.

    I'm a bit of a rookie when it comes to WordPress and don't want to mess up what had already taken so long to accomplish.

    Detailed help would be very much appreciated!!

  2. deepbevel
    Posted 2 years ago #

    add this to functions.php:

    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 to your templates where you want the sidebar:

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

    minimally, css would be:

     position: relative;
     margin: 0;
     padding: 0;
     border: 0;
     float: right;
     overflow: hidden;
     width: 200px;

    but you'll probably have to fuss with this a bit to get it good with your theme.

  3. pbusardo
    Posted 2 years ago #

    Thanks! There is actually a theme-sidebars.php file the theme appears to be using to create the sidebars. This is well beyond my understanding. Is this something you can have a look at to see where it should go?

  4. deepbevel
    Posted 2 years ago #

    I probably wouldn't be concerned with that, it probably loads default widgets in your default sidebar. Just proceed as I instructed. The only real risk is editing functions.php, make sure you don't create any blank space beween the <?php ?> tags, although there would be no reason you would, unless you change the code. So be careful there.

    Also make sure you put the code after the initial <?php at the top.
    If you put the code at the end, make sure it's before the closing
    ?> at the very end of functions.php.

    Make sure you have access to your server/wp install folder in case you have to correct it. If you cause an error in functions.php it may completely crash your site and you won't be able to log in. So you'll need to access functions.php directly on your server to correct the edit and get your site back.

    to be safe, copy the entire functions.php into a text file before you edit. Then just replace if anything goes wrong. Godd luck!

  5. pbusardo
    Posted 2 years ago #

    Ok! I will play.

    Thanks very much for the info and your time!!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.