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:
- How do I query a custom post type with a custom taxonomy?
- what is the correct way to compare dates in a WP query_posts meta_query
- Hook for post and page load
- Integrating a custom post type into a page hierarchy
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- How to get post content by calling ajax?
- How to show all posts of the category in wordpress?
- 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?
- Return all custom meta data for one custom post type
- Display a query with multiple post types and same relationship on a single page
- Fail to compare dates in meta_query
- How to filter custom posts by tags and custom fields?
- Order by & include array by specific post ids
- How to call a custom post with get_posts() instead of query_posts()?
- Return current page type
- Custom post type archive 404’s with paginate_links
- Custom Post Type as Page parent
- How to add a post from a custom post type as the static page?
- Get page by template?
- Page as child in custom post type slug?
- Display Custom Post Type Fields
- Querying custom posts and regular posts
- Is it proper to create a page just to generate a listing page (eg. for a custom post type)
- TV Show database – Best way for structuring it?
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- Limit the post for differents custom post type in the same wp_query
- Is there a way to make a custom Page type?
- Retrieving 3 latest post from each of 5 different custom post types
- How to hook get_terms() to only show count of posts that have custom meta
- Menu position (admin menu) of pages
- How to Add Pages Under Custom Post Type URL Structure?
- update a posts of other custom post type
- WordPress Contents Migration
- How to Create movie schedule by custom post type query
- Creating Slider in wordpress theme with custom post
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- Main site single-property.php design, as homepage of a multisite
- How can I make my CPT read from page-*post-type*.php?
- One Post with different content, depending on a Page
- How to set class to “current-page” on the currently viewed single post within a CPT
- Imported Content Doesnt Show Up On Frontend
- Optimise custom post type queries
- Cannot use pages created on WP
- Use the page picker from wordpress menu creation page
- Different post types arranged on one page
- WordPress custom post type
- How to get Last post Id of custom post type in wordpress
- How to get main div html to print a list of posts inside?
- Display 2nd category, only once, as sub-heading, in the loop
- WordPress custom post type queries
- How to display data with pagaination on backend?
- display news with pictures 3 small and one large (loop)
- archive.php can’t find categorized posts
- Filter RSS feed for custom post type to events for next 7 days only
- Pulling Content from Existing Database
- Using $seed on a custom post type for randomly displayed posts
- query_post causes the posts to be loaded twice on load more posts
- Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?
- Query Distinct Taxonomies of Custom Post Type
- Excerpt for each post type and for is_front_page
- How to Associate Posts with Pages
- Custom Query With Multiple Meta Key Value
- Ordering custom post type by custom field without a title
- Custom post type blog pagination conflict
- How can I list custom post by custom category?
- Programmatically Split A Post Into Multiple Pages
- Query Posts From Multiple Post Types
- Return only custom post types for the page, not all
- Advanced Custom Fields: query posts filtered by multiple field values
- Why are my wp urls showing page not found?
- query_post while (have post) get_template_part()?
- “regular” pages not found after changing permalink
- WP Build-In Post selector for CPT
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- Using custom post types within a section of a template
- Page that ‘subscribes’ to multiple categories
- What’s the best way to show custom post types? With page template it’s not perfect!
- How to apply order on custom taxonomy and custom meta key on custom post type
- send user to first page of results when reposting to page?
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Query custom type posts by array of IDs
- How to store queried custom data and use it in multiple pages?
- Inserting two categories
- Highlight specific menu item when custom post is page
- How do I correctly query posts from a post ID?
- How to exclude certain portfolios from a loop
- Render a loop in Timber (twig for WordPress)
- How do I hide single category post on my post page
- show custom post’s post in two different divs [duplicate]
- How to get Custom post type by related category ID
- Trying to set up a range filter for related custom post types
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- Display ACF object field data using Elementor Custom Query
- How to add a regular page under a custom post type?
- Assign a tag to custom post type using a query
- An script/Plugin for automatic page creation per term
- Why using archive pages at all?
- Subpage for Custom Post Type