What I can think of a way to do this is this, you get_post the post you would like to show on the first, it will return the WP Post Object, then query the custom post type using get_posts, excluding the ID of that post and finally push it to the array that will be given to you by get_posts.
//say this is the first post you want to show
$first_post = get_post( 23 );
//query all posts excluding the first post you want to display
$all_post_except_first = get_posts( array(
'post_type' => 'your_custom_post_type_here',
'numberposts' => -1,
'post__exclude' => 23,
) );
//then put it on the first of the array
array_push( $all_post_except_first, $first_post );
Related Posts:
- how to override woocommerce specific loop or archive-product.php [closed]
- How can I create an alternative home page?
- Multiple Queries and Excluding Repeating Posts?
- Last post is not showing up
- get_option issues
- Show post page only if the user has bought a specific product
- Adding Pagination on a Custom Author Page
- Exclude custom taxonomy tag from loop
- Loop through custom fields with similar label / common chars in label
- Pagination Issues using WP_Paginate Plugin
- CPT Loop with ACF and passing ID between Loops
- How can I display a PHP foreach loop’s answers by AJAX
- toggle Multiple Loop with tittle
- Exclude current post but keep the same posts-per_page amount
- wordpress custom fields loop
- How to show related post with category DESC (ASC) IDs of ID current post
- Avoid showing the same phrase in the loops
- Multiple loops on same category with different design
- Custom query pagination with php parameter as arg problem
- Multisite – Getting Meta query to select from wp_2 tables
- How to append the excerpt to the content in the single post page?
- Multiple Owl Carousels on the same page with navigation problem
- Highlight specific user with custom field value
- custom loop issue
- Secondary loop doesn’t work
- Post thats in Two Categories, only want to display name for one
- Loop display only 5 posts
- Remove WordPress theme from a specific page
- Backup the Database and Restore from the Backup?
- Scaling a WP eCommerce site
- How to keep a WordPress site synchronized between two servers?
- Limit Media Library to Given Folder
- How can I get posts in a subcategory to display on it’s parent categories archive page?
- difference between esc_attr(), strip_slashes(), strip_tags()?
- customize_register with Multiple controls/settings – how to get values?
- How do I prevent one of two multiple loops from repeating on a second page?
- Integrating the WordPress admin panel with a frontend theme
- Looking to display non-image files in Gallery with logo specific to file type
- simple wp_insert_post example
- Is it ok to not a have child theme and just create a theme from scratch?
- How to Remove Subscribers from the Post Author Drop Down
- Why would switch_to_blog stop working?
- How to add classes in the wp_list_category parent link
- $wp_customize->remove_section for customizer setting?
- Fatal error: Call to a member function add_rewrite_tag() on a non-object in /wp-includes/taxonomy.php on line 333
- Search a post using the date it was posted
- Change login error messages? Cookie error message
- Multiple Images/ Slider with custom post [single.php] [closed]
- How do I change the markup only of a built-in widget?
- Is it possible to make widget return only data (eg, array)?
- Viewing checkout page removes fees from mini cart
- help to change some colors (woocomerce and store locator) [closed]
- How do i remove animated icon [closed]
- Multi-site User Sessions
- Looking replicate static HTML Menu into WordPress Dynamic Menu [closed]
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- website with pretty permalinks except pagination
- How to create a control for css opacity in the Customizer
- add an option to the read page
- Custom login and registration forms
- Save Textarea on WordPress Frontend
- How to custom post navigation
- Showing different pages depending on a cookie value
- how to add wp-user fields to front-end form
- Show custom field value as a link
- Customizing Comments
- Custom section (e.g. Demos or Downloads)
- More Fields: Input “Values (if applicable)” is disabled
- Replace TimThumb in existing WordPress Themes
- Moved wp-content and got problem with themes directory?
- How do I make Dynamic Student Admission Form?
- Removing “Failed” query argument upon successful login
- WordPress search on a custom table
- How to get the full product name by ignoring custom modification on it
- Remove Category titles from individual posts on archive pages
- Moving Quantity after product description
- Twenty Twenty edit “Read more” text
- Some questions about best practices for custom code
- Calling get_theme_mod() of an WP_Customize_Image_Control() returns an Array, how do I correctly return the image src for my custom theme?
- CPT: multiple loops with different terms
- Replace Vimeo and Youtube in from scratch theme with from-the-group-up single post template?
- How do I display custom RSS fields on my site?
- How to Remove wpautop in woocommerce includes folder class-wc-order-item.php
- How to replace specific word in wordpress without losing their functionality
- permalink of word press in htacess
- Show comments based on user role in front end
- How to define a static Home page
- let users add multiple divs in static page
- Best way to replace image url with source
- Where should I put this custom data?
- Multiple Taxonomies Using Custom SQL Query
- Changing starting number of User ID
- how to register / add multiple options into one field in wordpress?
- Make Terms Under Custom Taxonomy Use Specific Single.php Template
- How to duplicate “Pages” section in the control panel?
- WordPress Customize panel – accessing the values
- Pull certain WordPress posts on custom CMS instead and 301 wordpress to it?
- Create users via PHP
- Show post content in two different places without redirect
- Applying my own css classes in wp_menus 3?