Can anyone tell me how to display certain text in the loop if a post has no tags, but the list of tags if there are tags? I want to show a sentence for each post that says: “By AUTHOR at DATE in CAT1, CAT2, with tags: TAG1, TAG2.”, but if there are no tags, end the category list with a period. I’ve got every piece but the last part. I’m trying this code:
By <?php the_author_link(); ?> at <?php the_time(‘Y-m-d\TH:i:s’) ?> in <?php the_category(‘,’) ?><?php if (empty($tags)) echo “.”; else the_tags((‘, with these tags: ‘), ‘, ‘, ‘.’); ?>
The ” if (empty($tags)) echo “.” ” just shows a period but no tags, even if the post has tags. For now, I’ve just removed the “if (empty($tags)) echo “.”; else” part. In a post with tags, it looks fine, of course (example). But in tagless posts, my sentence ends without a period (example). Won’t anyone save me?
I’m using WordPress MU 2.5.1, but it shouldn’t matter since this part of it is the same as regular WordPress.