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