Archived topic
Post Last Modified Date
7 replies · Started by Jatin on February 4, 2021
If i modify a post then i want to show the date modify how can i show natively using GeneratePress theme.
Does the theme provide any option natively. I dont want to use third party plugins.
Hi there,
Does this help?
https://docs.generatepress.com/article/show-the-updated-post-date/
Let me know :)
Hey Leo,
I created a short code and added to the header element which works fine.
I want to align it on the extreme right bottom of my header element with the same style as other meta elements on the post to make it look nicer. Please let me know if its possible.
+ It just shows the date and does not show Last Updated on:
. How to add this text before the date modified.
example link in info box.
Hi there,
you will need to add some HTML to your Shortcode date:
function post_modified_date() {
$modifiedDate = get_the_modified_date();
$html = '<span class="hero-date">' . $modifiedDate . '</span>';
return $html;
}
add_shortcode( 'modified_date', 'post_modified_date' );
then you can use some CSS to float the element:
.hero-date {
float: right;
}
This did worked but not as per the requirements:
> I want to have the style similar to other meta like Author Name, Date etc.
> To move the Date Modified to align right as shown in screenshot or in the same row as other meta if possible.
> have prefix: Last Updated:
Hi Jatin,
Give this CSS a try:
.hero-meta {
display: flex;
flex-flow: row wrap;
}
.hero-meta .hero-date {
background-color: #fff;
color: #000;
margin-left: 10px;
border-radius: 1px;
padding: 0px 5px;
}
.hero-meta .hero-date:before {
content: "Last Updated: ";
}
Let me know :)
Thanks much better now but how to extrem align it right hand side, it's currently displaying next to other meta but I want to separate this one by aligning right.
Update this CSS and include the line i have commented:
.hero-meta .hero-date {
background-color: #fff;
color: #000;
margin-left: 10px;
border-radius: 1px;
padding: 0px 5px;
margin-left: auto; /* add this property */
}