How do I add "updated the" to my Divi articles?

Updated on 17/09/2019 | Published on 02/09/2019 | 17 comments

The mention "updated on" allows you to indicate to your readers the date of update of the article.

A regularly updated article helps to maintain good positions in search results (SERP). This is an important SEO criterion!

However, Internet users may not realize at first glance that the article is recent because most of the time, it is the date of publication that appears.

If your article was published 5 years ago but you update it every year, it would be a shame to risk losing readers who think the article is obsolete!

In this tutorial, we will see how to add the mention "updated on" in the metadata of your Divi articles.

As you can see, this statement is displayed under the breadcrumb trail of my articles on Divi Tips.

Ajouter "article mis à jour le" dans Divi
Left: default metadata - right: metadata with the mention "updated on".

Advertisement: This article contains affiliate links that you will easily recognize. The classic links are in purple and sponsored links are in pink.

Here is the program of the article:

  1. What is an article metadata?
  2. Why should the mention "updated on" be preferred to the date of publication of an article?
  3. The importance of updating a blog post
  4. How to display the update date in a Divi article?
  5. Manage metadata in Divi
  6. In conclusion....

1 - What is an article metadata?

WordPress article metadata is information related to the publication of a post. This information is automatically inserted into your articles without you having to do anything.

Of course, the types of metadata and the location of display depend on how the WordPress theme was coded.

Some themes do not display them, others display them automatically and others, such as Divi, offer options for choosing the metadata to display.

A metadata can be information related to:

  • the date of publication,
  • the author of the article,
  • the category or label in which the item has been classified
  • the number of comments
  • etc.

This metadata reveals important information to your reader.

For my part, I am very attached to this data when I do web research to document myself. When the blog doesn't display them, it bothers me because I don't know if the article is recent and if I can rely on its content... It also allows me to know if the blog in question is well maintained or not: frequency of publication or very random publication. All this information can therefore have an impact on the credibility of a blog.

obtenir Divi - get Divi

2 - Why should we prefer the mention "updated on" rather than changing the publication date of an article?

Surely you're thinking that it's easy and that you just have to change the publication date of the article?

Well no, this is not the most recommended way to do it as you can see in this article (or in this one in English).

If you have the bad habit of changing the publication date of your articles in order to fool robots and get "cool" dates in search results, your site could be penalized by Google.

It wouldn't be honest either for your readers, especially if you haven't changed a single word in the article! This would only increase the bounce rate of your site and lose credibility.

In addition, some articles could not be rescheduled simply because there may be an inconsistency between the content and the date it was published. This could make the Internet user suspicious....

And finally, know that if you change the publication date of your articles, the comments will keep their original date.

For example: article published on 24 July 2019 - commentary published on 12 April 2018. A little weird, isn't it? I'm sure you've seen this before!

That's why there is a best practice: add the update date to the metadata of your article.

"mis à jour" apparait sur les vignettes du blog
The mention "updated on" also appears on the blog thumbnails

Why display the update date in the metadata rather than in the article directly?

Because metadata is visible within the article, under the title, but also from the archive pages (blog page, category archive page etc.)

Did you know that you can test Divi for free? Go to this page and click on "TRY IT FOR FREE"

3 - The importance of updating a blog post

Updating your old articles is a strategy that helps you stay competitive in search results and continue to generate traffic to your blog.

The Internet moves very fast and the topics covered are often covered by other bloggers. The idea is to try to keep a good place in the research results, even several years after publication.

Updating your articles allows you to improve your SEO (natural referencing) and to capitalize on the work already done. Because yes, writing is a job!

Just because your article doesn't mention that it has been updated doesn't mean that Google doesn't see it... Phew! Phew! That's good news already.

Indeed, even if the update date does not appear in the metadata of your article, it appears in the source code of your article, within the section .

property "article:modified_time"
Meta property = "article:modified_time" - this tells robots when your article was updated.

As you can see on this screenshot, a is inserted in the section of your site when you modify an article already published.

By scanning your site, Google sees this information that tells it that you are maintaining your blog. And soon your visitors will also see it thanks to this tutorial....

