1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wordpress Simple IF/ELSE

Discussion in 'PHP & Perl' started by SpectroMX5, Mar 30, 2011.

  1. SpectroMX5

    SpectroMX5 Junior Member

    Joined:
    Feb 8, 2008
    Messages:
    150
    Likes Received:
    205
    Occupation:
    Web Developer, Internet Consultant
    Location:
    San Diego
    [SOLVED]

    It's not outputting anything at all. My divs are empty inside like Dr. Evil.

    Code:
    <div id=logo">
    <?php if ( is_page_template('template-java.php') ):?>
    	<img src="<?php get_template_directory_uri(); ?>/images/java-logo.jpg" alt="Doghouse Java Hut" />
    
    <?php elseif ( is_page_template('template-doghouse.php') || is_page_template('template-catering.php') ):?>
    	<img src="<?php get_template_directory_uri(); ?>/images/doghouse-logo.jpg" alt="Doghouse Diner" />
    
    <?php endif; ?>
    </div>
    I know this isn't the services offered section but if you get me on skype I'd like to hire someone for some PHP work. Skype handle: spectromx5
     
    Last edited: Mar 30, 2011
  2. coderjeff

    coderjeff Junior Member

    Joined:
    Nov 20, 2007
    Messages:
    130
    Likes Received:
    26
    Location:
    USA
    The syntax looks correct. Are you sure that one of the cases you are testing for is true? You might try putting a final catchall else at the bottom before your last 2 lines and see if it shows up.

    Code:
    ...
    <?php else: ?>
      put something here to see if neither if statement is true
    <?php endif; ?>
    </div>