Home>Support>Adding second sidebar

Adding second sidebar

I just want to add a second sidebar so thought I could do:

register_sidebar( array(
		'name' => __( 'Sidebar', 'vantage' ),
		'id' => 'sidebar-1',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget' => '</aside>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

in functions.php but I don’t see anything added on the widgets page. Is there something else that needs to be edited to get it to show up?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 6 months ago John Faulds

    Sorry, I just pasted the original sidebar code, not the one I added, but you get the picture.

    Also, unrelated question but how do I show h2s for blog titles on the blog index page but h1s on the single pages?

  2. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hi John

    Are you looking to control which widgets appear on each page / post or given scenario? If so, you could use:

    http://jetpack.me/support/widget-visibility/

    or

    http://www.woothemes.com/woosidebars/

    To change the heading tags in the way you’re after, make a copy of content.php and insert the copy in your child theme. Change h1 to h2 in that file. Then add the following to either the style.css file in your child theme or Appearance > Custom CSS within your WordPress admin.

    /* Post Title */
    
    article.post .entry-header h2.entry-title a, article.page .entry-header h2.entry-title a {
      color: inherit;
      text-decoration: none;
    }
    
    article.post .entry-header h2.entry-title, article.page .entry-header h2.entry-title {
      color: #3b3b3b;
      font-size: 20px;
      font-weight: 500;
      line-height: 1.35em;
    }
    
  3. 9 years, 6 months ago John Faulds

    So you need an additional plugin for managing sidebars? Why doesn’t updating functions.php work though?

  4. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    You’d need to use a child theme to make that upgrade safe. Assuming you are, you’d need to create a new sidebar in the functions.php of the child theme, you’d then need to add a copy of all the theme files that currently call the sidebar and add your additional call for your new sidebar. Creating the new sidebar is only one out of two steps.

  5. 9 years, 6 months ago John Faulds

    What other theme files need updating to get the sidebar to show in the admin widgets page? I’ve already created sidebar-blog.php which is called from index.php and single.php with get_sidebar(‘blog’) and which points to the new sidebar, but I can’t even see it on the widgets page for me to be able to add stuff to it.

  6. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Seeing your new widget area under Appearance > Widgets is the first step you’d need to resolve. If you paste the complete contents of your child theme functions.php file, wrapped in code tags, I can take a look. The code tags you need to use are indicated below the texfield, before the Post Comment button.

  7. 9 years, 6 months ago John Faulds

    I’m not using a child theme at the moment. Setting aside discussions over whether that’s advisable or not, it’s not mandatory to use a child theme to get an extra sidebar to show, correct?

    So all I’ve done is copy this:

    register_sidebar( array(
    		'name' => __( 'Sidebar', 'vantage' ),
    		'id' => 'sidebar-1',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    and paste it below and edited it like so:

    register_sidebar( array(
    		'name' => __( 'Blog sidebar', 'vantage' ),
    		'id' => 'sidebar-2',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
  8. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hi again. We don’t officially support theme customisations. We do our best to help out with small ones. When it comes to something on this level we’ll do what we can to steer you on higher level questions.

    If you need this additional widget area to manage widgets for different pages then the plugins I mentioned are the best way to go. WooSidebars does what you’re trying to do, just in the form of a plugin.

    All WordPress themes completely overwrite themselves when updating so it’s important to be developing inside of a child theme. If you don’t, and we push an update to Vantage which you run from Dashboard > Updates, all your changes will be lost.

    Here is some background on child theming: https://codex.wordpress.org/Child_Themes

    Here is a vanilla child theme you can start with:
    https://siteorigin.com/wp-content/uploads/2015/01/vantage-child-vanilla-enqueue.zip

    Finally, here is an example child theme you can use as a reference:
    https://siteorigin.com/wp-content/uploads/2014/09/vantage-child-menu-widget-area1.zip

    Check the functions.php file of this child theme, there I register a new widget area. Next, check /parts/menu.php, there I call the new widget area. Hopefully that helps get you going.

    Registering a widget area in a child theme requires a little more than it would in the parent theme, but it’s essential it be done in a child theme. So for this reason it’s better to check my example vs me trying to see what’s going wrong with your method right now. Hope that makes sense.

    We’re at GMT+2 so we’ll be back on “tomorrow morning”. Hope the above helps you get started :)

  9. 9 years, 6 months ago John Faulds

    Great, thanks very much. :)

  10. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    For sure :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More