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
- Linking Two Post Types
- How can I change the admin search posts fields?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- WordPress 4.4+ : How to revision CPT + metadata
- Filter a custom field based on selection of another custom field (ACF) [closed]
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- Problem excluding category from get_next_post
- Detect meta value changes when post is updated (post_updated)
- Custom field being erased after autosave
- How to select one major category (or custom taxonomy) for a custom post type?
- Quickest way to get last or oldest post date – WP Query
- Display posts if a custom field value is equal to another custom field value
- Sort posts based on multiple custom fields
- How to filter the taxonomy terms based on another taxonomy term
- Why my custom post posts aren’t showing (404 error / page not found)
- Automaticly add slug to posts
- Filtering by Post Meta Custom Fields – Performance
- How to Separate CPT From Regular Posts?
- Remove wrong dashes from get_the_title()
- How to change post featured image using a custom field of category?
- Custom template with CPT doesn’t display on frontend
- What is the best practice for displaying my plugin content in themes?
- Portfolio Page for Classic Posts
- Cannot save CPT meta box
- How can i create an custom post template for an specific post category? [closed]
- Modify previous and next post links to current Authors Other posts
- Enable Custom Fields For Custom Post Type When CPT Created Using Plugin
- post_per_page ignored in WP_Query
- Display an authors post on a single page only when they are logged in
- How to add new post using a form to categories when categories are using as menu
- Custom wordpress loop
- Different post title, keywords and description
- Display custom meta on page that has been check in custom post type
- How do I update_post_meta() or add_post_meta() with an AJAX call
- How to prevent meta data from being edited in a post?
- Automatically add a character to field in edit post page
- Change Post Meta via AJAX from the posts list table
- Saving metabox keys and storing values as array
- Custom post type filter is being applied to all of my posts
- Mandatory field in Custom post
- How to store the third party script with HTML code in the wordpress custom input field?
- WP Query from two Custom Post type fields as statement
- Get_post_custom not fetching value from array wordpress
- How To Read Read Custom Post Type Data in Headless CMS Mode
- Display Parent-Child Posts in specific order by comparing IDs in array
- Filter custom post type admin list by custom meta column, where the column is another custom posts meta value
- Save data is post using php front end
- What is the best way to structure posts for the same event happening in different years?
- Custom page with no headers, footers and its own CSS, Javascript
- Add custom template ‘sub-page’ to Custom Post type?
- SEARCH QUERIES – REVERSE OUTPUT
- Is there a way to create a sidebar of bullets
- Adding a Section for Visitors
- Automatic Set Category For A Custom Post Type
- I cannot display custom posts in custom taxonomy
- How to get the posts that my following users are liked?
- How to insert post 6 times after user register like ask.fm
- Creating custom post type relationships
- How To Loop Through list with Custom Post Types
- one get_posts to return a number of custom posts for each meta value
- Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?
- Get result from Custom Field in Custom Post type
- Advanced search form with filters for custom taxonomies and custom fields
- Pulling in a particular post into a single page based on the post id passed into the code
- Custom My account page and custom page for editing posts
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- How to get lowest price from custom fields of posts
- show posts under custom post type with same autj
- How to make a non-public post on wordpress approval?
- is therer any wordpress function to retrieve a specific html element from post content