• Resolved gwenm

    (@gwenm)


    Hello, I added this script to display the date of update of my pages, but the date is displayed on top. How to put it at the bottom ?
    I use the child theme.

    function show_last_updated( $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('j F Y');
        $updated_time = get_the_modified_time('h:i a');
        $custom_content .= '<p class="last-updated-date">Mis à jour le '. $updated_date . '</p>';
      }
      $custom_content .= $content;
      return $custom_content;
    }
    add_filter( 'the_content', 'show_last_updated' );

    Thank you ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @gwenm

    I’m really sorry, but our policy does not provide support for custom code. I would recommend finding a knowledgeable developer if you wish to further modify this snippet.

    Alternatively, you might want to take a look at Part 3 of this article – https://www.coding-dude.com/wp/wordpress/add-text-before-after-content/. It advertises a filter that lets you add content right after the main content of the post, or even before it. I have preliminarily tested it and it seemed to work nicely. Only needs your adjustments. ??

    Hope this points you in the right direction!

    Thanks.

    Thread Starter gwenm

    (@gwenm)

    Thank you very much, this is already a very good lead^^

    Thank you as well, @gwenm ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display Last Updated Date at the bottom of the page’ is closed to new replies.