Display published & updated date in a container
-
Hi there!
Is there an easy way to get a shortcode for the published date of a blog post? on the free version of GP (I guess I should get the premium, I’m spending too much time looking for answers ().
I want to display the published date and the updated date right after the header in a container.So far, what almost works :
/* Display updated date */
.posted-on .updated {
display: inline-block;
margin-right: 1em;
}/*Add date prefixes */
.posted-on .updated:before {
content: ‘Updated: ‘;
}
.posted-on .entry-date:before {
content: ‘Published: ‘;
}which add the published and updated dates above the header (but i want to display it under).
I was able to display the updated date :
function post_modified_date() {
return get_the_modified_date();
}
add_shortcode( ‘modified_date’, ‘post_modified_date’ );but nothing for the published date.
I tried to use shortcodes as get_the_date, get_the_time, published_time but it doesn’t work. I also tried things like adding a get_the_date function to function.php but it’s not possible because this “function has been previously declared (in wp-includes/general-template.php:2527)”.I also tried different solutions I found on the forum without getting what I want.
thanks a lot for your help!
The page I need help with: [log in to see the link]
- The topic ‘Display published & updated date in a container’ is closed to new replies.