After you have set a static page as your home page you can add this to your functions.php
and you are good to go. This will call the archive-POSTTYPE.php
template correctly as well.
add_action("pre_get_posts", "custom_front_page");
function custom_front_page($wp_query){
//Ensure this filter isn't applied to the admin area
if(is_admin()) {
return;
}
if($wp_query->get('page_id') == get_option('page_on_front')):
$wp_query->set('post_type', 'CUSTOM POST TYPE NAME HERE');
$wp_query->set('page_id', ''); //Empty
//Set properties that describe the page to reflect that
//we aren't really displaying a static page
$wp_query->is_page = 0;
$wp_query->is_singular = 0;
$wp_query->is_post_type_archive = 1;
$wp_query->is_archive = 1;
endif;
}
Related Posts:
- How to set a custom post type to have viewable future posts
- How to get_queried_object on multiple objects?
- How to use WP_Query in a CPT achive page?
- is_main_query() not working for WP REST API
- WP_Query | ‘post_type’ doesn’t work
- Display featured image from one CPT within another CPT query
- CPT archive admin menu label
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Loop increase number
- Get current user id
- Using Wp_Query, Json to add Highcharts series data
- Query Posts that have Custom Taxonomy
- Foreach loop returning more than one item when querying taxonomy
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Custom Form / Search with Custom Post Type Data
- set object terms after some some time of published post – functions.php
- Different number posts per page based on custom post type term id
- How to add specific terms in a custom post type?
- Tell wordpress to show a single page instead of an archive page
- subtracting the current post form then whole loop, which is generating all CPT titles
- Only show categories that have posts within custom post type
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- why custom post archive gives always no more than 10 posts despite of paging settings?
- WP_Query function for custom post type
- Modify shortcode to work with custom taxonomies and slugs
- Pagination fault in custom post type archive page [duplicate]
- Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected
- How to connect two custom post types with nested loops
- Editable Meta Data for Custom Post Type Archive Template
- Filter by custom taxonomy slug on a custom post type
- Custom Post type and Custom Field WP_Query
- wpdb custom post_type problem
- Pagination on category page with custom post types
- Query var removed after rewrite
- Display multiple custom post types and sort them chronological by one of their fields
- Insert HTML inside link in a walker
- Using DISTINCT in wp_query
- Using global $post; to get featured image for custom post via WP_Query
- Query custom post type in the loop
- right_now_content_table_end function not working?
- How to add pagination to wp_query [duplicate]
- WooCommerce product search titles only
- Related posts in all categories of current post (custom post types)
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Notice: Undefined index: suppress_filters
- Specify a Page as the parent to the CPT Archive
- Loop through Custom Post Type, and then show children within each iteration
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- Sorting multiple custom post types without a meta key/value pair by sort order
- Custom Taxonomy Permalinks Redirection
- Including Custom Meta with posts_where query
- Add custom column in custom post type edit page
- Custom Post Type with has_archive ignores my custom archive and single template
- Very Slow Page – How to Optimize # of Queries?
- orderby in custom WP Query does not work
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Archives for Custom Post Types (without Pages)
- Can I create a loop with multiple post types and specify different $args for each post type?
- How to show CPTs in term archive
- Query custom post type by category slug
- Combining sorted and random CPT
- How to add post_type=value when editing that post type in the WordPress admin?
- wp_insert_post generates endless posts
- Display CPT posts based on specific taxonomy
- Remove standard meta boxes from custom taxonomy
- CPT Archive with core Category
- Custom template won’t load for a custom post type (custom permalinks used)
- Can’t query tag and post_type at the same time
- Setting proper query for multiple custom admin filters
- shortcode to show custom post types by category
- Unable to retrieve any posts of CPT in wp-admin
- What’s the difference between same wp functions get_posts(); functions in different form?
- WP_Query: include custom post type only with specific meta value
- Pagination on a custom post type loop
- I did group my search results by post type, but how can i give each of them its own order?
- Set up Custom-Post-Type Author Archive
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Dequeue scripts and styles only for specific custom post type
- showing custom post types of a certain category only
- WP_Query orderby modified to include custom meta changes
- Function to display custom post type on front page makes menu items dissapear
- WordPress custom loop filter by meta_key and value with serialize data
- Returning a list of custom post types excluding those without a specific meta_value
- query private custom post type
- Display custom post type from dynamic custom field
- custom post type not showing in menu
- Query/list all terms and their custom post count
- Linking to the most recent post in a Custom Post Type
- How to make sure content doesn’t display if selection is empty
- Show category ID on custom post type
- Filtering WP_Query Dynamically on the Front-End
- Unable to get post archive link
- get the custom post type title/name
- Show one item per category of a custom post type
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Storing posts from query and accessing later via AJAX call
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How to customize a permalink (URL) structure?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]