Last update at :2024-03-21,Edit by888u
Someone recently left a message asking how the update time is added to the article page of this website. The theme he uses only shows the release time. This article will share how to display the last updated time in WordPress articles without installing a plug-in.
1. Code sharing
The WordPress article page is rendered by the single.php file, so we need to modify the code of this file.
Find the code block in the file that displays the article update time. The following uses the DUX theme as an example to obtain post_time and update_time respectively. The two functions get_the_time and get_the_modified_time are used:
0) { return true; } else { return false; } } if (!dateBDate($post_time, $update_time)) { ?> VPS recommendation published in VPS recommendation published in updated on2. Effect display
The effect is the same as this website, the release time and update time will be displayed on the article page:
Recommended site search: Singapore server, German server, purchase space, shopex space, domain name registration query, free vps trial 7-day accelerator, legendary server rental, .net virtual host, Hong Kong's best virtual host, registration-free virtual space,
发表评论