I agree with Rarst about the WEEK function, but be sure to also use YEAR as well to order the posts. So your order by would look something like this:
ORDER BY YEAR($wpdb->posts.post_date) DESC, WEEK($wpdb->posts.post_date) DESC, $wpdb->postmeta.meta_value+0 DESC
Of course, this is still pulling all posts, so you might also want to just limit the query to only pull the current year by adding this to your WHERE clause.
AND YEAR($wpdb->posts.post_date) = YEAR(CURDATE())
Related Posts:
- Sort posts by category name and title
- Query Set Order By Author
- How to orderby meta_value_num with dollar ($) sign
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- Ignoring ‘a’ when sorting posts
- query loop “inherit query from template” prevents setting sort order
- When should you use WP_Query vs query_posts() vs get_posts()?
- order by numeric value for meta value
- Wp get all the sub pages of the parent using wp query
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Return only Count from a wp_query request?
- How to query for most viewed posts and show top 5
- WP_Query vs get_posts
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Comment_Query pagination, delving into the unknown
- Random sort within an already sorted query
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Make a WP Query search match exactly the search term
- WP_Query: query posts by ids from array?
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- How to get order of posts?
- How to uniquely identify queries?
- What is the most efficient way of querying posts based on visits and date for current day?
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- WP Query orderby meta key natural sort?
- WP_Query for WooCommerce Products
- pre_get_posts with get_posts
- author.php with ACF and CPTs
- Query Custom Meta Value with Increment
- When should you use wp_reset_postdata vs wp_reset_query?
- Loop through all tags & output posts in alphabetical list
- Get posts by meta data OR title
- Identify which loop you are hooking into; primary or secondary?
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- How to make an activities stream mixing posts and comments?
- Duplicate Queries
- How to query for a week using key => value WP_Query argument notation?
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Show only oldest post by author
- Order posts by tags count?
- SQL query equivalent to WP User Query
- Add and in the header while looping over custom query in page template
- How to get the posts published in last two days using WP_Query?
- Highlighting Sub topic in a post?
- Sorting Posts by custom field
- Which custom query am I in and how can I access its properties & methods?
- How to count post type that has a particular term?
- Finding the next 5 posts
- Sorting meta_value as integer doesn’t work
- how to retrieve specific product attribute value in an sql query?
- Dynamically Override Fancy Title – Part II
- Sort in WP_Query(), not filter? Is it possible?
- Transient pagination not working properly
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- Can not switch the queried post in pre_get_posts hook
- Front End Sorting Questions
- view queries made?
- Woocommerce custom loop to show all the products [closed]
- Sort by meta key on archive page
- meta_query on a date range using an array of values
- WP_Query Performance Issues with meta_query
- WordPress custom archive page
- How to speed up wp_query, took more 5s to run against 100k posts
- How to sort posts in admin by titles with dd.mm.yyyy format?
- WP_query category__in not working, only pulls from first category
- How to detect custom query inside `posts_where` hook?
- Pass the same object to multiple widgets in a template with one query
- Is temporarily overwriting $wp_query a bad idea?
- Get the post permalink within the loop but without additional DB query
- List the 5 most recent child pages
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Retrieve or Query Pages by ID
- WordPress: Keep order of query_posts list of post ID’s using post__in
- How do you query wordpress posts using a math formula between multiple meta field values?
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Custom Post order for homepage
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Get image of latest post from taxonomies/categories
- How to output different posts per page?
- Meta query with order by another custom field
- How to do a query on custom taxonomies that is uncategorised?
- Page navigation doesn’t show when query category
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Undefined WP_Query::has_posts()?
- Is it possible to dynamically get queried term AND taxonomy?
- Empty tax_query array returns an empty array
- Meta Query for specific months
- What is considered a default query for the request filter?
- How do I search inside specific taxonomies in WordPress
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- $wpdb insert is not work
- Pass array of taxonomy terms to wp_query
- Different string for specifed post type on posts listing at homepage
- if/else on custom query gives 200 OK when condition not met?
- How do I sort posts with multiple pages
- Pull post meta with post_query?