In my loop, I'm trying to set it so that certain text is displayed on certain pages, if there are no posts to display.
I thought this would be simple, using
is_post(), but it seems that this function does not work when you are in The Loop.
Does any body know how I can identify the page that is currently being shown, whilst in The Loop?
The below code is from
loop.php - it's how I have the code structured, as the content is not important in this instance. However, for those interested, here is my full
loop.php code - http://pastebin.com/hDjR6C7A.
<?php if(have_posts()) : while(have_posts()) : the_post(); ?> <!-- Do stuff here --> <?php endwhile; ?> <?php else : ?> <?php if(is_page(162)) : // Careers ?> <!-- Do stuff here --> <?php if(is_page(716)) : // Partnerships ?> <!-- Do stuff here --> <?php elseif(is_search()) : ?> <!-- Do stuff here --> <?php endif; ?> <?php endif; ?>