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 query posts by category and tag?
- How do I query by post format in WordPress 3.1
- How to set posts per page using WP_Query()
- Meta compare with date (stored as string) not working
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Custom Post Type “Event”: chronological list of recurring events
- Order by meta value, pro first, then free
- How to create an attachments archive with working pagination?
- order by meta_value serialized array
- Documentation for post meta
- how could I get the pagination as I want to when query posts using get_posts function
- Counter code for paginated category pages in wordpress
- Author List page: Exclude based on last post date
- Comparisson between date() and a date from wp_postmeta
- query_posts sort in multiple directions
- Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)
- Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output
- Displaying posts with only upcoming dates according their custom field date value
- exclude ids through post__not_in
- Display custom post types with custom date field value (before today) & order by custom date field
- Integrating post archive wtih another source and preserving date ordering
- Order posts using a custom array
- Query metas (and not : query posts by metas)
- How can I sort homepage by a meta value?
- Show Only Posts Owned By Logged In User + my post
- Custom MySQL Query with logic
- trouble with query to fetch next and previous posts
- Permalink structure with $_SESSION variables
- Hook to return true when the_post() is used in a custom while loop
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- $wpdb class updating meta_value using Ajax [closed]
- Proper syntax to add boolean in array()
- using query_posts to pull posts out of a category in a while loop. Getting odd echo
- Echo a numerical value in query_posts
- Query posts to get all but the most recent post
- Always using the same ARRAY on different querys
- Avoiding ACF get_field and returning to core WordPress function
- How do I use pagination in WordPress?
- Querying multiple values from a single key
- Does WordPress run a post query when a page is invoked?
- find custom post type post by searching its custom field with my string
- Multiple posts/pages in one page?
- get_post_meta with WP_query
- Excluding posts by meta, and also keeping posts without the meta
- How to check a list or feed of all posts under a category and tag?
- Calling Posts from Specified Cat
- How do I add a timezone offset to this query?
- query_posts thumbnail condition
- Show posts from specific roles
- How to add an “or” instead of and “and” (&) in a WordPress query?
- Instead of 4 loops, how can I do it better?
- Modify main loop query for paged and meta key
- wordpress query_posts featured page always on top
- I can not display meta value in extras.php and template-tags.php
- Need to add a space after meta value in query_posts in wordpress for zipcode search
- show most viewed post
- Why can my filter query SOME metadata but not other metadata?
- I need query_posts() to order results first by a meta value and then by post ID
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Orderby query does not work for custom fields even with meta query
- How to get meta value based on latest post id with group by term name
- Return a single custom post from multiple meta queries
- query post based on comparison
- Including post data in a sidebar occurring outside of and before the Loop
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)