Wordpress Simple IF/ELSE
What am I doing wrong?
is_page_template is a built in Wordpress function.
<?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; ?>
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:
<img src="<?php echo get_template_directory_uri(); ?>...
Its not outputting anything at all actually. Not even img tags. My divs are empty inside like Dr Evil. :sadface:
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)