Title: conditional tags?
Last modified: August 19, 2016

---

# conditional tags?

 *  [woopi](https://wordpress.org/support/users/woopi/)
 * (@woopi)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/conditional-tags-help-fast/)
 * hi,
 * I am trying to use the conditional tags. Basically I want to say that if it is
   the page About choose this image with a $bannerimg. So, where do I insert that
   $bannerimg in my code?
 *  <?php if ( is_page(‘about’)) {
    $bannerimg = about.jpg’; } else { $bannerimg
   = ‘home.jpg’;} ?>
 *  ???????? <img src=”$bannerimg” align=”right” /> ???????

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/conditional-tags-help-fast/#post-1755658)
 * use a php echo function to output the $bannerimg:
 * [http://php.net/manual/en/function.echo.php](http://php.net/manual/en/function.echo.php)
 *  Thread Starter [woopi](https://wordpress.org/support/users/woopi/)
 * (@woopi)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/conditional-tags-help-fast/#post-1755729)
 * ok, but Im a real newby and how do I do that so the $bannerimg will be the src
   of the image?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/conditional-tags-help-fast/#post-1755752)
 * where is the image folder?
 * the full code depennds on the image location;
    to start, try:
 *     ```
       <?php if ( is_page('about')) {
       $bannerimg = 'about.jpg';
       } else {
       $bannerimg = 'home.jpg';}
       ?>
   
       <img src="<?php echo $bannerimg; ?>" align="right" />
       ```
   
 * as this is likely not to work, try for the last line:
 * `<img src="http://full_path_to_image_folder/<?php echo $bannerimg; ?>" align="
   right" />`
 *  Thread Starter [woopi](https://wordpress.org/support/users/woopi/)
 * (@woopi)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/conditional-tags-help-fast/#post-1755835)
 * >  <?php if ( is_page(‘about’)) {
   >  $bannerimg = ‘about.jpg’; } else { $bannerimg
   > = ‘home.jpg’;} ?>
   > <img src=”<?php echo $bannerimg; ?>” align=”right” />
 * that code worked perfectly!!!! thanks!

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

The topic ‘conditional tags?’ is closed to new replies.

## Tags

 * [about](https://wordpress.org/support/topic-tag/about/)
 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [home](https://wordpress.org/support/topic-tag/home/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [woopi](https://wordpress.org/support/users/woopi/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/conditional-tags-help-fast/#post-1755835)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
