You may want to rename the Projects post type to better reflect the content it represents.
However, there is no default option for that. You must use a plugin like DiviFlash or a custom code snippet. Using DiviFlash will be the easiest solution, as it includes an extension for renaming the Projects post type.
In this article, we will show you how to rename the Projects post type in Divi using both a plugin and a code snippet.
Method 1: Rename Projects Post Type in Divi Using DiviFlash
DiviFlash offers the most simplest way to rename projects custom post type with its newly added extension.
Here is how to do it:
- Install and activate the DiviFlash plugin.
- Navigate to WordPress dashboard > DiviFlash > Settings.
- Find out “Rename Projects Custom Post Type” and turn it on. After enabling, you will see these options that you can edit:
- Singular Name
- Plural Name
- Slug
- Category Slug Name
- Tag Archive Name
- Upload a Post Type Icon
These options let you fully personalize the Projects post type with ease.
- Next, update your permalink to ensure the new names and slugs are applied correctly. For that,
- Go to WordPress Dashboard > Settings > Permalinks
- Save Changes to ensure your website’s URLs are up-to-date. (You don’t have to make any changes in the permalink settings)
As an example, we renamed the project names to ‘Development’ on our demo site.
Method 2: Rename Projects Post Types in Divi with Code Snippet
While DiviFlash offers a convenient solution, you can also achieve the same result using a custom PHP code snippet. This method requires a basic understanding of coding.
Here is how to rename projects custom post type in Divi using code snippet:
- Go to WordPress dashboard > Appearance > Theme File Editor
- Locate and click on the “functions.php” file from the list of theme files.
- Scroll to the bottom of the functions.php file and paste the following PHP code:
// Function to rename the Divi "Project" post type to "Development" and change its slug
function rename_divi_project_post_type( $args, $post_type ) {
// Check if the current post type is 'project'
if ( 'project' === $post_type ) {
// Define the new labels for the post type
$labels = array(
'name' => 'Development', // The general name for the post type (plural)
'singular_name' => 'Development', // The singular name for a single post of this type
'add_new' => 'Add New Development', // Label for adding a new post
'add_new_item' => 'Add New Development', // Label for the "Add New" page title
'edit_item' => 'Edit Development', // Label for the "Edit Post" page title
'new_item' => 'New Development', // Label for a newly created post
'view_item' => 'View Development', // Label for viewing a post
'search_items' => 'Search Developments', // Label for the search box text
'not_found' => 'No Developments found', // Label displayed when no posts are found
'not_found_in_trash' => 'No Developments found in Trash', // Label when no posts are found in the trash
'all_items' => 'All Developments', // Label for the "All Posts" menu item
'menu_name' => 'Developments', // Label for the post type menu in the admin dashboard
'name_admin_bar' => 'Development', // Label in the admin bar when editing/viewing a post
);
// Merge the new labels with the existing arguments for the post type
$args['labels'] = array_merge( $args['labels'], $labels );
// Modify the slug and make it rewrite properly
$args['rewrite'] = array(
'slug' => 'development', // New slug for the custom post type
'with_front' => true, // Whether the permalink structure should be prepended with the front base
'pages' => true, // Whether to add pagination support for the post type
'feeds' => true, // Whether to add feeds support for the post type
);
}
// Return the modified arguments
return $args;
}
// Hook the function into 'register_post_type_args' to modify the post type arguments
add_filter( 'register_post_type_args', 'rename_divi_project_post_type', 10, 2 );
We renamed the “Projects” post type to “Developments.” If you would like to change it to something else, simply update the labels and slug in the code. Replace all instances of “Developments” with your preferred name and adjust the slug accordingly.
- Click the “Update File” to save your changes.
That’s it! Your “Projects” post type will now be renamed according to the changes you made in the code snippet. However, don’t forget to update the permalinks by going to Settings > Permalinks and clicking Save Changes.
Conclusion
Now you know how to rename the project post type in Divi using two different methods. Among these, the first method, using DiviFlash, is the ideal solution, as it comes with a built-in extension.
However, if you have good coding knowledge, you can also go for the code snippet method as well.
Ultimately, the choice is yours.
No matter which method you follow, make sure to update the permalink settings after renaming the project post type.
0 Comments