Using an if statement to determine post meta
-
Hello,
I’m developing a theme and I would like the meta information to be one of two things:
1. “Written by [author name] on [published date].”
2. “Last updated by [author name] on [last updated date].”Here’s the code I’m using:
<?php if ( get_the_modified_time() == get_the_time() ) { echo 'Written by ' . the_author() . ' on ' . get_the_date() . '.'; } else { echo 'Last updated by ' . the_author() . ' on ' . get_the_modified_date() . '.'; } ?>
For some reason, this code outputs one of two things (depending upon the post):
1. “[author name]Written by [author name] on [published date].”
2. “[author name]Last updated by [author name] on [last updated date].”You can see it here: https://dev.leavingworkbehind.com/blog/.
What am I doing wrong?
Cheers!
Tom Ewer
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using an if statement to determine post meta’ is closed to new replies.