Tag Info

Hot answers tagged

7

If we peek into the global $wp_taxonomies variable we see the associated object types. There might be better ways to do this or even core functions, but you could try the following: function wpse_172645_get_post_types_by_taxonomy( $tax = 'category' ) { global $wp_taxonomies; return ( isset( $wp_taxonomies[$tax] ) ) ? ...


5

You can do the reverse with get_object_taxonomies. Combine it with get_post_types to iterate over post types to check the taxonomies registered for each. EDIT- Here's an example that produces the same output as @birgire's function, without using dirty globals. function wpse_172645_get_post_types_by_taxonomy( $tax = 'category' ){ $out = array(); ...


1

You should be using a tax_query for this operation. The category parameters won't work with custom taxonomies Instead of 'category' => $catID, use 'tax_query' => array( array( 'taxonomy' => 'series', 'field' => 'term_id', 'terms' => $catID, ...


1

The first section of this question have been answered before. Basically, there are no index pages for archives, and there never will be. For a complete explanation, feel free to check this post I have recently done on this subject. Why did wordpress think that is post_name and post type is post? You might or might not know this, but Wordpress uses ...


1

WordPress allows to do this rather neatly for pages, supporting page-$slug.php and page-$id.php templates in hierarchy. Unfortunately it doesn't apply to posts and Custom Post Types. So your options are either handling this inside single-services.php (in one file, or by further including other template files) or adjusting hierarchy to use custom templates ...



Only top voted, non community-wiki answers of a minimum length are eligible