Title: Please help-quick code question about sidebar!
Last modified: August 18, 2016

---

# Please help-quick code question about sidebar!

 *  [table4five](https://wordpress.org/support/users/table4five/)
 * (@table4five)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/please-help-quick-code-question-about-sidebar/)
 * I use the K2 theme on my blog [Table for Five](http://table4five.net). In the
   single post page view, I need the sidebar to display differently than on the 
   main page. I found this code but it’s not quite right-I need the same sidebar,
   just without the Blogher ads.
 * \} elseif (is_single()) {
    // we’re looking at a single page, so let’s not show
   anything in the sidebar\
 * I need to change the code to have it display a second sidebar, and I need to 
   know where to put the code in the sidebar.php file! Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [richarduk](https://wordpress.org/support/users/richarduk/)
 * (@richarduk)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/please-help-quick-code-question-about-sidebar/#post-533416)
 * It’s a bit difficult without seeing the whole code as each theme is different.
 * [http://pastebin.com/](http://pastebin.com/)
    [http://pastebin.co.uk/](http://pastebin.co.uk/)
 * are two places you can paste a full page of code
 *  Thread Starter [table4five](https://wordpress.org/support/users/table4five/)
 * (@table4five)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/please-help-quick-code-question-about-sidebar/#post-533423)
 * Sorry about that! [This](http://pastebin.co.uk/11500) is my current sidebar code
   for all pages. Again, my URL is [http://table4five.net](http://table4five.net).
 * I need to start a new Page just for the category payperpost, and on those pages,
   the sidebar needs to NOT include the code for Blogher ads. Also, I just thought
   of something-since I use text widgets in my sidebar, shouldn’t there be a way
   to create a second set of widgets for a second sidebar? That way, I could just
   not use the widget that has the Blogher ad code in it.
 * If not, [this](http://pastebin.co.uk/11501) is the Variable Sidebar code from
   the [WordPress Codex page](http://codex.wordpress.org/Conditional_Tags) for Conditional
   tags. It seems like it is close to what I need, except I don’t want single pages
   to display NO sidebar, I want them to display a DIFFERENT sidebar. Please let
   me know if there is any other info you need.
 *  [richarduk](https://wordpress.org/support/users/richarduk/)
 * (@richarduk)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/please-help-quick-code-question-about-sidebar/#post-533527)
 * Wow! That sounds complicated.
 * I like the idea of adding another widget sidebar. Your first one should be within
   divs or whatever
 *     ```
       <ul>
       <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
       <p>Some default text here in case you forget to put a  widget in </p>
       <?php endif; ?>
       </ul>
       ```
   
 * Your second one should be in a different div (just for ease of placing it on 
   the page, that’s all)
 *     ```
       <ul>
       <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
   
       <li class="widgets">This is the Widgets  Number 2 holder or container or 'sidebar' - if you don't want to use it, delete it or or use 'display:none' for the surrounding div elements</li>
   
       <?php endif; ?>
       </ul>
       ```
   
 * In your functions.php place this at the top of the page and within php tags:
 *     ```
       if ( function_exists('register_sidebars') )
       	register_sidebars(2);
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Please help-quick code question about sidebar!’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [richarduk](https://wordpress.org/support/users/richarduk/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/please-help-quick-code-question-about-sidebar/#post-533527)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
