Loop over the $cpackages
results twice, and rewind_posts()
in between. first time only output when the id matches the current post id, then skip that id the second time through.
Related Posts:
- How to start with post number x?
- wp query custom orderby not custom field
- How to limit the number of posts that WP_Query gets?
- Should we trust the post globals?
- Random sort within an already sorted query
- Exclude drafts in all() view of edit.php
- How to know if get_posts() failed?
- WordPress Number of Posts Not Changing With posts_per_page
- Pagination not working on Custom Page Template
- How to add posts to wp_query result?
- Order post by year DESC and month ASC
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- How to find if a post with custom_field == X exists?
- Search query – exact post title match
- posts_per_page doesnt work
- Blogroll – Different layout for first post
- Display page content AFTER a loop of posts
- wp_query ‘s’ parameter does not work with custom post type
- Exclude posts with empty post_content in wp_query
- Only display a certain number of posts, dependent on how many posts there are available in a query
- Improving WP_Query for performance when random posts are ordered
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Get Posts that are in the current month or later
- Hiding Draft Post In Admin
- WordPress custom Query for Posts in Category display posts multiple times
- Exclude the first ‘n’ number of posts of a tag from home page?
- posts_per_page option limits the number of Gallery items
- wp_posts table: safely remove unused columns to save database storage
- Dynamically switch template on click
- Why Query is returning empty array?
- Delete all drafts?
- Is it possible to use WP_Query to only pull posts with attachments?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Do not show children of a category
- Query for first 3 posts to change the look and feel
- How safe is it to delete old posts edits to save database space?
- Why posts array is empty?
- Delete post revisions only for a single post
- How to give classname to post if post has no content?
- Exclude some posts from displaying in wp_query based on some condition
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- How to convert query sql to shortcode in wordpress?
- How to display only one category in a custom post type?
- Custom Select Query – Selecting the Year?
- Is there a function to get post info for any publish_status by post ID?
- Trying to exclude custom posts based on date, while sorting by custom field
- Help on conditional statement to accompany wp_insert_post function please?
- WordPress Query – Display 5 posts (same post type), each from a given tag
- Search results for ACF data
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- The first post appears twice
- filter posts based on menu_order
- Show 5 posts and than 3 posts offset with pagination
- Custom Select Query pagination not working properly
- Sort / Filter Queries
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How to show the posts list into a static page? Problems to use the loop into a static page
- How do I control the fallback query after the original query returned cero posts?
- Displaying Results From Custom Taxonomy Query
- Given two custom post types: Automatically add meta fields from one custom post type to another
- WP_Query retrieve custom posts but not the post showing
- Special Query: Title, Terms, Content – %LIKE%
- Display one post randomly from category on home page
- Wp_query WooCommerce products
- How edit footer copyright info? [closed]
- How do I get content of custom post type through post ID
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- Change permalinks in posts via SQL
- how to get a different html for odd/even posts?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Prevent duplicate posts in wp_insert_post using custom fields
- Add default content to post (for specific category)
- Display the latest posts, published in the last hour, with WP_Query
- same template for multiple custom post type single
- Converting multiple loops into one single loop with pagination
- Run a function when post is deleted?
- Get posts of ONE taxonomy term of custom post type
- WordPress Custom Fields (Checkboxes with multiple values)
- How Can I Query a Specific Page From a MultiPage paginated Post
- WP_Query orderby not working with meta_value_num and menu_order
- Custom WP_Query with complex ‘post_status’ argument
- Custom Post Archive Page not working
- $wpdb->replace: WHERE?
- Custom post types related to same custom post type?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- Page and post loop same template
- Check if a custom post type has already been created
- Custom WP_Query not working correctly
- Echo the number of posts being displayed
- Creating a related posts section in wordpress inside a default post
- What would causes search to return incorrect results?
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- How to list all names and descriptions of a custom taxonomy
- posts_per_page – Repeats only first posts ‘post__in’ array
- Dynamic Menu Item