dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Wordpress Simple IF/ELSE

  1. #1
    Join Date
    Nov 2005
    Location
    San Diego
    Posts
    54

    Question Wordpress Simple IF/ELSE

    What am I doing wrong?

    is_page_template is a built in Wordpress function.

    Code:
    <?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; ?>
    [[ Impact Web Media and Print Design | TheWebRockstar.com ]]

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,443
    What is the current result? If you are getting the image tag in the HTML source but no value for the src attribute, then you probably have to echo the return value of the "get" function:
    Code:
    <img src="<?php echo get_template_directory_uri(); ?>...
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Nov 2005
    Location
    San Diego
    Posts
    54
    Its not outputting anything at all actually. Not even img tags. My divs are empty inside like Dr Evil. :sadface:
    [[ Impact Web Media and Print Design | TheWebRockstar.com ]]

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,443
    Then it would appear that neither if condition is being evaluated as true. Since I don't off-hand know what the function in your condition statements does, I really don't know what to suggest -- other than to include an else block for when neither the else nor elseif evaluates as true.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles