You need to register you post type with the has_archive
argument to get an archive page at /<post_type_slug>/
.
Eg.
<?php
add_action('init', 'wpse70469_register');
function wpse70469_register()
{
$args = array(
'rewrite' => array("slug" => "vita"),
'show_in_nav_menus' => true,
'has_archive' => true, // this makes the archive page work.
);
register_post_type('wpse70469_type', $args);
}
You might want read through the arguments for register_post_type
. You also don’t need to include query posts like that. WordPress will setup the correct post type and status based on the current request — no need to do that manually.
Related Posts:
- How do I get the permalink of a custom post type?
- Row actions for custom post types?
- How to set parent-child relationship between differents custom post types
- Add Custom Fields to Custom Post Type RSS
- Add content in custom post type page after the title and before columns
- get attachments for all posts of particular post type
- Check if a custom taxonomy archive page is being displayed
- Count posts or custom post types from last 24 hours (or from today)
- title_save_pre on post publish
- How to add a post from a custom post type as the static page?
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- Using Custom Meta Capabilities on Custom Post Type
- Separating Search Results By Post Type
- Assigning a role to a specific custom post type (and ignoring other post types)
- How can I programmatically save data into custom fields that contain serialized data?
- Displaying custom post type on front page
- Custom Post Types: Custom columns with Title submenu?
- Custom Role can’t trash Custom Post Type
- Remove “Get Shortlink” button in admin of custom post type
- register multiple post types on one menu entry
- current-menu-item class for custom post type parent
- Changing sort order with pre_get_posts using is_post_type_archive doesn’t change category pages
- how to add extra GET parameters to post to url with add_rewrite_rule?
- How to use the Display Name as the post title in a custom post type?
- Removing parent slug in hierachial custom post type
- Open Custom Post Type as PDF
- get_posts() with custom post type does not work outside page.php
- CPT + CMB2: data not displaying for only first post in loop
- Create a clone from one WordPress site to another in a few minutes
- Custom Post Type uses Custom Tags in add_filter?
- Custom post type not displaying content from single-{custom post type} page
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- How do I move/order posts with a tag to the end?
- Front custom edit post page for each post
- WP CPT Custom Sortable Column in Admin Dashboard Sort Order Random
- Get taxonomy values based on wp_query results
- Custom WP Query on custom meta and sort by multiple meta keys value
- Post ID randomly printing on page
- Why does my content disapear when I make a page to match an archive name?
- Including taxonomy term before post type breaks top level pages
- Correct procedure for advanced permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- How do i search authors from search form using author’s name
- Custom permalinks rules don’t match and lost of query var in the process
- How can I set the page template of a new custom post type post?
- Suggestion on custom post type/ taxonomy relationship
- Querying custom post type twice on same page
- How to Create Template File for Parent Page of Custom Post Type
- wp_insert_post wrong post type [closed]
- WordPress Picks Up Wrong Template for Custom Post Type Archive Page
- How to hyperlink content from archive page with custom post-type
- List of all entries of custom-post-type: Add year-parameter?
- Should I use custom taxonomies or not?
- get comments by current user inside page template
- get parent content inside child posts
- custom post type problem
- Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?
- List Custom Post Types in Admin Dashboard
- CPT Archive pre_get_posts not working?
- wp_editor for custom post type doesn’t save value
- Hide text if query has no posts
- Am I mixing up the concept of posts pages and categories?
- Writing a custom Glossary plugin
- How to achieve a multi-taxomony layout with posts?
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- Displaying all posts by category and showing content on click
- Custom post type and custom taxonomy key lenght & query performance
- Feature image Gallery made from Custom Post type + Categories
- Custom post type in slider front page Breaking layout
- register_rest_field update_callback don’t work for $_FILES
- Getting data from dynamically allocated metaboxes within a custom post
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- Custom permalink with custom taxonomies for custom post type
- Meta query broken since 4.7.4 Update
- Custom post type , page template not grabbing the page template
- Can I organise my custom post types by page?
- Problem to get the link of the default ‘post’ post type like the orther custom types
- Best Plugins for Complex Index of Resources [closed]
- How Can a CPT in WordPress have a page 2 without an error?
- Get the custom post type slug but remove the rewrite prefix?
- Remove sequential number from permalinks
- custom post type archive slug vs. custom page template
- WordPress loop for multiple custom post types
- Custom Post Types in plugins?
- how to add pagination and post query in taxonomy-taxonomy-term.php? [duplicate]
- Pagination not working with custom loop
- How to bring custom meta boxes to custom post types?
- Custom role, capabilities, and post type: preview button wrecks things
- Most efficient way of deleting post
- Problem with menu categories doubling up when updating database?
- Noob Loop Question
- Custom Post Type fields not showing in dashboard
- Switched server & domain name, now custom post types won’t save
- Display one post based on ID from $_GET
- Display associated taxonomy child name on single CPT page
- Custom Post Type to Plugin
- How to query posts by category with the_title();
- Get images only from a certain post type
- get_the_post_navigation not working
- Sort ACF by custom taxonomy