Nejak tomu nerozumim, nechapu souvislosti...
mam vlastni theme a ve functions.php definuji custom_type
add_action('init', 'testimonials_register');
function testimonials_register() {
$labels = array(
'name' => _x('Testimonials', 'post type general name'),
'singular_name' => _x('Testimonial', 'post type singular name'),
'add_new' => _x('Add New', 'testimonials item'),
'add_new_item' => __('Add New Testimonial'),
'edit_item' => __('Edit Testimonial'),
'new_item' => __('New Testimonial'),
'view_item' => __('View Testimonial'),
'search_items' => __('Search Testimonials'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
//'menu_icon' => get_stylesheet_directory_uri() . '/images/testimonials.png',
'has_archive' => true,
'rewrite' => array( 'slug' => 'testimonials'),
'capability_type' => 'post',
'menu_position' => 6,
'supports' => array('title','editor')
);
register_post_type( 'testimonial' , $args );
}
Pak mam pro tento take vlastni taxonomy - viz:
add_action('init', 'testimonial_categories_register');
function testimonial_categories_register() {
$labels = array(
'name' => 'Testimonial Categories',
'singular_name' => 'Testimonial Category',
'search_items' => 'Search Testimonials Categories',
'popular_items' => 'Popular Testimonial Categories',
'all_items' => 'All Testimonial Categories',
'parent_item' => 'Parent Testimonial Category',
'edit_item' => 'Edit Testimonial Category',
'update_item' => 'Update Testimonial Category',
'add_new_item' => 'Add New Testimonial Category',
'new_item_name' => 'New Testimonial Category',
'separate_items_with_commas' => 'Separate testimonial categories with commas',
'add_or_remove_items' => 'Add or remove Testimonial Categories',
'choose_from_most_used' => 'Choose from most used Testimonial Categories'
);
$args = array(
'label' => 'Testimonial Categories',
'labels' => $labels,
'public' => true,
'hierarchical' => false,
'show_ui' => true,
'show_in_nav_menus' => true,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => array( 'slug' => 'testimonial/categories', 'with_front' => false ),
'query_var' => true
);
register_taxonomy( 'testimonial_categories', 'testimonial', $args );
}
Snazim, se vytvorit template archive-testimonial.php, ktery by mi vylistoval vsechny posty v testimonials a byl na adrese domain.com/testimonials - ale at delam co delam vysledek je 404