Simple if statement with conditional tags
-
Hey guys,
In theory this should achieve the desired affect but I have been messing around with this statement for a while now with no joy:
<?php if (is_single() || is_page('blog')) { echo "<a href='blog'>« Back to the blog</a>"; } elseif (is_archive() || is_single()) { echo the_category(); } ?>
Essentially I want a link to be displayed at the bottom of single posts – If the user reads a post from the blog it will display a link saying “back to the blog”. If the user has gone through a category and then selected a single post it will provide a link back to the category.
Thanks guys
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Simple if statement with conditional tags’ is closed to new replies.