Custom post types taxonomy
-
Hi!
I’ve got totally stuck.Ok, so I’ve made a custom post types and sat up it’s own taxonomy. So far so good. But now, when I enter it’s categories’ archive page, I just get a 404 telling me that page doesn’t exist.
Here’s the code I’ve added for the taxonomy and custom post types:
add_action( 'init', 'create_faq_taxonomies', 0 ); // create two taxonomies, genres and writers for the post type "book" function create_faq_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Kategori', 'taxonomy general name' ), 'singular_name' => _x( 'Kategori', 'taxonomy singular name' ), 'search_items' => __( 'Sök kategori' ), 'all_items' => __( 'Alla kategorier' ), 'parent_item' => __( 'Förälder' ), 'parent_item_colon' => __( 'Förälder:' ), 'edit_item' => __( 'Redigera' ), 'update_item' => __( 'Uppdatera kategori' ), 'add_new_item' => __( 'Lägg till kategori' ), 'new_item_name' => __( 'Nytt namn' ), 'menu_name' => __( 'Kategori ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'faq' ), ); register_taxonomy( 'faq', array( 'x_faq' ), $args );///////////////////////////////////////////////////
function create_post_types() { register_post_type( 'x_faq', array( 'labels' => array( 'name' => __( 'FAQ', 'x_faq' ), 'singular_name' => __( 'FAQ', 'x_faq' ), 'add_new' => __( 'Skapa ny', 'x_faq' ), 'add_new_item' => __( 'Skapa ny FAQ', 'x_faq' ), 'edit' => __( 'Redigera', 'x_faq' ), 'edit_item' => __( 'Redigera FAQ', 'x_faq' ), 'new_item' => __( 'Ny FAQ', 'x_faq' ), 'view' => __( 'Visa FAQ', 'x_faq' ), 'view_item' => __( 'Visa FAQ', 'x_faq' ), 'search_items' => __( 'Sök FAQ', 'x_faq' ), 'not_found' => __( 'Hittade ingen FAQ', 'x_faq' ), 'not_found_in_trash' => __( 'Hittade ingen FAQ i papperskorgen', 'x_faq' ), 'parent' => __( 'Förälder', 'x_faq' ), ), 'description' => __( 'Skapa en FAQ.', 'x_faq' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'menu_position' => 11, 'hierarchical' => true, 'query_var' => true, 'supports' => array ( 'title', //Text input field to create a post title. 'editor', 'thumbnail' ) ) ); } } add_action( 'init', 'create_post_types' ); // register post typeIs there anybody out there who knows why this happens? Happy if someone please could help me out here.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Custom post types taxonomy’ is closed to new replies.