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?
- what is the correct way to compare dates in a WP query_posts meta_query
- 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
- 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()?
- Custom post type archive 404’s with paginate_links
- Display Custom Post Type Fields
- Querying custom posts and regular posts
- 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
- How to hook get_terms() to only show count of posts that have custom meta
- Using Offset in Custom Post Type Query
- how to group custom post type posts by custom taxonomy terms
- order by meta_value serialized array
- Posts per Page on custom Taxonomy Template
- Using Query Posts With Multiple Post Types And A Taxonomy
- How to get the parent’s taxonomy?
- Loading post content in FancyBox
- Query posts by custom post type and custom taxonomy
- Multiple templates for custom post type
- Query post types with multiple keys
- ascending order custom post type
- posts_nav_link on single post template
- Query not returning CPT posts
- Post Rank on Single Post page based on custom field
- How to get only one category of custom post type?
- Used with meta_query in query_posts works slowly
- Unable to display multiple post types in same query (WPML WP_Query)
- pre get posts changing the query
- 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?
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Custom Post Type sorted by Title
- Get all posts WHERE custom_field is LIKE value
- 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
- 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
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- 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
- query_posts with a custom post type, a meta_query and sorting by post date?
- Custom query shows custom post types in trash
- Multiple post type queries (with specific arguments for each)
- 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?
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- Sort by custom field is not working
- Custom query works but returns “Undefined Offset: 0”
- Sorting multiple custom post types without a meta key/value pair by sort order
- Custom post types instead of regular post’s categories in a page template
- Change or update WordPress loop based on dropdown selection
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- What’s a better alternative to this code?
- Display custom post type from dynamic custom field
- Query/list all terms and their custom post count
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Display only one post each WEEK
- List children on child post
- How to query_post custom posts within default taxonomy?
- Get posts between custom dates
- child of post type (custom)
- Page template with different page and post content
- 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
- get custom post type
- 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?
- Custom Post Type Query for Sidebar Doesn’t Work on Front Page
- Polylang non-default language ignores tags in WP_Query
- How to edit this code to get the categories in achieve page?
- Category with post type pagination returns 404
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- How to exclude certain portfolios from a loop
- 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
- 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
- Assign a tag to custom post type using a query