The custom post type (custom item type) present in Divi under the name "Projects" was designed by Elegant Themes to present the user's creations in the form of a portfolio.
As you know, there is a "classic" portfolio module and a "filterable" portfolio module; the latter allows you to sort projects by category, a very interesting feature to filter the information to be displayed.
The CPT "Projects" can therefore be used for different purposes, but its name is not always in line with the data it contains.
Also, it may sometimes be justified to want to rename it. So we'll see how we can do that.

Overview of the result after renaming the CPT "Projects".

Rename custom item type Projects in Divi

For my tutorial, I chose to rename "projects" by "vehicles", as if we had to list a fleet of cars, or classified ads for example...

As you can see on the screenshot, I have modified :

  • the name of the custom post type
  • the custom post type icon
  • category headings
  • label names

Note that the URL is also changed :  New slug for Divi's projects

How to proceed

Do you have a children's theme?

Si la réponse est positive, alors il vous suffit de copier-coller le code ci-dessous dans le fichier functions.php de votre thème enfant.
Remplacez simplement les mots “véhicules” (au pluriel) et “véhicule” (au singulier) par les termes de votre choix.

function DC_renommer_projets_divi() {

/* Renommer le custom post type */
    register_post_type( 'project',
        array(
            'labels' => array(
              'name' => __( 'Véhicules', 'divi' ),
              'singular_name' => __( 'Véhicule', 'divi' ),

        ),
        'has_archive' => true,
        'hierarchical' => true,
        'public' => true,
        'rewrite' => array( 'slug' => 'vehicule', 'with_front' => false ),
        'supports' => array(),
        'menu_icon' => 'dashicons-marker',
    ));

/* Renommer la catégorie */
    register_taxonomy( 'project_category', array( 'project' ),
      array(
        'labels' => array(
          'name' => _x( 'Catégories de véhicules', 'Catégories de véhicules', 'Divi' ),
      ),
        'hierarchical' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
    ) );

/* Renommer les étiquettes */
    register_taxonomy( 'project_tag', array( 'project' ),
      array(
        'labels' => array(
          'name' => _x( 'Étiquettes des véhicules', 'Étiquettes des véhicules', 'Divi' ),
      ),
        'hierarchical' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
    ) );

}
add_action( 'init', 'DC_renommer_projets_divi' );

To change the icon

Change the icon of the custom post type Divi Projects

You can change the custom post type icon by looking for inspiration in the WordPress Dashicons library.

  • Click on the icon of your choice then copy its "slug" (for example: dashicons-carrot on the image opposite)
  • Paste the slug on line 16 of the code above, between quotes and just after 'menu_icon' =

 

Don't you have a children's theme?

If you want to add a child theme to Divi, you can download the free Divi Community theme with some useful changes.

Si vraiment vous n’y tenez pas, je vous ai fait un mini plugin très simpliste qui vous permet d’éviter d’avoir un fichier functions.php et donc un thème enfant.
Mais vous devrez quand même modifier le code la main… 🙂 Je vous explique comment ci-dessous.

How to use this mini plugin

Install it like any plugin WordPress.
In the left-hand column, choose Extensions -> Editor.
Open the WordPress plugin editor

On the page that appears, at the top right, choose the "Rename Divi Projects" plugin from the drop-down list, then click Select.

Select a WordPress extension to edit

Faites les modifications souhaitées aux lignes 20, 21, 27, 29, 36 et 48 et cliquez en bas sur le bouton bleu Mettre à jour le fichier.
Si par mégarde vous aviez fait une erreur, un rapport s’affiche en bas de page pour vous aider à la corriger. De plus, les modifications ne s’enregistreront pas tant que l’erreur n’est pas rectifiée.

When everything is ok, refresh the page to see your changes.

The final word

Whichever method you use to rename Divi's custom post type "projects", remember to validate your permalinks by going to Settings -> Permalinks and then clicking on the blue Save Changes button. 😉