Site logo

Archived topic

Not getting what I want with the 'after_content' hook

3 replies · Started by litesprint on May 15, 2020

Viewing posts 1–4 of 4

I want to display “Last updated” date after content but before ‘next’ and ‘previous’ links. With the following code, utilizing the after_content hook, I get the last updated date displayed right below the ‘next’ and ‘previous’ links. I want the opposite.

<?php if ( is_single() ) { 
    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
        $time_string = '<time class="last-updated" datetime="' . esc_attr( get_the_modified_date( 'c' ) ) . '" itemprop="dateModified">' . esc_html( get_the_modified_date() ) . '</time>';
        echo 'Updated on ' . $time_string;
    }
} ?>

Hi there,

Try the generate_after_entry_content hook, instead.

Also, give it a priority less than 10.

Let me know :)

I tried it before, but lowering the priority did the trick! Thanks!

You're welcome :)

This archived topic is closed to new replies.