Title: Code for Custom Sidebars
Last modified: August 20, 2016

---

# Code for Custom Sidebars

 *  [HopefulGJL](https://wordpress.org/support/users/hopefulgjl/)
 * (@hopefulgjl)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/code-for-custom-sidebars/)
 * Hello,
 * I am looking to customize by sidebars, and am wondering if there is a fairly 
   easy way to do so with code. I don’t know all that much about code, but I have
   customized other codes on my site with good results.
 * I am aware there is a custom sidebars plugin, but I’m trying to not depend upon
   plugins too much. And, I’m not sure if it has a way for me to do what I am looking
   to do or not either.
 * There are certain pieces of my sidebar that I am looking to have displayed on
   all of the pages of my site. This happens automatically by default. However, 
   I am also looking for other pieces of my sidebar to appear only on specific pages.
   Basically, I’m looking to have things that appear on every page and things that
   appear only on certain pages there simultaneously.
 * Does anyone know how this can be accomplished? Is there a code I can add to my
   sidebar CSS? Or, is there more to it than that? Thanks in advance for your help!

Viewing 4 replies - 16 through 19 (of 19 total)

[←](https://wordpress.org/support/topic/code-for-custom-sidebars/?output_format=md)
[1](https://wordpress.org/support/topic/code-for-custom-sidebars/?output_format=md)
2

 *  Thread Starter [HopefulGJL](https://wordpress.org/support/users/hopefulgjl/)
 * (@hopefulgjl)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/code-for-custom-sidebars/page/2/#post-2817916)
 * I have discovered something else to add to this information. If you want to call
   the same sidebar for more than 1 page, then you can use this:
 *     ```
       <?php if (is_page('1'||'2'||'3'||'4'||'5'||'6'||'7')) : ?>
         	<?php get_sidebar('sidebar1'); ?>
         <?php else : ?>
          	<?php get_sidebar(); ?>
         <?php endif; ?>
       ```
   
 * With this, page id#’s 1,2,3, etc. are all calling and using sidebar1.
 * If you want to specify posts instead of pages, then please read my post [here](http://wordpress.org/support/topic/can-this-page-code-for-sidebars-be-altered-for-posts-and-category-ids?replies=4).
 *  Thread Starter [HopefulGJL](https://wordpress.org/support/users/hopefulgjl/)
 * (@hopefulgjl)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/code-for-custom-sidebars/page/2/#post-2817921)
 * Well, I later learned that for whatever reason, using the above code from my 
   last post somehow affected all of my sidebars on all of my pages, so I went back
   to listing them individually.
 * Oh, and I learned more about how to do custom sidebars for my category/archive‘
   pages’ [here](http://wordpress.org/support/topic/custom-sidebar-for-each-page-of-an-archive-or-category?replies=14).
 *  [Frumph](https://wordpress.org/support/users/frumph/)
 * (@frumph)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/code-for-custom-sidebars/page/2/#post-2817922)
 * It’s probably the || ‘s, those shouldn’t be there
 * if is_page(‘1,2,3,4,5’) is how that is done
 *  Thread Starter [HopefulGJL](https://wordpress.org/support/users/hopefulgjl/)
 * (@hopefulgjl)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/code-for-custom-sidebars/page/2/#post-2817932)
 * Thanks for the info…I’ll give that a try.

Viewing 4 replies - 16 through 19 (of 19 total)

[←](https://wordpress.org/support/topic/code-for-custom-sidebars/?output_format=md)
[1](https://wordpress.org/support/topic/code-for-custom-sidebars/?output_format=md)
2

The topic ‘Code for Custom Sidebars’ is closed to new replies.

 * 19 replies
 * 4 participants
 * Last reply from: [HopefulGJL](https://wordpress.org/support/users/hopefulgjl/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/code-for-custom-sidebars/page/2/#post-2817932)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
