I generally include this chunk of code with my custom post types:
// Load the custom post type archive page template
add_filter( 'archive_template', 'posttype_archive_template' ) ;
function posttype_archive_template( $archive_template ) {
global $post;
if ( is_post_type_archive ( 'posttype' ) ) {
if(file_exists(PLUGIN_PATH. '/archive-posttype.php'))
$archive_template = PLUGIN_PATH. '/archive-posttype.php';
}
return $archive_template;
}
Related Posts:
- Meta query with boolean true/false value
- Why does my custom WP role need edit_posts to edit images?
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- How to filter by custom post type on Gutenberg “Latest Posts’ block
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Two Custom Post Types, Share Two Taxonomies
- Multisite wide post type?
- How to list/show all custom post types regardless of category?
- Remove CPT slug from URL
- How to sort a table of custom posts by column containing custom field
- I have a CPT that have menu_order enabled, how can I make the menu_order values unique so it won’t have duplicates
- WordPress metabox file upload in custom post [duplicate]
- tags & categories with custom post type
- Querying Posts by Taxonomy From Alternate Network Site
- working Custom Post Type and Widget code no longer works when moved from functions.php to plugin
- Archive filter disappears on no results?
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- How do I display custom post types through a common taxonomy?
- How do you remove slug altogether from custom post type?
- How-to leverage WordPress for creating Extended Social Profiles
- Add custom post type to Backbone collections
- pagination redirecting from page number url before page requested
- Get all of user’s custom post types in WP Admin for plugin
- Does anyone have a plugin that could automatically tag custom post types in wordpress?
- WordPress or Drupal for data-heavy content site
- Stop / prevent WordPress from updating permalinks of custom post type
- WP_Query: include custom post type only with specific meta value
- Relative URLs for a particular custom post type?
- Custom Post type in Author.php
- How can I dynamically add a post to a custom post type which uses a custom field?
- get_comments not working on custom post types
- Custom Post hierarchical to custom taxonomy
- How can we take into account post types when constructing permalinks?
- Posts Categories Are Showing In The Custom Post Type Category
- ACF From & To Date Validations
- Displaying all taxonomies without custom posts?
- WordPress showing archive.php instead page
- Query Multiple Custom Posts by Custom Fields
- Modification of how the data is controlled/showed and stored
- Displaying Custom Posts on a Page
- WordPress Custom Post Type is not working properly
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- Page not found for custom post type UI plugin and taxonomy
- How to Get the title of a custom field?
- Loop for custom post types filtered by a taxonomy
- Ordering Submenu Pages in WP 3.1
- Displaying custom post types by category
- Disable custom taxonomy on admin bar
- How to inherit field value from parent post into in child / sub post
- how to show records that don’t have custom meta value
- One Custom post type 404’s others don’t
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- how to get this tax_query working?
- Want a custom query with just one category but from all custom post types
- WordPress CPT custom custom label
- How do you output an unknown number of images in a custom post type with desired markup?
- Custom post type’s posts are not showing anywere but in xml sitemap
- I want to fetch custom post data based on it’s id i fetch from select drop down [closed]
- If Post type use sidebar (‘tree’)
- Using Image Sizes for Custom Post Types outside the Loop
- link featured image to external link
- How should I structure complex content hierarchies?
- Querying two different post types with the same taxonomony
- How to add page under a custom post type?
- Modify a plugin function output from another plugin
- Redirect to URL if x number of days passed
- Yelp-style geographic directory plugin?
- Modifying search results based on post_type
- WordPress general content best pratices
- Stop displaying Permalink
- Custom post type template – add banner under heading
- Enforcing a rigid reusable template structure for similar posts?
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- How can i redirect click to new admin page not to edit screen in post table
- How to get current post type?
- How to convert Post Object Custom Field into Tags
- Shortcode and get_template_part
- Custom post pagination not working
- Two and more diffrent custom page type in one permalink
- Page as parent for CPT and other pages
- Set a static page as a user profile page?
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Different taxonomy.php for different custom post types
- How to keep a CPT stick to specific position?
- Meta box not saving
- Shortcode display CPT Query only showing 1 post?
- Default taxonomy ‘post_tag’ added to CPT managing by custom role : nothing in the metabox
- Query stopped working
- Strange behaviour using 3.8.1
- Setting a custom $query->query_vars[‘meta_key’] breaks the WordPress menu
- Filtering in admin broken for custom post type in 3.8.1?
- Get Registered Custom Post Type to get All Custom Taxonomies
- Repeatable Custom Field for Media Upload
- how to show perticular category posts in custome page
- Custom Post Types and 404 Pages
- Bulk update custom post types
- Is there any way of not using my_init_method in the following code (that creates a custom post type)?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Adding a custom field after post title (ex.Example Title [30 Second Read])