If condition to display post published date and update date
-
i need help,
Depending on whether a post has been edited or is created for the first time, I would like to take a different action.My goal is to display the date of the post was created ( $published_date ) , if it was only published for the first time and was never updated or edited.
and to display the updated date if a post was updated/edited ($update_date).
but it seems my code isn’t working, Here is my code.
$published_date = get_the_date( 'F j, Y' ); $update_date = get_the_modified_time( 'F j, Y' ); if( get_the_modified_time() == get_the_time()){ echo $published_date; } else{ echo $update_date; } }
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘If condition to display post published date and update date’ is closed to new replies.