Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1168755

    Hi guys,
    I would like to add the text “Last update on” in a single post.

    I followed the instruction you gave on a previous ticket – https://kriesi.at/support/topic/change-blog-date-to-last-updated-instead-of-date-published/

    However I could not find the code to replace on line 366 on postslider.php file so before doing any mistakes I will ask your help.

    I have 2 options.

      I can add the text “updated on” before the date at the top of a single post
      2019-12-23_1405

    OR

      I can fix the instructions you have pointed out on the WPbeginner website.
      https://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpress/

    The last solution could be fine but instead of adding a “last updated on” text on the single post, I can see this on each page of the site.
    2019-12-23_1408

    I will remove now the PHP code found on the WPbeginner

    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”>Aggiornato il ‘. $updated_date .’
    ‘;
    }

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

    Please, could you help?

    thanks,
    Marco

    • This topic was modified 4 years, 11 months ago by marcoabis81. Reason: Adding login details
    #1169061

    Hi marcoabis81,

    We apologize for the delay.
    Please copy loop-index.php (in the Enfold theme) and paste it in the includes folder of your child theme.
    find this code (it should be in line 305):

    echo "<time class='date-container minor-meta updated' >".get_the_time(get_option('date_format'))."</time>";

    replace it with:

    echo "<time class='date-container minor-meta updated'>Last update on ".get_the_modified_time(get_option('date_format'), $the_id)."</time>";

    Let us know if this helps.

    Best regards,
    Nikko

    #1169148

    Absolutely amazing,

    it works,
    much appreciated and have a good new year :-)

    Marco

    #1169161

    Hey!

    Glad Nikko could help!

    Let us know if you have any other questions or issues!

    Happy new year to you too :)

    Cheers!
    Yigit

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Single post "last updated on"’ is closed to new replies.