ThemeShaper Forums » Thematic

[closed]

conditional functions for different pages

(3 posts)
  • Started 8 years ago by lastraw
  • Latest reply from lastraw
  • This topic is resolved
  1. Since I usually do this with css, I never really got how the conditional function would work for different pages. In this case (scalable) I need this background on the page "reliquary" and another on the rest of the pages.

    /* scaling background */
    function my_background() { ?>
    <?php echo '<img class="bg" src="' . get_bloginfo('stylesheet_directory') .'/images/bkg-home.jpg" alt="photo"  />';
    ?>
    
    <?php
    
    }
    add_action('thematic_before', 'my_background');
    
    ?>

    Thanks!
    Leslie

    Posted 8 years ago #
  2. enter conditional logic
    http://codex.wordpress.org/Conditional_Tags

    /* scaling background */
    function my_background() { 
    
    if(is_page('reliquary')){
      echo '<img class="bg" src="' . get_bloginfo('stylesheet_directory') .'/images/bkg-home.jpg" alt="photo"  />';
    } else {
      echo '<img class="bg" src="' . get_bloginfo('stylesheet_directory') .'/images/bacon.jpg" alt="bacon"  />';
    }
    
    }
    add_action('thematic_before', 'my_background');
    Posted 8 years ago #
  3. Thank you again helgatheviking!

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.