add below code in functions.php file , here “event” is custom post type (change it as per your post type) , so here it will display 6 post on events list page , also you need to copy default archive.php file and copy and create new archive-event.php (replace event with your post type).
function custom_type_archive_display($query) {
if (is_post_type_archive('event')) {
$query->set('posts_per_page',6);
$query->set('orderby', 'date' );
$query->set('order', 'DESC' );
return;
}
}
add_action('pre_get_posts', 'custom_type_archive_display');
Hope this Helps 🙂
More detail how to list custom post on custom page refer this link Custom Posts on Different Pages
Related Posts:
- Wp-query causing problems with the_content();
- How to create posts (not post template) to be displayed on projects page?
- Quickest way to get last or oldest post date – WP Query
- How do I create an archive page for standard posts?
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Loop on front-page.php
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WordPress Orderby Numeric Value Not Working
- is there a way to retrieve posts that do not have a featured image assigned?
- How to add post_type=value when editing that post type in the WordPress admin?
- Storing posts from query and accessing later via AJAX call
- Show custom post type filtered by category
- Get latest 3 posts from multiple CPT in one query
- Several post types on WP Query by tag and taxonomy
- Prioritize posts in query by meta keys?
- How to get all tags of a custom post type by id
- WP the_posts() on single-cars.php get category link
- Custom post types and ‘new WP_Query’
- Variable not working in WP_Query
- WP_Query with custom post type ID
- Query within a foreach within a query (queryception)
- wordpress lists similar type of posts in a custom post type
- display posts of custom post type with custom taxonomy
- How to Query in WordPress which shows Alphabetic Posts?
- How to query Posts from a custom post type which contains a custom taxonomy?
- Display post from custom post type
- list posts of two post types in a single template
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Display Parent-Child Posts in specific order by comparing IDs in array
- how to display posts content on the custom css popup by clicking on each title on the sidebar?
- wp_post_delete is deleting all offices
- SEARCH QUERIES – REVERSE OUTPUT
- How do I insert a custom post type query after a certain number of recent posts and then resume recent posts?
- minimize wp_query call to database
- subtracting the current post form then whole loop, which is generating all CPT titles
- post type => ‘any’ not applied my custom queries
- Custom Post By Category
- Custom post Query and WordPress Post Query Clash
- How to get the posts that my following users are liked?
- Get post from Category by Priority
- Most efficient way of showing children posts?
- Only show current category post
- How To Loop Through list with Custom Post Types
- Calling specific page with wp query
- Retrieving IDs of child pages which are in a different post type
- Query Posts From Multiple Post Types
- Change display wp post type to wp custom post type
- Dynamically change post_parent in every page load?
- Cannot exclude particular post from loop of custom post type
- How do I hide single category post on my post page
- Wp-theme Development
- show the most recent date of all posts to display on front end
- Sort ACF by custom taxonomy
- How to use a custom post type archive as front page?
- How to make a WP_Query search with custom post types?
- Set posts of a custom post type to be private by default?
- The Operator “NOT IN” Does Not Work In tax_query
- How make get_next_post() return first post when viewing last one
- How to get the parent’s taxonomy?
- ascending order custom post type
- New WP_query in template not working with CPT+category on some pages
- Optimised Code for Pulling Taxonomy Posts
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- How can I get the first 50% of all posts (within a custom post type)?
- Trying to edit the single page from a Custom Post
- How to Submit Post Via cURL & PHP
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- shortcode to show custom post types by category
- Genesis filterable portfolio isotope [closed]
- convert custom query to wp_query
- Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”
- How to use load more custom post type data normal or according to on click category tab In WP
- Conditional for a Single Post That Belongs to a Category?
- How to make WP_Query not to show irrelevant posts?
- Load Next WordPress Posts With AJAX?
- Custom post type menu
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Get current user id
- List latest post out of 2 custom post types
- How to properly use Categories with Custom Post Types
- Custom Post Type Query W/Category Dropdown
- Pin posts to top of custom loop
- Define multiple prefixes for custom post type
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- Query custom post type and custom field by URL parameters
- How to show posts of the same category on a page?
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- CPT post doesnt shows tags and category on backend admin page
- Adding a nav menu for a custom post type
- How to use costum database table for custom post type
- Querying, storing, and using data from 2 separate custom post types
- date_query won’t accept day parameter, but will accept month and year for a custom post
- How to display data with pagaination on backend?
- Edit post meta direct from post.php?
- Custom Post ‘Post Per Page’ Crashing Page?
- How to Arrange Support => Thumbnail
- Paged within a custom content type template [duplicate]
- How to exclude certain portfolios from a loop