Divi is a fantastic theme and as you can guess it is one of my favourite themes for quickly designing almost any kind of website with WordPress. Divi comes with a projects custom post type which allows you to display posts in the portfolio module using the Divi builder.

The drawback to the projects custom post type is that not all websites are going to have portfolios as such but still want to utilise the additional post type.

While building a site for a client recently we used the portfolio post type to add tours to a tour guide website. We needed to change the post type slug but also wanted to change the admin menu labels so I wrote this short function that you can use to do the same.

function adamhaworth_divi_project() {
	register_post_type( 'project',
		array(
			'labels' => array(
			'name' => __( 'Tours', 'divi' ),
			'singular_name' => __( 'Tour', 'divi' ),
		),
		'has_archive' => true,
		'hierarchical' => true,
		'public' => true,
		'rewrite' => array( 'slug' => 'tour', 'with_front' => false ),
		'supports' => array(),
	));
}
add_action( 'init', 'adamhaworth_divi_project' );

You can place this function in the functions.php of your child theme or better still use a plugin such as ‘My Custom Functions’ to easily add the function from within your dashboard. All you need to do is replace ‘Tour’, ‘Tours’ and ‘tour’ with your own name, be careful when changing the slug, ensure you aren’t already using the slug on another page or post.

Once you have added this function you will need to go to permalinks in settings and just click ‘Save’, this will flush the permalinks so your new slug will be used on your custom post type.

Looking to start using Divi? Try CloudCanvas, Divi comes included with CloudCanvas along with everything else you need to start your WordPress website.

Pin It on Pinterest