1
votes

I've created a custom post type "Portfolio" in my wordpress site and also I've created a category section for this custom post type with category slug "port-cate".

The permalinks to the "Portfolio" posts are like this:

mysite.com/portfolio/post-name/

but the category url is

mysite.com/port-cate/category-slug/

my question is: How can I create the category url for this post type like

mysite.com/portfolio/category/category-slug/

Please help me.

2

2 Answers

0
votes

You can accomplish this by setting up Custom Taxonomies along with your Custom Post type. You also might need to do some renaming to your custom-post type vs. custom taxonomy to get things to work the way you would like. here's a quick example:

 // PORTFOLIO TAXONOMY
  register_taxonomy( 'portfolio', 
    array('images'), /* This is the name of your custom post type, I used "Images" */
    array('hierarchical' => true,     /* if this is true it acts like categories */             
        'labels' => array(
             /* OPTIONS */
        ),
        'show_ui' => true,
        'query_var' => true,
    )
);   

This will create a new metabox in your custom post type's edit screen, you can create "Portfolio" taxonomies on the fly. and the links would looks something like this:

mysite.com/portfolio/new-portfolio-slug/

Here is the list of options available for your taxonomy http://codex.wordpress.org/Function_Reference/register_taxonomy and an independent article that may help you further http://someweblog.com/wordpress-custom-taxonomy-with-same-slug-as-custom-post-type/

Hope this helps.

0
votes

Try this plugin http://wordpress.org/extend/plugins/cat-post-type/

You can select your custom post by catgory and type