I use the Divi Theme for a Wordpress website. At the moment, everything in Projects Custom Post, have the same url in the following format:
www.mywebsite.com/projects/project-name
What I tried to do is to change the projects
to a more dynamic name based on the category a project belongs. I know that I can just create a few more custom posts, but I prefer to keep it like this.
I tried to change the permalink settings to /%category%/
but then my projects didn't work with either of the two versions.
I tried also this way, but it just changes to a new static name, without the category dynamic url:
<?php
function custom_post_name () {
return array(
'feeds' => true,
'slug' => 'anewname',
'with_front' => false,
);
}
add_filter( 'et_project_posttype_rewrite_args', 'custom_post_name' );
?>
Is there any advice to achieve this or I should turn to different custom posts?
Example:
I have two projects (a custom post type of divi theme) with the categories: foods
and drinks
. At the moment, the url of them are the following
- www.mydomain.com/projects/foodexample1
- www.mydomain.com/projects/drinkexample2
I want to make them as:
- www.mydomain.com/foods/foodexample1
- www.mydomain.com/drinks/drinkexample2