Want to customize Divi as a pro? Discover all the tutorials!

4 - How to display the update date in a Divi article?

To edit the metadata of your Divi articles, you will need a child theme.

This is the most secure way to modify a WordPress theme without losing its customizations the next time it is updated and without the risk of making irreversible mistakes.

You can obtain a Divi child theme for free here or learn how to create it.

A child theme must use a functions.php file, you just have to edit it and add the following piece of code:

function ad_last_updated_post( $the_date ) {
     if ( 'post' === get_post_type() ) {
         $the_time = get_post_time( 'His' );
         $the_modified = get_post_modified_time( 'His' );
         $last_modified =  sprintf( __( 'Mis à jour le %s', 'Divi' ), esc_html( get_post_modified_time( 'd/m/Y' ) ) );
         $published =  sprintf( __( 'Publié le %s', 'Divi' ), esc_html( get_post_time( 'd/m/Y' ) ) );     
         $date = $the_modified !== $the_time ? $last_modified . ' | ' .  $published : $published; 
         return $date; }

 add_action( 'get_the_date', 'ad_last_updated_post' );
 add_action( 'get_the_time', 'ad_last_updated_post' );

See the source of this PHP code.

Once this code has been added, you will see the date of the last modification of your articles directly.

"mis à jour le"

You can of course adapt the code to your needs and change the date format or its wording. Use:

  • d/m/Y for a date such that 30/08/2019
  • d/m/y for 30/08/19
  • M j, Y for a date such that Aug 30, 2019
  • F j, Y for August 30, 2019

Others date formats are possible here.

Update of 17 September 2019: following a very good comment by David in commentary, the previous code was concerned to display the update date as soon as the publication date. David then proposes the following code so that the update date does not appear if the modification date of the article took place within 5 days following its first online date:

function ad_last_updated_post( $the_date ) {
    if ('post' === get_post_type() ) {
        $nb_days_between = (get_post_modified_time() - get_post_time())/86400;
        $nb_days_to_compare = '5';
        $last_modified =  sprintf( __( 'Mis à jour le %s', 'Divi' ), esc_html( get_post_modified_time( 'd/m/Y' ) ) );
        $published =  sprintf( __( 'Publié le %s', 'Divi' ), esc_html( get_post_time( 'd/m/Y' ) ) );
        $date = $nb_days_between > $nb_days_to_compare ? $last_modified . ' | ' .  $published : $published;
        return $date;
add_action( 'get_the_date', 'ad_last_updated_post' );
add_action( 'get_the_time', 'ad_last_updated_post' );

Thank you David 😉 !

5 - Manage metadata in Divi

Beyond adding the update date of your articles, you may need to enable or disable some other article metadata.

This will be possible from 2 different locations:

  1. The options of the Divi theme
  2. The options of the Blog module

5.1 - From the theme options

métadonnées page d'archive Divi
Set up the metadata to be displayed on the archive pages

In the Divi tab > Theme Options > Layout tab, you will find metadata display options.

Everything is detailed in this article dedicated to the Layout tab of the Divi theme options.

5.2 - From the options of the Blog module

choisir les métadonnées à afficher dans le module blog Divi
Choose the metadata to display in the Divi blog module

If you use Divi's Blog module to display your articles, you will see a whole bunch of options available.

In the module settings, go to the Content tab > Items to enable or disable the following information:

  • Image of emphasis,
  • The read more button,
  • The name of the author,
  • The date of publication,
  • The categories,
  • The number of comments,
  • The extract.

So you can decide what should appear on your blog post thumbnails.

If you have added the mention "Updated on", it will be visible if the display of the publication date is active.

6 - In conclusion....

Too bad Divi doesn't offer this option natively! But you saw in this article that it is not difficult to add an update date to your Divi articles....

Oh, I almost forgot! Here is one last little SEO tip:

The enriched search results (richs snippets) will not show the update date of your article but always the publication date.

This means that the user will not know - from the search results - that your article has been recently revised!

So why not add a small mention within the meta-description, the one you enter using the Yoast plugin?

Afficher "mis à jour le" dans la méta-description
Include the mention "updated on" in the meta-description of Yoast SEO

The user will be able to see, at first glance, that your article is recent = increase in the click rate.

This way, you will continue to generate traffic while respecting Google's recommendations.

Need more resources on Divi? Visit ElegantThemes' blog full of ideas and tutorials!

Mention "mis à jour" article Divi
Add "updated post" to Divi

You should like it too:

Responsive Design Divi : comment gérer les différentes tailles d’écran ?

Responsive Design Divi: how to manage different screen sizes?

Many users are asking the question: how can Divi's Responsive Design be optimized? Many options are available natively in Divi to enhance the design on your various screens. But sometimes you will also have to modify the Media Queries. Find out how in this complete guide!

Créez un bouton « retour vers le haut » personnalisé en quelques clics !

Create a custom "back up" button in just a few clicks!

When I tell you we can do anything with Divi! No need to code or install many plugins... You just have to know where to look: the options are there! In this article, I'll show you how to create a back-to-top button in just a few clicks!

17 Commentaires

  1. Adrien

    Article impeccable !!

    Je vais bientôt me lancer dans ces modifications sur mon site utilisant Extra de ET grâce à vous ! 🙂

    Bien vu le petit bonus dans la méta-description 😉

  2. Lycia Diaz

    Merci Adrien, il faudra tester en local pour voir si ce code fonctionne pour le thème Extra. C’est possible.
    À bientôt 😉

  3. David

    Super ce code Lycia… Par contre je pense qu’il faudrait mettre une condition :
    Ne pas afficher la date si elle est inférieur à 5 jours (plus ou moins suivant son besoin) par rapport à la date de création.
    Là par exemple, pour ton article, la date de modification est la même que la date de création, ce qui ne rend pas très bien. J’avais remarqué ça sur tous tes articles.

  4. Lycia Diaz

    Hi hi oui ! David ! C’est une très bonne idée effectivement. Mais tu as bien compris que je n’étais pas developpeuse dans l’âme… j’ai d’ailleurs cité la source du code dans l’article. Je l’ai un peu modifié mais je ne sais pas si j’arriverai à ajouter un If/Else … je serai capable de tout casser MDR !

  5. David

    Bah tu as les variables avec les valeurs des dates… Je pense qu’il est simple de faire une condition avec une comparaison… Je vais voir si j’y arrive. Je ne suis pas non plus développeur mais quand quelque chose me résiste j’y passe des fois plusieurs heures lol.

  6. David

    Bon en fait, la condition existe déjà dans la déclaration de la variable $date
    $date = $the_modified !== $the_time ? $last_modified .’ | ‘ .$published : $published;

    Explication :
    Si $the_modified n’est pas égale à $the_time alors $date = $last_modified .’ | ‘ .$published
    sinon $date = $published

    Où : (condition ? action_if_true: action_if_false;)
    Plus d’explication ici :

    Alors, pourquoi ca ne fonctionne pas… Et bien parce que la date « timestamp » remontée est brut avec les secondes, etc… du coup vu que la création du post et la publication sont espacé de plusieurs minutes, voir des heures pour certains articles (hein Lycia), ce ne sont pas les mêmes.

    Plus d’info ici :

    Il faut donc convertir les dates pour avoir un format sans les minutes et seconde qu’on peut comparer facilement.

    On peut s’apercevoir que WordPress nous mâche le travail avec une fonction qu’ils implémentent dans leur code avec la fonction esc_html comme ceci : esc_html(get_post_time(‘d/m/Y’)

    Donc voici le nouveau code :

    function ps_last_updated_post($the_date) {
    if (‘post’ === get_post_type()) {
    $the_time = esc_html(get_post_time(‘d/m/Y’));
    $the_modified = esc_html(get_post_modified_time(‘d/m/Y’));
    $last_modified = sprintf(__(‘Mis à jour le %s’, ‘Divi’), $the_modified);
    $published = sprintf(__(‘Publié le %s’, ‘Divi’), $the_time);
    $date = $the_modified !== $the_time ? $last_modified .’ | ‘ .$published : $published;
    return $date;
    add_action(‘get_the_date’, ‘ps_last_updated_post’);
    add_action(‘get_the_time’, ‘ps_last_updated_post’);

    Attention tout de même, ce code s’exécute à chaque fois que WordPress demande une date ou une heure (fonctions get_the_date et get_the_time).

  7. David

    Et voici le code pour faire de la comparaison sur plusieurs jours.
    En effet, il est intéressant de ne pas afficher la dernière modification si celle-ci s’effectue dans les 5 jours suivants… Souvent suite à des commentaires pour des fautes d’orthographe (plutôt de frappe lol), une p’tite erreur dans le code ou encore pour améliorer le contenu mais qu’on s’en est souvenu après coup.

    function ps_last_updated_post($the_date) {
    if (‘post’ === get_post_type()) {
    $nb_days_between = (get_post_modified_time() – get_post_time())/86400; // 86 400 = 60*60*24
    $nb_days_to_compare = ‘5’;
    $last_modified = sprintf(__(‘Mis à jour le %s’, ‘Divi’), esc_html(get_post_modified_time(‘d/m/Y’)));
    $published = sprintf(__(‘Publié le %s’, ‘Divi’), esc_html(get_post_time(‘d/m/Y’)));
    $date = $nb_days_between > $nb_days_to_compare ? $last_modified .’ | ‘ .$published : $published;
    return $date;
    add_action(‘get_the_date’, ‘ps_last_updated_post’);
    add_action(‘get_the_time’, ‘ps_last_updated_post’);

    Pour expliquer :

    Je récupère le timestamp des deux dates pour savoir le nombre de secondes (parce que le timestamp est exprimé en seconde) qu’il y a entre les deux afin de les soustraire entre eux…
    Sinon la soustraction n’est pas possible avec une date formé à la fransaise… Essayé de soustraire 05/08/18 à 23/06/16… Alors alors, combien de jours ? 🙂

    Après ca, je divise par 86 400 pour avoir le résultat en jour. (conversion des secondes en jours)

    Je me suis aidé ici :

    Puis je renseigne une valeur de nombre de jour souhaité pour comparaison dans la variable $nb_days_to_compare.

    Ensuite, une simple condition si le nombre de jour entre les deux dates est supérieur au nombre dans la variable $nb_days_to_compare.

    C’est cadeau, en même temps c’était pas très compliqué 😉

  8. Lycia Diaz

    Merci David ! C’est super. J’ai pas eu le temps de me pencher dessus depuis ton commentaire précédent… Merci encore !

  9. Gilles

    Merci pour ce tuto
    Comment faire pour simplement remplacer la date de publication par défaut du module Blog par la date de dernière modification ?

  10. Lycia Diaz

    Salut Gilles, tu dois juste un peu modifier le code proposé dans ce tuto pour qu’il corresponde à tes besoins.

  11. Gilles

    Ok merci mais si on veut formater la date en 2 langues différentes sur un site multilingue ?

  12. Gilles

    Merci Lycia !

  13. Adrien

    Bonjour Lycia, sais-tu comment cacher dans la description des moteurs de recherche la date d’un article, mais la conserver sur son blog ?

  14. Lycia Diaz

    Salut Adrien.
    Utilises-tu Yoast SEO ? Car dans ses paramètres, tu peux demander à ce que la date soit cachée dans les méta-descriptions.
    Mais par expérience, Google fait ce qu’il veut et même si tu désactives cette option, il peut décider d’afficher la date s’il trouve que c’est pertinent.
    C’est « Dieu » Google quoi 😉

  15. Adrien

    Bonjour Lycia, j’ai masqué la date dans les articles grâce aux paramètres d’Extra.
    Depuis, la date de publication n’apparaît plus dans les résultats de Google. 🙂

    C’est parfait pour moi. 😀

  16. Lycia Diaz

    Ah ok … je n’utilise jamais Extra donc je sais pas trop mais si ça te convient, tant mieux 😉

Soumettre un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.

Pin It on Pinterest

Share This