How to Change Published Date to Updated Date on Wordpress

Joined
Jun 24, 2015
Messages
59
Likes
31
Degree
0
Is there any good plugin to change dates on my posts? Right now, it shows "Published on" and then the date that is actually an anchor.

I would like to have "Updated on" instead of Published. The main goal is to actually have a modified date instead of published on SERP.

Is there any good plugin I can install or should I just hire someone on Fiver...
 
Is there any good plugin to change dates on my posts? Right now, it shows "Published on" and then the date that is actually an anchor.

I would like to have "Updated on" instead of Published. The main goal is to actually have a modified date instead of published on SERP.

Is there any good plugin I can install or should I just hire someone on Fiver...

Ask your theme developer.
If it's a paid theme they should be able to support you.
 
Is there any good plugin to change dates on my posts? Right now, it shows "Published on" and then the date that is actually an anchor.

I would like to have "Updated on" instead of Published. The main goal is to actually have a modified date instead of published on SERP.

Is there any good plugin I can install or should I just hire someone on Fiver...

If you've set up a child theme, it should be as easy as copying the templates you need to change to the child theme, finding <?php the_date(); ?> and changing it to <?php the_modified_date(); ?>. If you want to add schema markup that should be self-explanatory.

If you don't know how to do all of that then yeah, you either need a plugin or to hire someone. I'm not vouching for this plugin but I just googled it and this came up, just updated a day ago. It doesn't replace "the_date" but seems to insert "the_modified_date" with the schema markup at the top of "the_content". Not quite how I'd do it but it probably gets the job done.
 
Okay, I spent some time now to fix this and I found:

Code:
<div class="entry-meta">
           
            <?php athemes_posted_on(); ?>
       
        <!-- .entry-meta --></div>

In my content-single.php.

I changed
Code:
<?php athemes_posted_on(); ?>
with
Code:
<?php get_the_modified_time( $d ); ?> .

It showed the Updated date, but not like "Updated at", just the date.

I think I need to add schema markup, not sure how to do this but this is some progress. Thank you guys.

P.S: The theme is free.
 
@Magister, make sure you're doing this in a child theme or you'll lose the change when you update the theme.

athemes_posted_on() means they have their own function tucked away in the functions.php or some other file being called into the functions.php most likely (or some other template). Chasing it down is possible but what you're doing is fine if you aren't losing other stuff inside that function. For instance, if you lost something like "Published on:" then that was also in that function. Not a big deal in your case.

If you want it to say "Updated on" then add that outside of the PHP, which would mean you're rending HTML: Updated on: <?php get_the_modified_time( $d ); ?>

If you want to slap some schema around it, it's the same process:
<span class="myDate">Updated on: <time itemprop="dateModified" datetime="<?php get_the_modified_date('Y-m-d'); ?>"><?php the_modified_date('M j, Y'); ?></time></span>
That's how I'm doing it currently. I added the <span class="myDate"> in there for you as an example. You can do that so you can style the date however you want using the CSS class .myDate. So you could make it smaller, in italics, whatever.
 
Hey, thank you @Ryuzaki

Yes, I'm using a child theme.

So, as stubborn as I am, I had to find that function in theme-tags.php. What I found is this:


Code:
function athemes_posted_on() {

    $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';

    $time_string = sprintf( $time_string,

        esc_attr( get_the_date( 'c' ) ),

        esc_html( get_the_date() ),

        esc_attr( get_the_modified_date( 'c' ) ),

        esc_html( get_the_modified_date() )

    );



    printf( __( '<span class="posted-on">Posted on %1$s</span><span class="byline"> by %2$s</span>', 'athemes' ),


So I tried to move esc_attr and esc_html of modified date to be first and esc_attr and esc_html of the date second and it showed error. But after that, I just deleted the esc_attr(get_the_date... and esc_html( get_the_date.. and left just for a modified date and viola.

It worked.

So I also changed the printf function and now it says "Updated at" followed by modified time. Great!

The only thing I am worried about is that now, even new posts that aren't being modified show "Updated at" following by published date. Hope this won't be a problem for SEO. Maybe if you know that simply adding the

Code:
Updated on: <?php get_the_modified_time( $d ); ?>

Will be better for Google crawler, then I would do it that way. But I guess I'm fine.

Anyways, thank you a lot!


As far as schema goes, I just checked it for my main posts and its definitely full of errors. 4 errors including those about date and author. The homepage is fine.

This is the next thing I need to get my hands on and learn about. After I fix schema I will play with the wc3 validator and lastly, page speed(74/100 for now).

Technical SEO is fun, especially this coding part. I work with PowerShell on my day job but maybe I start learning PHP, CSS, and stuff related to WordPress.
 
The only thing I am worried about is that now, even new posts that aren't being modified show "Updated at" following by published date. Hope this won't be a problem for SEO. Maybe if you know that simply adding the

That's how I roll. It's not been a problem for me. It's still technically true that that's the last date it was updated. Check out the <head> of your pages too and see if it's still spitting out "published on" dates as well as "last modified." It might be both, neither, just one, depending on the theme or plugins you're using. I prefer to only show the Updated date and not confuse Google with both. They still have issues picking out the correct dates, even if you mention a date in the post about when some event occurred.
 
Back