If you don’t set a value for posts_per_page
, it will use whatever the setting is for Blog pages show at most
under Settings > Reading
.
Also, don’t use query_posts
, use WP_Query instead:
$args = array(
'post_type' => 'cases',
'posts_per_page' => -1 // get all cases
);
$cases = new WP_Query( $args );
if ( $cases->have_posts() ) :
while ( $cases->have_posts() ) :
$cases->the_post();
// output case
endwhile;
else:
// nothing found
endif;
Related Posts:
- Get the ID of the latest post
- Searching multiple custom post types and pages
- Using meta_query, how can i filter by a custom field and order by another one?
- Get page by template?
- Querying custom posts and regular posts
- TV Show database – Best way for structuring it?
- How to Add Pages Under Custom Post Type URL Structure?
- Using Offset in Custom Post Type Query
- Posts per Page on custom Taxonomy Template
- How to create user personal pages with information from their meta profile fields?
- Using Query Posts With Multiple Post Types And A Taxonomy
- Query posts by custom post type and custom taxonomy
- Query not returning CPT posts
- Post Rank on Single Post page based on custom field
- Custom Post Type Name Causing Problem
- Unable to display multiple post types in same query (WPML WP_Query)
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Quickest way to get last or oldest post date – WP Query
- How to display recent posts added in several custom post types
- ‘category__and’ for custom taxonomy?
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- query_posts with a custom post type, a meta_query and sorting by post date?
- remove child post from custom post type archive
- Custom query shows custom post types in trash
- Combine query_posts() and get_posts() into single query
- how can i get posts from custom post type particular taxonomy category
- Setting posts per page in query_posts
- How to insert content from another Custom Post type into Post?
- Create custom PAGE with register_post_type
- Making a custom help center page
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- create a template page for a post
- Query/list all terms and their custom post count
- Page vs Custom Post Types Differences/Issues
- Display only one post each WEEK
- Get posts between custom dates
- Exclude pages in archives results
- Make parts of your wordpress website completely built with data from external APIs?
- Trouble with CPT Child 404
- Assign same parrent Page to pages AND custom post types
- Polylang non-default language ignores tags in WP_Query
- Static page determines as home, but it is not
- Limit the post for differents custom post type in the same wp_query
- Top Level pages in wordpress giving 404, but child pages working fine
- How to display Related Posts based on number of taxonomy terms matched
- Why is get_pages() returning a boolean?
- Filter date from post meta when date is in string format
- the_content(); of custom post type treated as an array or object
- Custom query – get_the_terms not work
- Display an authors post on a single page only when they are logged in
- 3 random images from custom post type, each in a div with a diffrent class
- Display custom posts randomly in custom taxonomy archive
- Not able to export large no. of posts in csv
- Pagination not working on custom query on a page
- Loop through posts of only 2 statuses
- URL Rewrite – Page Archive
- Render a Post or Page using the correct file
- Best way to create a search for custom post type by custom field values
- Dynamic category name in query post
- List all posts in taxonomy term
- Query all post types but limit to parents
- Under What Conditions Can I name my CPT the same as my CPT Page?
- HM CMB: Post Select Field for CPT ID
- custom post creation on front page – on submit a search is done
- 4 posts per page from single category
- Display Posts Query with IF function
- How to setup different permlalinks for posts and pages?
- Getting custom post type info using get_adjacent_post
- Query all posts under one taxonomy? Why is my code not working?
- Query for bbPress replies to current topic?
- Why can’t I query more than 1 post type at a time?
- WP query_posts group by meta field related
- How do I disable the built-in editor and automatically configure the properties of new pages?
- custom post type and a “sticky” position taxonomy
- Limit custom post type to the authors only on front-end!
- Add custom template ‘sub-page’ to Custom Post type?
- Custom Post Type Single Page and Archive Page redirects to Home Page
- Order Posts in Custom Order
- Disable Sidebar on certain pages
- Displaying posts inside table having issues
- Query the title of the page to show posts with matching category in the loop
- How to manage a custom post type archive as a page?
- How to Create movie schedule by custom post type query
- Main site single-property.php design, as homepage of a multisite
- One Post with different content, depending on a Page
- Different post types arranged on one page
- How to get main div html to print a list of posts inside?
- Using $seed on a custom post type for randomly displayed posts
- Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?
- query_post while (have post) get_template_part()?
- “regular” pages not found after changing permalink
- Using custom post types within a section of a template
- What’s the best way to show custom post types? With page template it’s not perfect!
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Inserting two categories
- How do I correctly query posts from a post ID?
- Display ACF object field data using Elementor Custom Query