How do you create %post_type%/%postname%/ permalink structure?
This is what is not working:
eg. ( domain.com/blog/ ) -> "click on post" -> ( domain.com/post-name )
How do I make "blog post" permalinks work like this...
eg. ( domain.com/blog/ ) -> "click on post" -> ( domain.com/blog/post-name )
Although other custom post types work?...
eg. ( domain.com/portfolio/ ) -> "click on portfolio piece" -> ( domain.com/portfolio/project )
Also, should I reflush the Permalinks?
Here is the Custom Post Types code & Taxonomies code in my functions.php file:
// Add Custom Post Type "Portfolio"
register_post_type('portfolio', array( 'label' => 'Portfolio',
'description' => '',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'portfolio'),
'query_var' => true,
'supports' => array('title',
'revisions',),
'taxonomies' => array('Portfolio Category',),
'labels' => array (
'name' => 'Portfolio',
'singular_name' => 'Project',
'menu_name' => 'Portfolio',
'add_new' => 'Add Project',
'add_new_item' => 'Add New Project',
'edit' => 'Edit',
'edit_item' => 'Edit Project',
'new_item' => 'New Project',
'view' => 'View',
'view_item' => 'View Portfolio Piece',
'search_items' => 'Search Portfolio',
'not_found' => 'No Portfolio Pieces Found',
'not_found_in_trash' => 'No Portfolio Pieces found in Trash',
'parent' => 'Parent Project',
),) );
// Add Custom Post Type "Testimonials"
register_post_type('testimonials', array(
'label' => 'Testimonials',
'description' => '',
'public' => true,'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => ''),
'query_var' => true,
'supports' => array('title',
'revisions',),
'labels' => array (
'name' => 'Testimonials',
'singular_name' => 'Testimonial',
'menu_name' => 'Testimonials',
'add_new' => 'Add New',
'add_new_item' => 'Add New Testimonial',
'edit' => 'Edit',
'edit_item' => 'Edit Testimonial',
'new_item' => 'New Testimonial',
'view' => 'View',
'view_item' => 'View Testimonial',
'search_items' => 'Search Testimonials',
'not_found' => 'No Testimonials Found',
'not_found_in_trash' => 'No Testimonials Found in Trash',
'parent' => 'Parent Testimonial',
),) );
//Add Taxonomy for Portfolio Category
add_action( 'init', 'portfolio_create_taxonomies', 0 );
function portfolio_create_taxonomies()
{
//Porfolio Category
$portfolio_labels = array(
'name' => _x( 'Portfolio Category', 'taxonomy general name' ),
'singular_name' => _x( 'Portfolio Category', 'taxonomy singular name' ),
'search_items' => __( 'Search in portfolio category' ),
'all_items' => __( 'All portfolio categories' ),
'most_used_items' => null,
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit portfolio category' ),
'update_item' => __( 'Update portfolio category' ),
'add_new_item' => __( 'Add new portfolio category' ),
'new_item_name' => __( 'New portfolio category' ),
'menu_name' => __( 'Portfolio Categories' ),
);
register_taxonomy('portfolio-category',array('portfolio'),array(
'hierarchical' => true,
'labels' => $portfolio_labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => 'portfolio-category')
));
}
EDIT: I think this problem is occuring because of a template heirachy issue the blog page is using "index.php" when it should be using "template-blog.php" file.
functions.php
? or are you referring to just a category? I have a custom post type registered for contributors, and have an author as a post under that custom post type. So my URL reads www.example.com/contributor/author. That's how permalinks are setup when using custom post types with the permalink structure set to just %postname%