How to add Custom Taxonomies to Pages?
-
Hi, I created taxonomies (Books and Movies) they now appear below the Categories on the Post page but is it possible to show these taxonomies on the Pages as well?
I found a code to show Categories and Tags using:
function add_taxonomies_to_pages() { register_taxonomy_for_object_type( 'post_tag', 'page' ); register_taxonomy_for_object_type( 'category', 'page' ); } add_action( 'init', 'add_taxonomies_to_pages' ); if ( ! is_admin() ) { add_action( 'pre_get_posts', 'category_and_tag_archives' ); } function category_and_tag_archives( $wp_query ) { $my_post_array = array('post','page'); if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) ) $wp_query->set( 'post_type', $my_post_array ); if ( $wp_query->get( 'tag' ) ) $wp_query->set( 'post_type', $my_post_array ); }
But I don’t know how to add Custom taxonomies…
Thanks for your help!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to add Custom Taxonomies to Pages?’ is closed to new replies.