Basically, I am reading right out of the Codex page for WP_Query
.
You want a meta_query
similar to this with an orderby
parameter with the two values you want to order by. The first is dominant.
$args = array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'rating',
'value' => 3,
'compare' => '>'
)
),
'orderby' => 'rating post_date',
'order' => 'DESC'
);
$query = new WP_Query( $args );
I don’t know what your rating
field is named and I don’t have your posts and your ratings on my system so I can’t test that. Hopefully that will get you started.
Related Posts:
- WP_Query sort by meta_value_num or date
- WP_Query orderby not working with meta_value_num and menu_order
- Creating Ordered Query using Meta_key
- How do I reorder (pop and push) items from WP_Query?
- Update all posts automatically when using post_meta
- Reverse chronology of post listing
- Better post meta efficiency?
- Change post format using custom field
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- What Is meta_id In wp_postmeta?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- Automatic value for custom fields for posts
- is there a way to show the the post title after the image?
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- Query Posts With Over 1000 Views
- Cannot retrieve a custom RSS field from posts
- How to order posts by meta_value and title
- Query Posts by Custom Field
- how to get post order by post id wp_query?
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- Create a list of posts with topic headdings
- if in category but only with post meta
- wp_query with ajax
- Saving Post Data in Another Database
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Add multiple meta keys to a post at once
- WP_Query custom field pass the post id
- saving/reading custom field value does not work – no value gets POSTed
- Override WordPress core post-template.php block template
- Post meta not working
- query posts with selected post ids first
- How do you update post date (year only) in a separate custom field?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- How do I display posts ordered by a date custom field?
- Random order of the 5 most popular posts
- My custom query is displaying random posts in random order
- Get query result according to merged array
- Show posts between two Custom Fields date
- WP Query between posts custom fields [duplicate]
- Order posts by separate menu order for different sub-categories
- Order by ‘s’ using WP_Query()
- How enter custom post meta or custom field on box post list archive page?
- WP_query sort by custom meta_key “price”
- Image inside the content is replaced with featured image from my older post
- Can wp_query return posts meta in a single request?
- How to check if post meta key exists or not in wordpress database
- How to Change Order of Posts in Admin?
- Accessing the post content with WP_Query
- meta_query where value is equal to given value
- Setting post meta data to random value during post status transition / on publish
- Add custom field to all posts in specific category
- WordPress altering my custom query, How to fix it?
- If specific user role then sticky post
- How to add a custom field after wp post
- Order Posts by meta value AND published date
- post re-order on my site
- Only display posts after current date
- I want to query posts in monthly basis
- Custom WP_QUERY $args
- How do I use wp_query for WordPress search?
- Limiting the number of posts in WP_Query leads to unexpected result
- Guest Author – How to display posts on /author/ archive page
- Fetch Record based on meta key dates
- How to insert 2 args into 1 Wp_Query for a slideshow
- WP Query – Posts Per Page not working in combination with category__in
- how to change the number of posts returned in a specific loop without making it global?
- Redirect to another page using contact form 7? [closed]
- How to automate featured posts number? [duplicate]
- How to save meta checkbox WordPress
- Query for first 3 posts to change the look and feel
- Getting blog pagination to work on page set as front page
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- search blog posts by author first name and or last name
- unique post in “$args” of wp_query display more than one post
- Custom permalink for each post
- Is there a way getting post fields using `transition_post_status`
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- WordPress query portfolio posts
- Get latest author posts inside the loop
- Display 3 posts with different HTML markup using a loop
- Why my meta boxes won’t show in front post page?
- How to show multiple posts thumbnail, title and date in widget
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Featured Images most often doesnt appear
- Manipulated offset and pagination, can’t display last post anymore
- How to display particular set of wordpress post on a webpage?
- Meta key in wp_query bug?
- Is it possible to query a category with specified posts?
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Custom fields in normal posts
- Query to get data of a post, if in category?
- Order posts by custom field
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Remove duplicated posts in the loop if post has more than one category
- Why I getting only 1 post?
- get_post_meta property of non object
- First post in loop displays twice