With register_post_type()
, you can specify the 'page-attributes' => true
property, and you’ll get the “menu order” metabox which you see on pages. With this you can custom order your items, where the default is always 0, which means they will always show, even if you don’t set a value.
You don’t actually have to set the page-attributes
attribute to use the the menu_order
post property/column. You can set that value programmatically. To query with the custom ordering in place, you can use the menu_order
property in your WP_Query
args: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters
Related Posts:
- How do I query a custom post type with a custom taxonomy?
- How to get post content by calling ajax?
- 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
- Order by & include array by specific post ids
- Custom post type archive 404’s with paginate_links
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- Limit the post for differents custom post type in the same wp_query
- Retrieving 3 latest post from each of 5 different custom post types
- order by meta_value serialized array
- Loading post content in FancyBox
- Multiple templates for custom post type
- Query post types with multiple keys
- posts_nav_link on single post template
- Used with meta_query in query_posts works slowly
- Query for posts in 2 taxonomies
- Prevent change with new query_posts()
- How to make an archive page displaying posts in a date range
- Get permalink and title by post name?
- Custom Post Type sorted by Title
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Display custom post types with custom date field value (before today) & order by custom date field
- reference the current category being used in the category.php page
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- List custom post type by custom tax term as page title
- Multiple post type queries (with specific arguments for each)
- Custom query works but returns “Undefined Offset: 0”
- What’s a better alternative to this code?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- How to query_post custom posts within default taxonomy?
- child of post type (custom)
- How to use custom taxonomies to reference complex relationships?
- Order query using custom meta data
- Query Custom posts of same taxonomy as the post itself
- Get latest 3 posts from multiple CPT in one query
- Conditional Query of Custom Post Type and custom taxonomy
- will post_id ever change? Can I safely use post_id for custom queries?
- Show a Category X’s custom post type on Category X archive page?
- How to edit this code to get the categories in achieve page?
- Category with post type pagination returns 404
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Query posts based on the meta key values of logged-in users?
- Different Ways to Query Custom Post Types?
- Listing all term items alphabetically / sorting loop
- query_posts adding extra code to homepage
- How to show only the most recent post on my custom post type archive?
- How to make WP_Query not to show irrelevant posts?
- What is the ID parameter for custom post types in query_posts?
- Loop for custom post types filtered by a taxonomy
- Why are some of my custom posts not showing up on my page?
- post-per-page and offset not working
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- Querying multiple values from a single key
- find custom post type post by searching its custom field with my string
- FacetWP paging custom wp_query
- Can’t change posts per page in WordPress Post Type Query
- postsperpage value not being applied
- Incorrect ordering of custom post type based on time
- List all posts in taxonomy term
- Query all post types but limit to parents
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Custom Post Type Query W/Category Dropdown
- Query all posts under one taxonomy? Why is my code not working?
- Custom Post Types Not Showing Up In query_posts Result
- Find Posts based on Child Post value
- Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array
- Showing only posts from the current user who is logged in?
- returning the currect URL for nested posts
- Sticky posts limit query and pagination for a custom post type
- Create a post automatically if search result has zero results
- custom post type and user post count shortcode
- Limit custom post type to the authors only on front-end!
- Posts per Page on custom Taxonomy Template
- minimize wp_query call to database
- Group Custom Posts Types in a Relation field of ACF
- Use WP pagination functions on a custom page template
- Can I show some specific post rather than latest post?
- Getting Custom Posts with Custom Taxonomy
- update a posts of other custom post type
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- How to set class to “current-page” on the currently viewed single post within a CPT
- Optimise custom post type queries
- Display 2nd category, only once, as sub-heading, in the loop
- query_post causes the posts to be loaded twice on load more posts
- Custom Query With Multiple Meta Key Value
- Ordering custom post type by custom field without a title
- How can I list custom post by custom category?
- 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
- WP Build-In Post selector for CPT
- 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?
- Query custom type posts by array of IDs
- Render a loop in Timber (twig for WordPress)
- show custom post’s post in two different divs [duplicate]
- How to get Custom post type by related category ID
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- Assign a tag to custom post type using a query