o2cathy Posted June 27, 2008 Share Posted June 27, 2008 <?php if (is_front_page()) {echo '<img class="lower" src="<?php 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="<?php 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="<?php 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="<?php bloginfo('template_directory');?>/images/blog.jpg" usemap="#bg" style="border:none;" alt="background"/>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/112115-need-help-finding-the-error-in-this-code-simple/ Share on other sites More sharing options...
GreenUser Posted June 27, 2008 Share Posted June 27, 2008 Will this work? <?php if(is_front_page()) { echo '<img class=lower src="<?php 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="<?php 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="<?php 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="<?php bloginfo('template_directory');?>/images/blog.jpg" usemap="#bg" style="border:none;" alt="background"/>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/112115-need-help-finding-the-error-in-this-code-simple/#findComment-575599 Share on other sites More sharing options...
LooieENG Posted June 27, 2008 Share Posted June 27, 2008 Missing a ' from here <?php bloginfo('template_directory);?> Edit: A better way would be <?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"/>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/112115-need-help-finding-the-error-in-this-code-simple/#findComment-575602 Share on other sites More sharing options...
cooldude832 Posted June 27, 2008 Share Posted June 27, 2008 don't u have line numbers in your editor??? Quote Link to comment https://forums.phpfreaks.com/topic/112115-need-help-finding-the-error-in-this-code-simple/#findComment-575605 Share on other sites More sharing options...
o2cathy Posted June 27, 2008 Author Share Posted June 27, 2008 No parsing errors! Instead of the img, it is outputting this: http://localhost/wordpress/wp-content/themes/healing Designs at the top of the screen. That is not the "alt" for that image. it is using the "echo" quite literally instead of using the html. I don't know why though? LooieENG, thanks for that code! Quote Link to comment https://forums.phpfreaks.com/topic/112115-need-help-finding-the-error-in-this-code-simple/#findComment-575896 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.