echo HTML content only working with absolute URL's
-
Hi,
I hope someone can point me in the right direction as i’ve been stuck on this for the last few days and it’s driving me crazy, probably an easy fix for a coder.
Basically i have the piece of code below that should only display the HTML content if it’s on the Home Page, else show nothing.
<?php if ( is_home()) { echo '<div id="mainNav"> <div id="mainleft"><a href="#" rel="toggle[latestPosts]" data-openimage="https://worldcupcountdown.net/social/wp-content/themes/iMobi/images/postsCollapse.png" data-closedimage="https://worldcupcountdown.net/social/wp-content/themes/iMobi/images/postsExpand.png"><img src="https://worldcupcountdown.net/social/wp-content/themes/iMobi/images/postsCollapse.png" border="0" /></a></div> </div>'; } else { echo ''; } ?>
Everything works fine if i use absolute URLS for my image location (which is what i reverted to so that i can continue working) but if i try to use
<?php bloginfo('template_directory'); ?>/images/postsCollapse.png
as the source of the images it doesnt load any images.I’ve tried using single quotes and even \ before double quotes but to no avail.
Any help is greatly appreciated.
Cheers
- The topic ‘echo HTML content only working with absolute URL's’ is closed to new replies.