Last Updated Date in Blog Posts

March 2014 WordPress Theme
GK User
Fri Apr 08, 2016 8:17 am
Hi,

How i can change (from posted date) and show in font end and google results the last updated date of my blog posts?

I would like in blog post to show Last Updated on April 8, 2016.

Thanks!
User avatar
Junior Boarder

Joshua M
Fri Apr 08, 2016 9:00 am
Hi,

This article should be helpful:
http://www.wpbeginner.com/wp-tutorials/ ... wordpress/

You can add this code into your News2/layouts/content.post.footer.php file.
User avatar
Moderator

GK User
Fri Apr 08, 2016 9:57 am
Hi,

Thanks for your reply but in the file you mentioned above I did not find any code related to modified time.
User avatar
Junior Boarder

Joshua M
Mon Apr 11, 2016 7:50 am
You can't find the code related to modified time - because there's no modified date in News2 theme.
Please try to add the code from mentioned article and should be fine.
User avatar
Moderator

GK User
Mon Apr 11, 2016 9:25 am
I just add the code in the begging of the php file and nothing happens.
I update a post and no date change.
User avatar
Junior Boarder

Joshua M
Tue Apr 12, 2016 8:12 am
Try to add it around line 127 (between two <?php endif; ?> lines)
User avatar
Moderator

GK User
Tue Apr 12, 2016 10:30 am
Hi,

It shows now after the ads, the author box and the related posts.
I just need to replace the date below the title and show this: Last Updated Date on: April 12, 2016
Also I need google to show the last updated day in my post in search results. This is important.

Thanks!
User avatar
Junior Boarder

Joshua M
Wed Apr 13, 2016 7:42 am
Generally it's a theme customization which is beyond our technical support - please try to edit News2/gavern/helpers/helpers.layout.fragments.php (gk_post_meta function and please edit this function:
Code: Select all
<?php if($param_date) : ?>
          <li class="date-mobile">
             <time class="entry-date" datetime="<?php echo esc_attr(get_the_date(DATE_W3C)); ?>">
                <?php echo esc_html(get_the_date()); ?>
             </time>
          </li>
          <?php endif; ?>
User avatar
Moderator

GK User
Wed Apr 13, 2016 6:33 pm
Hi,

and thanks for this. I replace the code you mentioned above with the one in wpbeginner link.
Seems to work fine.

The only problem as i can see now is that the day appears in the end after the "Written by" and "Published in" and not in the beginning.

Can we fix this please?

Thanks again.
User avatar
Junior Boarder

GK User
Thu Apr 14, 2016 11:16 am
Also as i can see now after the modification the date appears in category pages.
Can we exclude?
User avatar
Junior Boarder

Joshua M
Fri Apr 15, 2016 7:55 am
Please change first line into:
Code: Select all
<?php if($param_date) && is_singular() : ?>

to display it only on post/pages.

Regarding the order - could you provide URL to your page where the issue is visible?
User avatar
Moderator

GK User
Fri Apr 15, 2016 8:35 am
Hi,

I change the first line: <?php $u_time = get_the_time('U');
to the code you mentioned but did not work and causes several problems in the website.

Regarding the link, i send it to you via pm.

Thank you!
User avatar
Junior Boarder

Joshua M
Mon Apr 18, 2016 10:37 pm
Please change the first line from my code:
Code: Select all
<?php if($param_date) : ?>


Regarding the order, you have to move this fragment of code before li with "written by" text.
User avatar
Moderator

GK User
Tue Apr 19, 2016 8:44 am
Hi,

The code do not work and appears an error message in my website.
User avatar
Junior Boarder

GK User
Thu Apr 28, 2016 8:51 pm
As I can see no one could help me here after 20 days.
Also in new posts the date do not appear at all.
User avatar
Junior Boarder

Joshua M
Fri Apr 29, 2016 7:51 am
Generally your issue is a theme customization which is beyond basic technical support, I've made an except and gave you some tips.

Regarding the issue - you didn't provide any details, what error message is exactly displayed?
User avatar
Moderator

GK User
Fri Apr 29, 2016 8:25 am
Hi,
Could you please help me with the main problem, which is that the date in new posts? They do not appear.
I already send you my link in previously private message with my website.
User avatar
Junior Boarder

Joshua M
Sun May 01, 2016 10:22 pm
Hi,

I can see the date on the page which your sent via PM.(next to permalink, after the title). If It's not fixed, you can send me FTP access to your website and I'll try to help.
User avatar
Moderator

GK User
Mon May 02, 2016 10:43 am
The link i send you its an old post. I talk only for new posts after i modify the code.
I will send you an new link from a new post to take a look.
User avatar
Junior Boarder

Joshua M
Wed May 04, 2016 10:14 am
Ok, but I need also FTP access to check your files.
User avatar
Moderator

GK User
Wed May 04, 2016 10:38 am
done! :)
User avatar
Junior Boarder

Joshua M
Wed May 04, 2016 10:57 am
Do you have any cache plugin enabled? Please disable cache for a moment, because I can't see the effect of my modifcations.
User avatar
Moderator

Joshua M
Wed May 04, 2016 11:36 am
I've changed your code into:
Code: Select all
<?php if($param_date && is_single()) : ?>
                <li>
                <span>Last modified on: </span>
                <?php echo the_modified_date(); ?>
                </li>
             <?php endif; ?>

should be fine now.
User avatar
Moderator

GK User
Wed May 04, 2016 2:18 pm
Yes everything seems good now!

Thank you for your help :)
User avatar
Junior Boarder


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.