you know, I looked at this before and was going to suggest escaping the quotes, but you shouldnt have to ..
for grins and giggles, and just so you dont feel ignored.
try that..
echo '<img class=\"lower\" src=\"<?php bloginfo('template_direc...
This gets rid of the parsing error, but I’m now left with the urlhttp://localhost/wordpress/wp-content/themes/healing Designs echo’d on the page – not the image. This is NOT supposed to happen. grrrrrr.
<?php
if (is_front_page())
{echo '<img class="lower" src="' . bloginfo('template_directory') . '/images/splash.jpg" usemap="#bg" style="border:none;" alt="background"/>';
} elseif (is_page('Portfolio')) /*use portfolio image*/{
echo '<img class="lower" src="' . bloginfo('template_directory') . '/images/portfolio.jpg" usemap="#bg" style="border:none;" alt="background"/>';
} elseif (is_page('Ordering')) { /*use ordering image*/
echo '<img class="lower" src="' . bloginfo('template_directory') . '/images/ordering.jpg" usemap="#bg" style="border:none;" alt="background"/>';
} else { /*for everything else use "blog" image*/
echo '<img class="lower" src="' . bloginfo('template_directory') . '/images/blog.jpg" usemap="#bg" style="border:none;" alt="background"/>';
} ?>
I’ve been using this, and has been working well:
<?php if (is_page('my-page')) : ?>
<img src="<?php bloginfo('template_directory'); ?>/images/auto.jpg" alt="test image" />
<?php else : ?>
<img src="<?php bloginfo('template_directory'); ?>/images/generic.jpg" alt="image" />
<?php endif; ?>
(I’ve shortened a bit so hope nothing important got deleted)
Two differences:
– space before the closing of the image tag />
– slightly different php with no “echo”
NOT a php coder but like I said this has been working for me
Or perhaps take quotes of comment about use “blog” image?
thank you csleh, i’ll give that a try. You have stopped the php between actions. I’ll try that, then it can’t freak out about my html. 🙂
The images are showing now. But the maps are NOT working. Does anyone get this stuff? THis is my first mapped image – it may be a very easy fix!
<map id="bg">
<area shape="rect" coords="735,111,787,215"
href="/designs/blog/" alt="Healing Designs blog"/>
<area shape="rect" coords="766,229,808,341"
href="designs/blog/" alt="portfolio"/>
<area shape="rect" coords="745,348,783,453"
href="designs/blog" alt="Let's discuss your design!"/>
<area shape="rect" coords="765,497,805,576"
href="mailto:cathy@tibbles.net" alt="Email"/>
</map>
<?php if (is_front_page()):?>
<img class="lower" src="<?php bloginfo('template_directory');?>/images/splash.jpg" usemap="#bg" style="border:none;" alt="background" />
<!--use portfolio image-->
<?php elseif (is_page('Portfolio')):?>
<img class="lower" src="<?php bloginfo('template_directory');?>/images/portfolio.jpg" usemap="#bg" style="border:none;" alt="background" />
<!--use ordering image-->
<?php elseif (is_page('Ordering')):?>
<img class="lower" src="<?php bloginfo('template_directory');?>/images/ordering.jpg" usemap="#bg" style="border:none;" alt="background" />
<!--for everything else use "blog" image-->
<?php else:?>
<img class="lower" src="<?php bloginfo('template_directory');?>/images/blog.jpg" usemap="#bg" style="border:none;" alt="background" />
<?php endif;?>
I validated it – no mistakes, no suggestions either. 🙁
It all worked! Apparently the “name” attribute needs to be used with the map tag for backwards compatibility. 🙂