I am trying to create archives page for my custom post types but it is going to a default archive page not the archive page which i have created for archives
Here is my code for custom post type
// Register Custom Post Type
function gallery_post_type() {
$labels = array(
'name' => _x('Gallery images', 'Post Type General Name', 'horst'),
'singular_name' => _x('Gallery image', 'Post Type Singular Name', 'horst'),
'menu_name' => __('Photo Gallery', 'horst'),
'name_admin_bar' => __('Photo Gallery', 'horst'),
'archives' => __('Item Archives', 'horst'),
'parent_item_colon' => __('Parent Photo:', 'horst'),
'all_items' => __('All Photos', 'horst'),
'add_new_item' => __('Add New Photo', 'horst'),
'add_new' => __('Add New Gallery image', 'horst'),
'new_item' => __('New Photo', 'horst'),
'edit_item' => __('Edit Photo', 'horst'),
'update_item' => __('Update Photo', 'horst'),
'view_item' => __('View Photo', 'horst'),
'search_items' => __('Search Photos', 'horst'),
'not_found' => __('Not found', 'horst'),
'not_found_in_trash' => __('Not found in Trash', 'horst'),
'featured_image' => __('Gallery Image', 'horst'),
'set_featured_image' => __('Set Gallery image', 'horst'),
'remove_featured_image' => __('Remove Gallery image', 'horst'),
'use_featured_image' => __('Use as Gallery image', 'horst'),
'insert_into_item' => __('Insert into item', 'horst'),
'uploaded_to_this_item' => __('Uploaded to this Photo', 'horst'),
'items_list' => __('Photos list', 'horst'),
'items_list_navigation' => __('Photo list navigation', 'horst'),
'filter_items_list' => __('Filter Photo list', 'horst'),
);
$args = array(
'label' => __('Gallery image', 'horst'),
'description' => __('gallery imges for gallery page', 'horst'),
'labels' => $labels,
'supports' => array('title', 'thumbnail',),
'hierarchical' => true,
'taxonomies' => array(
'gallery_categories',
),
'rewrite' => array(
'slug' => 'gallery',
),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-format-gallery',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
);
register_post_type('gallery', $args);
}
add_action('init', 'gallery_post_type');
and this is my custom taxonomy
// Register Custom Taxonomy
function custom_taxonomy() {
$labels = array(
'name' => _x( 'Gallery Maps', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Gallery Map', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Gallery Maps', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'parent_item' => __( 'Parent Item', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'new_item_name' => __( 'New Item Name', 'text_domain' ),
'add_new_item' => __( 'Add New Item', 'text_domain' ),
'edit_item' => __( 'Edit Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'view_item' => __( 'View Item', 'text_domain' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ),
'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ),
'popular_items' => __( 'Popular Items', 'text_domain' ),
'search_items' => __( 'Search Items', 'text_domain' ),
'not_found' => __( 'Not Found', 'text_domain' ),
'no_terms' => __( 'No items', 'text_domain' ),
'items_list' => __( 'Items list', 'text_domain' ),
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'gallery_categories', array( 'gallery' ), $args );
}
add_action( 'init', 'custom_taxonomy');
I don't know where am i doing wrong?
archive-posttype.php
as the template name?