Site logo

[Resolved] Not getting what I want with the 'after_content' hook

Home Forums Support [Resolved] Not getting what I want with the 'after_content' hook

Home Forums Support Not getting what I want with the 'after_content' hook

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

    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;
        }
    } ?>
    #1286518
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try the generate_after_entry_content hook, instead.

    Also, give it a priority less than 10.

    Let me know 🙂

    #1286669
    litesprint

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

    #1287573
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.