The publication date has are important.
But the last modified date of an article or known d`une page is an equally important element when the subject is "living" or that requires content updates more or less frequent. This possibility is not offered in a simple form to WordPress.
Why read a topic from several years without knowing and without one day become obsolete content patch.
On several occasions, you may find yourself trying to open a page / item without knowing if it was recently amended.
IF provides a simple and practical.
How to display the date and time of your article.
For displaying the date and time, insert the code directly into php pages as single.php / content-single.php or the pages.php or you want according to your needs.
A class was added in order to stylize as you like.
<?php
if (get_the_modified_date() != get_the_date() || get_the_modified_time() != get_the_time()) :
?>
<p class="last-updated">Article mis à jour le <?php the_modified_date();?> à <?php the_modified_time();?></p>
<?php
endif;
?>
Example of CSS that we use:
.last-updated {
font-size: small;
text-decoration: underline;
text-align: center;
background-color: #fffdd4;
}
Comment modifier l'organisation d'affichage de vos article en fonction de la mise à jours.
By default, WordPress sorts the items in reverse chronological order (from newest to oldest), or rather the date of publication.
De loin l'un des moyens les plus faciles de réorganiser les articles dans WordPress est avec une extension.
For some additional knowledge kinsta.
We want to highlight the code for the most discerning.
A function ordering your publications be automatically sorted in order of updating and publishing.
The highlighted remains priority, track last updated days then chronologically.
To add further to your duties in your file fonction.php themes.
function order_posts_by_mod_date($orderby) {
if (is_home() || is_archive() || is_feed()) {
$orderby = "post_modified_gmt DESC";
}
return $orderby;
}
add_filter('posts_orderby', 'order_posts_by_mod_date', 999);
The FI team
[site_reviews_summary assigned_to=”post_id”]
[site_reviews_form assign_to=”post_id”] |
[site_reviews display=10 assigned_to=”post_id”]