Comments (6)

  • The functions.php code worked great! Thank you. However, it displays on both pages and posts. How can I limit that code to only display on posts and not on pages?

    Thanks, John.

  • Thanks for this post! One question. How do you modify the function.php code if you only want the last updated date to show on blog posts and not on pages?

    Thanks again.

  • It seems that you’ve disabled highlighting for your articles – but if you have code that users are to copy and paste it would be helpful to allow them to highlight it šŸ™‚

  • [saved the page to my local, then opened it in notepad]

    function wpb_last_updated_date( $content ) {
    $u_time = get_the_time(‘U’);
    $u_modified_time = get_the_modified_time(‘U’);
    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’);
    $custom_content .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;

    $custom_content .= $content;
    return $custom_content;
    add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

  • P.S. Thanks for the solution, tried hitting your site to hire you for doing the work but doesn’t look like you do that. Let me know if that’s incorrect.


Leave a Reply

Your email address will not be published. Required fields are marked *

five × 5 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.