hi,
I am trying to use the conditional tags. Basically I want to say that if it is the page About choose this image with a $bannerimg. So, where do I insert that $bannerimg in my code?
<?php if ( is_page('about')) {
$bannerimg = about.jpg';
} else {
$bannerimg = 'home.jpg';}
?>
???????? <img src="$bannerimg" align="right" /> ???????
use a php echo function to output the $bannerimg:
http://php.net/manual/en/function.echo.php
ok, but Im a real newby and how do I do that so the $bannerimg will be the src of the image?
where is the image folder?
the full code depennds on the image location;
to start, try:
<?php if ( is_page('about')) {
$bannerimg = 'about.jpg';
} else {
$bannerimg = 'home.jpg';}
?>
<img src="<?php echo $bannerimg; ?>" align="right" />
as this is likely not to work, try for the last line:
<img src="http://full_path_to_image_folder/<?php echo $bannerimg; ?>" align="right" />
<?php if ( is_page('about')) {
$bannerimg = 'about.jpg';
} else {
$bannerimg = 'home.jpg';}
?>
<img src="<?php echo $bannerimg; ?>" align="right" />
that code worked perfectly!!!! thanks!