Site logo

Archived topic

Last updated instead of date posted

2 replies · Started by Marko on July 25, 2021

Viewing posts 1–3 of 3

I've followed these instructions to add modified date to my posts and pages: https://docs.generatepress.com/article/show-the-updated-post-date

This is my current css:

.posted-on .updated {
    display: inline-block;
}

.posted-on .updated + .entry-date {
    display: none;
}

.posted-on .updated:before {
    content: "Last updated: ";
}

.posted-on .entry-date:before {
    content: "Date posted: ";
}

On my blog lists page, it shows: Last updated: July 26, 2021 (Which is correct)

However, in my posts and pages with the shortcode [modified_date] in the Page Hero / Post Hero (Element) it shows the posted date instead:

eg. Last updated: July 24, 2021

my PHP snippet for modified_date is:

function post_modified_date() {
    return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );

I feel like something stupid is going on, but I can't figure out what it is?

Hey guys,

I don't know what was wrong, but having the modified_date snippet below the author section on the headline fixed it.

All is well again.

Hi there,

Thanks for letting us know. Glad you got it sorted. :D

This archived topic is closed to new replies.