If you’re adding a custom query within the template to load posts, the post type of that page doesn’t have to be your custom post type. You can create a plain vanilla page
, create a template for that via page-your_page_slug.php
, or via a custom template assigned in the templates dropdown, then query for whatever post type you want via WP_Query
.
EDIT – here’s an example using the single_template
filter. you’ll have to change the post type and slug to match yours.
function wpa_single_cpt_template( $templates="" ){
$single = get_queried_object();
if( 'myCPT' == $single->post_type
&& 'my-special-slug' == $single->post_name )
$templates = locate_template( 'my-special-template.php', false );
return $templates;
}
add_filter( 'single_template', 'wpa_single_cpt_template' );
adapted from the example on Template Hierarchy: Filter Hierarchy.
Related Posts:
- Page Template as Custom Post Type Archive
- Custom Post Type – Archive page title
- How to make an archive page displaying posts in a date range
- Editable content on a Custom Archive page
- Custom Page that comes with preloaded content for the user
- Adding the_content() in custom template email
- Custom URL redirect in WP
- How to integrate single and archive templates for custom post type in any WordPress theme
- How to get the current category with custom posts
- WordPress Page hierarchy ( parent is singular of custom post types slug ) is returning not found
- Displaying posts inside table having issues
- Building Link List for Custom Tax
- Show index and not the archive for “Dog Custom Post” with default slug
- Templates list in “Page Attributes” metabox is inaccurate
- Create template for taxonomy results limited by Custom Post Type
- How should I structure my post types?
- Extending AZIndex plugin to use custom post types and custom taxonomies
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- will post_id ever change? Can I safely use post_id for custom queries?
- List custom taxonomy specific to one custom post type
- Define new user capability for custom post types?
- How to use has_archive but disable feed per post type?
- How to allow visitors to enter custom post type?
- Is it possible to create relational metabox values in a custom post?
- Custom Post Type Query for Sidebar Doesn’t Work on Front Page
- Meta query for custom post type ignored in main query
- Custom post type: Disable single page, but keep archive
- WordPress post_where & posts_join not working only for custom post type
- 2 Templates 1 custom post type according url
- How do I move/order posts with a tag to the end?
- changing meta value and meta key of price field
- WordPress sort search results by custom order
- Use Custom Post Type archive page for the taxonomies term archive page
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Display custom post type category, while in a CPT category, then the posts beneath
- Hide parent categories when clicked, and show it’s childs
- Custom Path/Folder behind a custom post type
- Time based access control of custom post types – what is good approach?
- Show titles, date of all posts on single category page
- delete_published_posts does not work
- redirect automatic page that serves custom posttype content
- How to start a new post with custom Taxonomies already set?
- Adding sidebar to template creates horizontal gap the size of the side bar
- WordPress showing archive.php instead page
- WooCommerce sort products by the actual product width(not the shipping width)
- How to render a custom post type template with custom fields using shortcode
- Create a custom php page and load it at a specific slug
- Structure of data : CPT + terms
- Single post with a Custom Post Type returns 404, when archives of the CPT work correctly
- How to handle paged param in post and custom-post-type?
- CPT archive admin menu label
- Number of Custom Post Types published are not being shown in the custom page
- Default text in a specific post type, but not visible?
- Update postmeta Parent when post_status child change
- Custom post type archive page blank
- WP_Query custom post type query not showing the exact post type
- Custom Post Type has_archive
- Custom Post Type Archive URL is wrong
- Creating a Custom Post Type
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Custom Post Type slug same as page name
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- How to display custom post in archive section of the wordpress page?
- Content Editable CPT Archive?
- list archives per post types
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- A form that can save/edit after first input
- Show Custom Post Type meta boxes only on Page Edit
- Creating a Page Template to display all items from a Custom Post Type
- Canonical url differs from custom post type archive URLs
- Cannot save CPT meta box
- non-hierarchical post type with hierarchical url structure
- Filter widget outputs
- Why does my content disapear when I make a page to match an archive name?
- Send notification to the admin when new custom post is submitted
- Display a custom posts page for post type
- How do i search authors from search form using author’s name
- Custom post type archive pagination 404
- Allow users to create posts without logging in?
- posttype/taxonomy/term archive page 404 error
- How to add attributes to taxonomies that may be different from post to post?
- Pages are not saving due to custom post type
- Is it possible to have a custom post type with feed but without the archive?
- Custom Post Type Template Alternative
- Migrating a taxonomy’s tags to the native category
- General advice on addressing content-centric pages
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- Fields for different parts of a page
- next_/previous_post_link() `in_same_category` appears to fail when true
- Multiple templates for single custom post type
- How to produce a sub-page-system in WordPress
- How do you create a custom template to display a category with an image and related posts below?
- Best structure / rewrite rules to achieve the following url
- WordPress Custom Search by post_type
- don’t publish custom post type post if a meta data field isn’t valid
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- Paginate_links in custom post type template
- Pages Become “Archive” Instead of Using Page Template