Re-name your CPT archive to home.php
Then use pre_get_posts
to alter the home page query so only CPT’s display
function wpsites_home_page_cpt_filter($query) {
if ( !is_admin() && $query->is_main_query() && is_home() ) {
$query->set('post_type', array( 'your-cpt' ) );
}
}
add_action('pre_get_posts','wpsites_home_page_cpt_filter');
Replace your-cpt
with the name of your custom post type.
Note: pre_get_posts
won’t work with the is_front_page()
conditional tag.
Related Posts:
- How to remove custom post type archive
- How to use a custom post type archive as front page?
- Get custom post type slug for an archive page
- Custom Post Type Settings page, choose page to display archive
- Adding custom post type archives to a WordPress menu
- How to set a custom post type to have viewable future posts
- Proper way of making custom post type landing page or archive page
- Custom Post Type Archives by Date with Custom Permalink
- Custom Post Type Archives with 0 Posts Redirects as 404
- How to filter custom post type archive by meta value
- “Edit” option for custom post types archive page
- Get monthly archives for custom post type
- How to get_queried_object on multiple objects?
- Assign Page Template Within A Custom Post Type
- Custom Post Type / Taxonomy Slug / Post Title with post type archive
- Post type archive page not working
- paginate function in archive for custom-post-type
- Custom Post Type – Archive page title
- Should I change these content meta types before building complex archive page?
- Getting taxonomy terms used by custom post type
- Archive or taxonomy pages not working for custom post type
- How to create archive page for taxonomy terms within custom post type
- How to list custom post types?
- I am facing problem in my archive page , it is partially working
- taxonomy template for custom post type the same as the archive
- Display only post types that are direct children of the current taxonomy
- Custom post type search with slug in URL
- How can I give CPT archive correct body class?
- How can I filter by taxonomy on a custom post type’s page?
- Conditional tags don’t work
- Custom template won’t load for a custom post type (custom permalinks used)
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- CPT custom archive template does not get loaded
- Custom post types and tag archive pages/permalink structure issue
- Custom post type is showing custom home page, not archive page
- URL of a custom post type’s post format archive?
- Create template for taxonomy results limited by Custom Post Type
- How to use has_archive but disable feed per post type?
- Custom post type: Disable single page, but keep archive
- Use Custom Post Type archive page for the taxonomies term archive page
- Number of Custom Post Types published are not being shown in the custom page
- Custom Post Type has_archive
- Custom Post Type Archive URL is wrong
- list archives per post types
- Canonical url differs from custom post type archive URLs
- Display a custom posts page for post type
- Custom post type archive pagination 404
- posttype/taxonomy/term archive page 404 error
- Is it possible to have a custom post type with feed but without the archive?
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- My archive-posttype.php template is not loading
- Custom Post Archive is not working
- Add parent post to Custom Post Type [closed]
- Set featured image to archive.php
- What’s the name of the custom post type yearly archive template?
- How can I use archive-{post_type}.php theme template?
- How to display CPT archives?
- Custom meta Title for custom post type archive from page
- current-menu-item not added on page showing custom post type (rendered with archive template)
- Alphabetically sort a taxonomy.php template by post title
- Permalink problems with custom post type and custom taxonomy
- Use the custom post type archive for taxonomies?
- Custom Post type date archive for custom taxonomy
- Custom Post Type Custom Archive Page Not Working
- Getting custom taxonomy posts on archive page
- add_action ‘init’ from inside a class for custom post types
- Custom post type archive – error in nav-menu-template.php
- Custom post type category permalinks and archive pages
- Pages not appearing?
- CPT archive with WP native/core tax/categories
- Invalid content when I try to import custom post type from the old template wordpress
- How to add specific terms in a custom post type?
- WordPress Page hierarchy ( parent is singular of custom post types slug ) is returning not found
- Custom Post type page content (archive page)
- Posts per Page on custom Taxonomy Template
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Display Custom Post Type Archive content with Shortcode
- Custom Post Type archive page listing a 404 or single post
- Building Link List for Custom Tax
- Custom Post Type / Taxonomy / Term – what template to use to avoid 404-page?
- Unsure what page hierarchy to use with CPT UI to show on front end
- get first limited words from a custom post in the archive page
- How to manage a custom post type archive as a page?
- How to manage a custom post type archive as a page?
- Custom post types not displaying per category
- How to Show all Values in category.php page using post_type
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- Show index and not the archive for “Dog Custom Post” with default slug
- Custom post type with two templates
- Making a archive gallery page for a custom post type which already has an archive page
- Custom taxonomy in custom post type archive with pagination
- why custom post archive gives always no more than 10 posts despite of paging settings?
- Rewrite rules causing hole
- Custom post type category page not working
- paging is not working properly on news archives page [duplicate]
- CPT Archive with parent page
- custom post type not getting archived?
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Remove plugin’s custom post type archive page and single pages [closed]
- Custom archive URL as a subfolder of the custom post type slug