I have created a custom posts with the following code:
// Our custom post type function
function create_posttype() {
register_post_type( 'tours',
// CPT Options
array(
'labels' => array(
'name' => __( 'Tours' ),
'singular_name' => __( 'Tour' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'tours'),
'hierarchical' => true
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
function my_taxonomies_tours() {
$labels = array(
'name' => _x( 'Tour Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Tour Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Tour Categories' ),
'all_items' => __( 'All Tour Categories' ),
'parent_item' => __( 'Parent Tour Category' ),
'parent_item_colon' => __( 'Parent Tour Category:' ),
'edit_item' => __( 'Edit Tour Category' ),
'update_item' => __( 'Update Tour Category' ),
'add_new_item' => __( 'Add New Tour Category' ),
'new_item_name' => __( 'New Tour Category' ),
'menu_name' => __( 'Tour Categories' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
//'rewrite' => array('slug' => 'tours')
);
//register_taxonomy( 'tour_category', 'tours', $args );
register_taxonomy( 'tour_category', 'tours', $args );
}
add_action( 'init', 'my_taxonomies_tours', 0 );
In my permalink settings I have setup:
http://mydomainname.com.au/%category%/%postname%/
I want to display the URLs like so:
display posts in categories
http://mydomainname.com.au/tours/gbr/
http://mydomainname.com.au/tours/whitehaven-tours/
http://mydomainname.com.au/tours/day-tours/
Display posts
http://mydomainname.com.au/tours/gbr/name-of-post
http://mydomainname.com.au/tours/whitehaven-tours/name-of-post
http://mydomainname.com.au/tours/day-tours/name-of-post
But I’m currently getting the following URLs:
display posts in categories
http://mydomainname.com.au/tour_category/gbr/
http://mydomainname.com.au/tour_category/whitehaven-tours/
http://mydomainname.com.au/tour_category/day-tours/
Display posts
http://mydomainname.com.au/tours/name-of-post
http://mydomainname.com.au/tours/name-of-post
http://mydomainname.com.au/tours/name-of-post
I am not familiar enough with URL rewrites to make the necessary changes. I have read many articles but getting nowhere fast. Any help in the right direction would be greatly appreciated.