10.6 C
London
Thursday, March 28, 2024

Show Last Updated Date in SociallyViral Theme By Mythemeshop

How To Show Last Updated Date in WordPress Post  In SociallyViral Theme By Mythemeshop

Show Last Updated Date in SociallyViral Theme by Mythemeshop made easy? If yes this is for you! In this article, you will learn the long awaiting process involved in Showing Last Updated Date in SociallyViral theme by mythemeshop WordPress Theme. For some of you that are using the above-mentioned theme, this post is for you.

There are ways, in which one can change the last updated date in WordPress post, the general method out there did not work for Mythemeshop premium themes. In case you found yourself here and you are not using the above-mentioned premium theme, then I will recap on the general method that works well for all WordPress themes

How To Show last updated Date in All Default WordPress Themes

Since you are not using the premium Mythemeshop that I am using on my blog, the method that I am about to explain will definitely work for you.

Before I begin, note that we have three (3) methods that you can use to show last updated date in your WordPress theme. And also, why did we want to show the last updated date in our published posts? This brings us to the advantages we get to show Last Updated Date on WordPress Posts

Benefits You Get In Showing Last updated Date in Posts

Increase your CTR in SERPs

Impress your Blog readers if you have an old postdate implies they thought this as the Old and outdated post. If you show the Last Updated Date of your blog entry they thought this blog has an up to date posts.

Most of the Readers Check the post date in a search motor – if you having a Last updated date work it will show the Last updated post-editing date in Search engines.

Step One

You can show last updated date in your blog post by installing a child theme plugin.

Yes, child theme plugin. This is the easiest method you can use to show the last updated date in WordPress posts. In this method, as the name implies, you have to install a child theme plugin.

There are so many of the child theme plugin at the WordPress directory. You just need to type in a child theme in the search box and you will see different plugins that will display.

<<>>You may need a website builder software, use Elementor website builder for free<<>>

You will see that in the image below, I chose ‘Child Theme Generator’ the reason been that, it is very simple and even a learner can easily just click and install.

Show Last Updated Date in SociallyViral Theme

I chose Child Them Generator Image

 

I believed you had chosen the same Child theme as mine, then just click on install and activate.

From the left side of the WordPress dashboard

go to appearance >>> Theme Editor >>> choose ‘function.php’ from the right side option where you will see, style.css and function.php.

In the box that will display, scroll down where you will see {Write here your own personal function}

In that field, wap off the writeup and paste this code to show updated date in your post

 

/*add_filter(‘comment_form_default_fields’, ‘unset_url_field’);

function unset_url_field($fields){

if(isset($fields[‘url’]))

unset($fields[‘url’]);

return $fields;

}”>

<span class=”thetime date updated”><i class=”fa fa-calendar”></i> Last Updated: <span itemprop=”datePublished”><?php the_modified_date(‘F j, Y’); ?></span></span>

And click on the update file.

That is all. Try to update any post and view to see if you will see any updated date as display as seen below image:

Show Last Updated Date in SociallyViral Theme

 

Using this method is safe because, even if you update your theme to latest released version, all the modifications and changes that were done by you long ago will still be intact without you losing any changes.

Step Two

This method works perfectly for those that can easily access their Cpannel on their web host without any issue.

To use this method effectively, you should just visit your host for your website hosted files. To do this, follow the below instructions:

Read also; Speed Up Website | Speed Up WordPress Websites in 5 Simple Steps

Visit your Cpanel

Then navigate to FileManager. You will see the list of hosted websites.

In my own case, I chose;

Rootfile/pgupdates.com/wp-content/themes/twentynineteen. Here my own theme name is twenty nineteen theme. If you have chosen your own theme, you will see the list of files, such as style.css, htaccess, function.php, etc

Choose function.php file

Right-click on it and choose ‘edit file’

Before you alter any changes, always make sure you download the function.php file for backup purposes in case any error occurred, you can easily replace the function back to the working function.

Since you have clicked on edit file, copy the code below;

function wpb_last_updated_date( $content ) {

$u_time = get_the_time(‘U’);

$u_modified_time = get_the_modified_time(‘U’);

if ($u_modified_time >= $u_time + 86400) {

$updated_date = get_the_modified_time(‘F jS, Y’);

$updated_time = get_the_modified_time(‘h:i a’);

$custom_content .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;

}

 

$custom_content .= $content;

return $custom_content;

}

add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

And paste the above snippet code immediately after require get_parent_theme_file_path( ‘ /inc/icon-functions.php’ ); As seen in the sample image below:Show Last Updated Date in SociallyViral Theme

 

in the function.php file and click on save changes.

Check any recent posts that you have updated and see the changes.

How To Show Updated date in SociallyViral Theme By Mythemeshop 

As I said earlier that the method one above is the simplex method but some of us will prefer to temper with our website code directly from the Cpanel.  Then the method two above can be the best steps to show last updated date.

However, let us see how to modify our SociallyViral theme by Mythemeshop to show last updated date of published WordPress posts.

Before I begin, this method has to do with your host. So try to get your host login detail and access your Cpanel.

From the Cpanel, Look for your host FileManager then let say your website is pgupdates.com, look for the root folder of the website.

In my own case I did it this way:

Cpannel >>> Filemanger >>>> Root folder Pgupdates.com>>> Wp-content >>>Theme>>>mts_SociallyViral>>>Functions>>>Theme-Action.php

You will see from the directory above after the Wp-content, theme follows and I chose mts_SociallyViral because the name of the theme I am using is mts_SociallyViral, so on your own case, you should choose your current theme. Inside the theme folder, you will see all your theme files, what made up to build your theme. Choose Function folder, inside the function folder, pick theme-action.php

You may like to read – Show Last Updated Date in WP Post Adsense Mythemeshop WordPress theme

At this point, before you edit this file, make sure you first of all download it for backup purposes and right-click on it and choose edit.

By now the file code is open and you need to look for the code line to edit. What to do here is;

Press ctrl+F key, a tab will open, copy below code into the opened tab

<span class=”thetime date updated”><i class=”fa fa-calendar”></i> <span><?php the_time( get_option( ‘date_format’ ) ); ?></span></span>

You will see that the page will directly locate the line where above codes are and when you are there, delete those codes and replace it with below snippet code

<span class=”thetime date updated”><i class=”fa fa-calendar”></i> Last Updated: <span itemprop=”datePublished”><?php the_modified_date(‘F j, Y’); ?></span></span>

After you have done this, at the top, you will see, save changes.

You have successfully added code to your WordPress theme to show updated date in all your posts.

Related article – Show Last Updated Date in Schema Theme By Mythemeshop

Note: In case you follow the above steps and the changes didn’t reflect or your website layout scattered, just replace the ‘theme-action.phpcode back to the one you downloaded as a backup.

If you followed the steps given above correctly, by now you should see that newly updated date effect on the WordPress post.

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here