Title: different sidebars on page.php
Last modified: August 19, 2016

---

# different sidebars on page.php

 *  [rcgaff](https://wordpress.org/support/users/rcgaff/)
 * (@rcgaff)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/different-sidebars-on-pagephp/)
 * I modified page.php so that to display a different sidebar on a page titled “
   The Runner”.
 * This works fine, but then I want to display the default sidebar for all other
   pages. I can’t the code below to work:
 *  <?php if(the_title() == “The Runner”) get_sidebar(‘therunner’); ?>
    <?php if(
   the_title() != “The Runner”) get_sidebar(); ?>
 * In fact it doesn’t seem that any php functions work on page.php – I am beginning
   to doubt my sanity.
 * For example I set $str1 = the_title() and do strlen($str1) it returns zero. I
   do strlen(“The Runner”) and it returns zero.
 * There must be something basic about the WordPress environment I don’t understand.
 * Thanks

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/different-sidebars-on-pagephp/#post-1415858)
 * Try:
 *     ```
       <?php if( is_page('The Runner') ) get_sidebar('therunner');
       else get_sidebar();?>
       ```
   
 * [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 *  Thread Starter [rcgaff](https://wordpress.org/support/users/rcgaff/)
 * (@rcgaff)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/different-sidebars-on-pagephp/#post-1415962)
 * I also discovered that if I save a new page template (with the “Template Name:”
   header) that a dropdown magically shows up to allow me to select one or the other
   page template.
 * I was making it harder than it was.
 * Thanks esmi!

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

The topic ‘different sidebars on page.php’ is closed to new replies.

## Tags

 * [page.php](https://wordpress.org/support/topic-tag/page-php/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [rcgaff](https://wordpress.org/support/users/rcgaff/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/different-sidebars-on-pagephp/#post-1415962)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
