Skip to content
UFO Performance Marketing

Where intelligence is put to the test.

HomeServicesCase StudiesBlogAboutContact Us
Menu
HomeServicesCase StudiesBlogAboutContact Us
WordPress · Oct 16, 2014

Multiple WordPress Sidebars with get_sidebar()

Multiple WordPress Sidebars with get_sidebar()
JC
John Crenshaw
Oct 16, 2014

In this article I show you how to use the get_sidebar() function to call multiple sidebars (as many as you want) in your WordPress theme.

WordPress Multiple Sidebars
Example of using multiple sidebars in WordPress

If you've been theming WordPress for a bit you may have come across the need for multiple sidebars, but you may have also realized that the default method of including a sidebar, using the get_sidebar() function, only allows you to include a single sidebar named sidebar.php (without using parameters). There's one obvious way to include a sidebar and that's by using a standard php include like so:

1
include('TEMPLATEPATH . '/right-sidebar.php';

This method works, but in the interest of keeping our code readable and simplifying the inclusion of multiple sidebars, there's an easier way to do this and it's incredibly simple.

Including sidebar-left.php and sidebar-right.php using get_sidebar

Let's say we've got two sidebars, right and left, and we'll name the files sidebar-right.php and sidebar-left.php respectively. To include those files, all we have to do is use the get_sidebar function but add parameters to each function call to tell WordPress which sidebar we want included where.

To include the file "sidebar-right.php" we'll use:

1
get_sidebar('right');

And to include our other sidebar, "sidebar-left.php" we'll use:

1
get_sidebar('left');

Likewise, if we want to include a third sidebar, sidebar-right-2.php for example, we'll use:

1
get_sidebar('right-2');

Syntax of get_sidebar()

It's that simple. The key to remember here is that, as commentator Rakeshkumar Mehta points out, the get_sidebar function prepends "sidebar- to the argument you feed it, so all your sidebar files should start with "sidebar-". For example, to include a file named sidebar-newsidebar.php, use get_sidebar('newsidebar'), or to include a file named sidebar-my_right_sidebar.php, use get_sidebar('my_right_sidebar').

WordPress

Get the latest from UFO

Keep reading

More from the blog

All Posts →
ExpressionEngine vs. WordPress - Final Thoughts
WordPress

ExpressionEngine vs. WordPress - Final Thoughts

What I like about ExpressionEngine when compared to WordPress and my final thoughts on the commercial CMS from EllisLab.

John Crenshaw · Oct 13, 2018
Wordpress $post Object Quick Reference
WordPress

Wordpress $post Object Quick Reference

This quick reference / cheatsheet is for the WordPress $post object. This object contains a bunch of info specific to each WordPress post. Scroll down for the complete table of object properties.

John Crenshaw · May 15, 2015
Remove "Briefly Unavailable for Scheduled Maintenance" Message
WordPress

Remove "Briefly Unavailable for Scheduled Maintenance" Message

If you've been keeping on top of your WordPress updates using the automatic upgrade feature, you may have run into a problem immediately after upgrading.

John Crenshaw · Dec 10, 2014

Want results like these?

Let's talk about where you are, where you want to go, and the smartest way to get there.

Contact Us
UFO

Where intelligence is put to the test.

  • Home
  • Services
  • Case Studies
  • About
  • Partners
  • Testimonials
  • Projects
  • Blog
  • Careers
  • Contact Us

Offices

  • Cincinnati, OH
  • Columbus, OH
  • Portland, OR
  • (513) 549-7355
Contact Us
Google 5.0 five star rating Google Ads Premier Partner 2026
© Copyright 2026 UFO Marketing. All rights reserved. Privacy Policy | Terms of Use