Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

stevecoy on "Category permalinks with custom post types"

$
0
0

I have a custom post type, Videos. It uses standard WP taxonomies (categories, tags).

$videoargs = array(
		'labels' => $labels,
		'public' => true,
		'publicly_queryable' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'query_var' => true,
		'rewrite' => array('slug' => 'video', 'with_front' => 'false'),
		'has_archive' => 'videos',
		'hierarchical' => false,
		'capability_type' => 'post',
		'menu_position' => 20,
		'menu_icon' => $icon,
		'taxonomies' => array('category'),
		'supports' => array('title','thumbnail','excerpt','comments')
	  ); 

	register_post_type( 'li_video', $videoargs);

The archive page for viewing all videos is at mysite.com/videos, using theme file archive-li_videos.php. I would like to be able to view different categories, showing videos only, at a URL like this:

mysite.com/videos/my-category-name
OR
mysite.com/videos/category/my-category-name

I know this is possible, because I've seen a plugin do it, but said plugin has really huge architecture and I can't figure it out.

I know I could easily pass a query string parameter like mysite.com/category/my-category-name?view=videos and alter the query parameters accordingly, but I'd like to avoid this. I also do not want to register a separate taxonomy for my custom post type, because then users will have an extra thing to keep track of. And it seems like this is doable.

Thanks for your help!


Viewing all articles
Browse latest Browse all 8245

Trending Articles