First: don’t use query_posts
. It will confuse the main WordPress loop.
You will need two queries. First use the query you have already constructed to get the priority posts:
$query1 = new WP_Query( $args ); // here use the $args you already have
Now count how many posts are returned to set the maximum return on the second query:
$count = $query1->post_count;
$args = array ('posts_per_page'=>15-$count) // and any other arguments you may want to parse
$query2 = new WP_Query( $args );
Now loop through both queries to display them. Note that if you need pagination you will have to do some more clever stuff to make sure you get the right posts and amount of posts on your page.
Related Posts:
- get_post_meta causes database queries
- Order by meta value or date?
- Filtering posts by post meta data
- How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?
- Custom query with query_posts doesn’t show post without certain meta_key
- How to sort by meta value?
- How to display liked posts of current user in wordpress?
- Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook
- Order by meta_key with two meta_queries
- Sort Posts by Multiple Meta Values [duplicate]
- Querying posts with meta value that begins with a certain pattern
- ACF Custom Field WP_Query, but need to get all posts, if field doesn’t exist
- IF.. post meta show… Conditional Tag Help…?
- Single meta key with multiple meta value in like comparison
- Get posts between custom dates
- order posts by meta value on posts page
- Query_post($args)
- query_posts() on key’s value, or key’s existence
- Fetch Record based on meta key dates
- how to make members list directory through wordpress post custom meta key.
- How to retrieve an array of post IDs by a particular value stored in a custom meta’s array
- Query posts by meta_key whose value is an array
- Filter Loop by Custom Field Value
- meta_query check for meta value in key which holds an array of values
- Exclude posts by post meta value
- Frontend form with multiple posts
- query_posts orderby postmeta [closed]
- Meta query stopped working
- Custom query looking at multiple custom fields and properly sorting
- How do i create a custom post query when the meta value is an array?
- Tax query get first product with attribute value in pre_get_posts
- Use WP_query to match post types based on custom field values
- query_posts() with multiple meta data comparisons
- get all posts with certain meta data
- Limiting the amount of posts this displays
- How to Get All Posts with any post status?
- posts_per_page no limit
- what is the correct way to compare dates in a WP query_posts meta_query
- Nested meta_query with multiple relation keys
- How can i get count from query post
- query_post by title?
- Why query_posts() isn’t marked as deprecated?
- Alternative to query_posts for main loop? [duplicate]
- how to query posts by category and tag?
- Using WP_Query to Query Multiple Categories with Limited Posts Per Category?
- Use REGEXP in WP_Query meta_query key
- Using meta_query, how can i filter by a custom field and order by another one?
- How do I query by post format in WordPress 3.1
- Display posts of the last 7 days
- Is there a way to exclude the content from the post variable to save on RAM usage?
- Query posts by custom taxonomy ID
- Fail to compare dates in meta_query
- Display/query post formats
- How to query post by user role?
- How to return results of a get_posts() in explicitly defined order
- Help to condense/optimize some working code
- How to set posts per page using WP_Query()
- query_posts exclude a meta key
- How do I create a random post that will last for a day
- Ensuring sticky posts are retrieved first (without using two queries)?
- Meta compare with date (stored as string) not working
- Getting attachments by meta value
- Query Multiple Post types each with own meta query
- Determine if more posts are available than was asked for in `query_posts()`?
- Modify main WordPress loop with a parse_query filter
- Ordering posts having multiple post-meta date fields
- query_posts() in function makes global $wp_query out of sync?
- Limiting query_posts to 1, regardless of sticky post?
- How to make “sticky” pages (and query by them)
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Query posts: how to exclude results if post is in multiple categories
- Query Custom Meta Value with Increment
- query_posts ->using meta_compare / where meta value is smaller or greater or equals
- Problem with ‘post__not_in’
- How to order posts by descending comment count on taxonomy page?
- How Can I save multiple records in same meta key?
- Sort posts alphabetically by custom field value, insert divider between different letters
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- WP 5.8 “Query Loop” block: where to place custom query?
- Perform query with meta_value date
- Sort X categories by last update and show image
- Custom Post Type “Event”: chronological list of recurring events
- Meta query interfering with orderby relevance
- WooCommerce conditional meta query
- Meta Query with date and time on the same Day before given time
- using post__in allow duplicate post id
- Pagination on archive.php page
- WordPress Custom Query
- Best way to load page content in Fancybox popup?
- How to update single value in multi dimensional Post Meta?
- What is an efficient way to query based on post_meta?
- search query within custom taxonomy term, post title and meta field
- How should I intercept the main query and inject custom join / order by / group by criteria
- advice on creating a ‘related posts’ query like the one used on stackexchange
- order post my meta value m/d/y format with year as included value
- Order by meta value, pro first, then free
- Having trouble generating pagination links on custom query
- WP_Query not working as expected for attachments and custom meta_query
- I can’t set meta_key in my custom post type query
- How to create an attachments archive with working pagination?