Display Last Modified Date

People always like to keep themselves updated. Showing a very backdated date on your post, is not a wise idea. You can update your post time to time and keep your reader’s updated. Also it’s necessary to showcase your update date instead of publish date.

I’m going to show you how you can display your post modified date using a very simple code. If you are not expert on coding stuff, you can easily do it using “WP Adminify” plugin.

Login to your Cpanel or FTP and navigate to your active theme’s root directory. Search for function.php file, edit this file using any Cpanel code editor or Text editor. Copy and paste the following code inside your function.php file and save it.

				
					// tag and category hooks
add_filter('the_content', 'jltwp_adminify_last_updated_date', 10, 1);
add_filter('wp_head', 'jltwp_adminify_last_updated_date_style');

//Display Last Updated Date of Your Posts
function jltwp_adminify_last_updated_date($content)
{
    $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    $custom_content = '';
    if ($u_modified_time >= $u_time + 86400) {
        $updated_date = get_the_modified_time('F jS, Y');
        $updated_time = get_the_modified_time('h:i a');
        $modified_date = esc_html__('Last Updated on', WP_ADMINIFY_TD);
        $custom_content .= '<p class="last-updated"><span>' . $modified_date . '</span>' . $updated_date . ' ' . $updated_time . '</p>';
        $custom_content .= $content;
        return $custom_content;
    }
}
function jltwp_adminify_last_updated_date_style()
{
    echo '<style>.last-updated{background-color: #E8FFD7;border: 1px dashed red;} .last-updated span{padding: 0 10px;}</style>';
}
				
			

Last Modified Date Via WP Adminify

While you are “WP Adminify” user, you don’t need to write or copy-paste any code. Just click on the “WP Adminify” option from your Dashboard. You can take a look at WP Adminify tweaks option for better understanding. 

Navigate to Tweak > Post / Archive option. The first option is “Display Last Modified Date“. Just enable it and start updating your post. 

Display Last Modified Date

The last update date will appear automatically in your blog post.

Was this article helpful?

© 2021-2024 - Adminify | All rights reserved

WP Adminfy accepted payment methods