Title: is_single
Last modified: August 18, 2016

---

# is_single

 *  [davedorm](https://wordpress.org/support/users/davedorm/)
 * (@davedorm)
 * [20 years ago](https://wordpress.org/support/topic/is_single/)
 * I am trying to show two different sidebars, one on the home page, one on pages
   and single posts. Here’s what I have so far on index.php
 * `<?php if (is_single(true))
    include ('sidebar2.php'); else include ('sidebar.
   php'); ?>
 * What am I doing wrong?

Viewing 1 replies (of 1 total)

 *  [geoffe](https://wordpress.org/support/users/geoffe/)
 * (@geoffe)
 * [20 years ago](https://wordpress.org/support/topic/is_single/#post-400380)
 * you don’t want true in there as a passed variable and I presume you have considered
   making a separate single.php and/or page.php template in your theme folder to
   deal with different formatting/layout.
 * What I’ve done is to use the [conditional tags](http://codex.wordpress.org/Conditional_Tags)
   in sidebar.php, so that when sidebar.php is called, it will test if it’s a story
   page or an author page. And as you can see on that page I linked, you can send
   the ID # or title or slug of a post with is_single but `true` would fool the 
   function.

Viewing 1 replies (of 1 total)

The topic ‘is_single’ is closed to new replies.

## Tags

 * [is_single](https://wordpress.org/support/topic-tag/is_single/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [geoffe](https://wordpress.org/support/users/geoffe/)
 * Last activity: [20 years ago](https://wordpress.org/support/topic/is_single/#post-400380)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
