This tutorial will guide you how to show Last Updated date in posts in genesis themes. When managing a WordPress website, keeping your content fresh and up-to-date is crucial for maintaining credibility and relevance. However, one common issue many WordPress users face is displaying the last updated date alongside the publish date on their posts. While WordPress automatically shows the publish date, it doesn’t always include the last modified date by default.
Most WordPress themes display the date when a post was last published. For the majority of blogs and static webpages, this is OK. However, WordPress is also utilized by websites that often update their old content. For those publications, the date and time of the most recent update is crucial information. Websites for news are the most prevalent example. They frequently add corrections, media materials, and new developments to older pieces. Their users would not be aware of these modifications if they simply included the publication date.
In this guide, we’ll walk you through the steps to add the last updated date to your WordPress posts.
Method 1 : Using WordPress Plugin (For any theme)
This plugin will work with all the themes.
By using WP Last Modified Info plugin you can show Last updated date on your blog posts alongside published date. This will show both dates Published and last updated.
Features of WP Last Modified Plugin info
- Allows you to display Last modified information in your posts and pages individually.
- Provides you with options to display the last modified/last updated date above or below your posts and pages.
- You can also set date/time formats and the position of the timestamp in WordPress Posts and Pages which can be either before content or after the content.
- Allows you to customize the text which is to be displayed alongside the last modified date (default: Last updated on).
- Inserts ‘dateModified’ schema markup to your WordPress posts automatically.
- Displays last modified info on all post types column and publish meta box in the dashboard with the author name.
- Allows you to sort posts/pages in last updated/modified date-time order.
- Allows you to replace post published date with post modified info.
- Allows you to display last modified info on your post as human-readable format, i.e. Days/weeks/months/years ago.
- Allows you to display last modified info of all posts in the WordPress admin bar.
- Allows you to display last modified author info in posts, pages.
- Allows you to add last modified timestamp in post/page’s custom field.
- Allows you to edit last modified date and time from the post edit screen and quick edit screen as well.
- You can also add template tags to your theme files. Go to the FAQ section for more information.
- Elementor Dynamic Tags support with ‘dateModified’ schema markup.
- Send Email Notification when anyone makes changes to any post of your website.
- Tested with Yoast SEO, Rank Math, All in One SEO Pack, SEOPress, Schema and many other plugins.
- And you can customize all and everything.
Method 2: Using Code (Only for Genesis themes)
Using this code “The Last updated date” will replace the “Published date”. It will show “Last Updated” on the post which are updated, and the posts that are not updated it will show “Published date”.
Add the code snippet to your theme’s functions.php file or a site-specific plugin. Here’s how:
- Access Your WordPress Dashboard: Log in to your WordPress admin panel.
- Navigate to Theme Editor: Go to Appearance > Theme Editor.
- Edit functions.php: Select the theme for which you want to add the last updated date, then click on the functions.php file from the right-hand side.
- Add Code Snippet: Insert the following code snippet at the end of the functions.php file:
example image of functions.php
Note: This code will work on Genesis themes only.
Code starts:
add_filter( 'genesis_post_info', 'custom_post_info' );
function custom_post_info( $post_info ) {
// Get the post's published date and modified date
$published_date = get_the_date();
$modified_date = get_the_modified_date();
// Get the author name and author archive link
$author_name = get_the_author();
$author_link = get_author_posts_url( get_the_author_meta( 'ID' ) );
// Define custom CSS class for text size
$text_size_class = 'custom-post-info';
// Check if the post has been updated
if ( $published_date !== $modified_date ) {
// If updated, show modified date and author with link
$post_info = '<span class="' . $text_size_class . '">Last updated on [post_modified_date] by <a href="' . esc_url( $author_link ) . '">' . esc_html( $author_name ) . '</a></span>';
} else {
// If not updated, show published date and author with link
$post_info = '<span class="' . $text_size_class . '">Published on [post_date] by <a href="' . esc_url( $author_link ) . '">' . esc_html( $author_name ) . '</a></span>';
}
return $post_info;
}
Code ends
example image: Final result
Leave a Reply