Title: sidebar conditionals
Last modified: August 19, 2016

---

# sidebar conditionals

 *  [crisjb](https://wordpress.org/support/users/crisjb/)
 * (@crisjb)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/sidebar-conditionals/)
 * Hi everybody,
    I’m working on the sidebar.php file and can’t for the life of 
   me guess what I’m doing wrong. I’m not a php pro but I can defend myself. I want
   a portion to display only on the home page and a page template. On everything
   else is should be hidden, but I don’t get this result. Can’t tell you why. Any
   help to clarify this would be much appreciated. Code below:
 *     ```
       <div id="rightColB">
       					<a href="<?php bloginfo('rss2_url'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/side-subscribe.png" class="" alt="subscrive via RSS"/></a><br />
       					<?php get_search_form(); ?>
       					<img src="<?php bloginfo('template_url'); ?>/images/side-latest.png" class="sidetitle" alt="latest posts"/>
       						<?php query_posts('showposts=10'); ?>
       							<ul>
       							  <?php while (have_posts()) : the_post(); ?>
       							  <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
       							  <?php endwhile;?>
       							</ul>
   
       					<img src="<?php bloginfo('template_url'); ?>/images/side-sites.png" class="sidetitle" alt="sites we like"/>
       							<ul>
       							<?php wp_list_bookmarks('title_li=&amp;categorize=0'); ?>
       							</ul>
       							<?php bloginfo('url'); ?>				
   
       				<?php if( is_home() || is_page() ) { ?>
   
       					<img src="<?php bloginfo('template_url'); ?>/images/side-flickr.png" class="sidetitle" alt="flickr photo stream"/>
       					<div id="flickr">
       					<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=6&amp;display=random&amp;size=s&amp;layout=y&amp;source=user&amp;user=36685787%40N04"></script>
       					</div>	
   
       				<?php } ?>
   
       </div><!-- close RIGHTCOL-->
       ```
   

Viewing 1 replies (of 1 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/sidebar-conditionals/#post-1051111)
 * hi
 * for one thing, to display code on the top page, use is_front_page() not is_home()

Viewing 1 replies (of 1 total)

The topic ‘sidebar conditionals’ is closed to new replies.

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/sidebar-conditionals/#post-1051111)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
