You can achieve this with ACF.
Create a custom field checkbox (just a simple boolean) for your custom post type.
Below an example of overriding the main loop in archive template :
function order_cpt_by_stickyness( $query ) {
if(!is_admin() && $query->is_main_query() && is_post_type_archive('my_custom_postype')) {
$query->set( 'meta_key', 'my_sticky_custom_field');
$query->set( 'orderby', ['meta_value' => 'DESC', 'date' => 'DESC']);
}
}
add_filter( 'pre_get_posts', 'order_cpt_by_stickyness' );
Related Posts:
- Enable sticky posts to custom post_type
- How can I add a column/s to wp_posts table?
- How to hook get_terms() to only show count of posts that have custom meta
- add_meta_box: Datepicker like the one for postdate?
- Multiple information using custom post type
- Before Delete Post
- How to make post sticky in the admin page?
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- How to stick custom post at the top in search results
- Update Post Meta for a logged in user
- Add custom field to Posts and sort by it
- Two Custom Post Types Many to Many Relationship
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Should Custom post types and fields be in the theme files or in a custom plugin packed into the theme?
- Modify Posts from Custom_Post_Type within the plugin
- Render a Post or Page using the correct file
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Front-end Image Upload to Custom Meta Box
- Checking for custom field in admin pages
- A sports wordpress website
- Display custom post front end filter by ACF equals current user
- Invalid content when I try to import custom post type from the old template wordpress
- How to display custom field in product description?
- Show posts from WP Custom Post Type selected from a field in a metabox
- WP_posts (Not meta) extra custom field column show and change it in a custom post type
- Calling specific page with wp query
- erase post excerpt limitation [×]
- custom field suit new post with in custom fields
- Display code if title of the custom post matches title of other post
- How to automatically update ACF field value every year?
- WordPress commercial theme cancels default functionality
- Copy custom field value to post title
- How to Duplicate (multiple meta box)?
- Is it possible to place custom post type files inside a folder in theme directory?
- Custom Post Type + 20k posts = blank/404 within Admin edit.php [duplicate]
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- Need help targeting a custom post type with conditional tags
- How to get the post type from a category id?
- Custom Post type and Custom Field WP_Query
- How to structure a site with product variations pages?
- Notice: Undefined index: suppress_filters
- How to Separate CPT From Regular Posts?
- Remove wrong dashes from get_the_title()
- List of Posts in a Custom Field
- Save an array from drop-down in custom meta box
- List all images from a single post meta value
- Plugin for custom posts and fields [closed]
- Remove rows in the manage post/page view
- Including Custom Meta with posts_where query
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Populate Custom Fields in a Custom Post Type?
- How to create custom boxes with text inside?
- WP All Import – Using Xpath to set a select value
- How to change post featured image using a custom field of category?
- How to add post_type=value when editing that post type in the WordPress admin?
- Custom template with CPT doesn’t display on frontend
- Publish an XML feed from a CPT with ACF fields?
- Open Custom Post Type as PDF
- How to create shortcode to display custom field value on a custom post type
- Using The REST API How To Pull All Custom Posts?
- Confusion regarding Nonce & using it in Custom Columns for Saving Checkbox Value to Post Meta
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Automatically update custom field in all posts of a custom post type
- WP_Query: include custom post type only with specific meta value
- Is there a way to get a file URL from the relationship ACF field?
- Display custom fields on post excerpt or teaser
- WP_Query orderby modified to include custom meta changes
- WordPress custom loop filter by meta_key and value with serialize data
- Adding Show Less/More link to Custom Post Meta
- Returning a list of custom post types excluding those without a specific meta_value
- Create a wordpress test-system as a clone from productive system
- Want to Add Custom Fields for Uploading video to WordPress Users from front end
- Keep display metadata value on backend – Custom Metabox
- How to bulk copy custom fields between custom posts?
- Show the same Article Available in Other Categories
- Getting posts under the custom post type ui category
- Sorting custom post type columns with external data and without meta values
- Storing posts from query and accessing later via AJAX call
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- If post has custom field then display css-class
- Meta Key Value in current-user-only loop
- Retrieve value of a category’s custom field
- Calculate all custom field values in the post loop
- Rewrite and custom post type: order by custom field not working
- add custom field to custom post type
- How to set up multisite for multi language?
- CPT Group by Date metabox Value
- How to check if user meta field is empty in conditional else statement
- Replace text in post from cvs
- Admin search ACF relationship
- Display only one post each WEEK
- wp_query check if integer exists in custom field’s array
- List children on child post
- How can I dynamically add a post to a custom post type which uses a custom field?
- Restrict custom post type from appearing with ?post_types=
- Show custom post type filtered by category
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Custom Posts Types as Custom Fields
- create parent post using wp_insert_post