If statement for pages
-
Okay, I am trying to make it so I can show a different image depending on what page I am on. I have tried this if statement.
<?php if (is_home()) { echo'<img src="locationofimage" alt="" />' } elseif (is_page('2')) { echo'<img src="locationofimage" alt="" />' } else { echo'<p>Just a Test</p>' } ?>
But when I do this nothing shows up on the page at all (completely white)
However if I just put the image path with no PHP
<img src="locationofimage" alt="" />
The image shows up just fine. Any suggestions.
BTW, yes I have done a search for similar questions, which is where I got this idea in the first place to no avail.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘If statement for pages’ is closed to new replies.