setup_postdata will let you use loop functions with post results via get_posts
.
another option is to use the various filters available to alter WP_Query
‘s behavior- posts_join
, posts_where
, posts_orderby
.
Related Posts:
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Display products from specific category in shop page
- Exclude post on loop by multiple meta key value
- How to change a custom query into a standard loop?
- How to query ‘posts_per_page’ to display a different blog posts index template?
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- Query sticky posts with thumbnails
- WP_Query on custom field and order results
- Any number in meta key (wp query)
- Filtering posts from different categories into different section by doing WP_Query only once
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Query most popular terms by taxonomy over 2 week period
- Custom taxonomy.php not working
- Array as ‘key’ in WP_Query
- How to provide meta_key array to wp_query?
- Wp_query with 2 meta keys and array of meta values
- Meta query compare for ID’s greater than specific ID
- WP_Query not returning correct result with meta_query parameter
- show most viewed post
- Meta Query if Values Don’t Exist
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Output ACF field dynamicaly within a taxonomy loop [closed]
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- Post Query with Meta Query no longer working
- Meta_query compare operator explanation
- meta_query with meta values as serialize arrays
- How to print the excuted sql right after its execution
- Nested meta_query with multiple relation keys
- Can I force WP_Query to return no results?
- Resetting post data to previous loop in nested loops
- Some doubts about how the main query and the custom query works in this custom theme?
- meta_query ‘compare’ => ‘IN’ not working
- Get post count of current loop when using multiple queries on one page
- Multiple WP_Query loops with Pagination
- Pagination with custom SQL query
- Return only Count from a wp_query request?
- Using a custom WP_Query with get_template_part loop
- Use REGEXP in WP_Query meta_query key
- WP Query Args – Title or Meta Value
- Meta query with string starting like pattern
- compare meta_query in get_posts arguments
- How to query posts based on lat-lng coordinate as post meta?
- WP_Query vs get_posts
- how to show posts that are missing a meta_value
- Set Alias for meta_query arguments in get_posts()
- Sorting: custom query with orderby meta_value_num THEN by title
- Loop within a loop?
- WP_Query and next_posts_link
- Show posts without term
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- How to list some posts first in the loop based on post id
- Pagination returns 404 after page 20
- Make loop display posts by alphabetical order
- WP_Query: query posts by ids from array?
- Use WP_Query with have_posts()?
- How to Compare Two Meta Fields
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- how does $wpdb differ to WP_Query?
- get custom post type by tag
- Does tax_query really beats meta_query in all situations?
- How to get order of posts?
- Order posts by ID in the given order
- WP_Query with checkbox meta_query
- ACF Relationship Field Search Filtering [closed]
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- get_template_part in for loop
- Getting attachments by meta value
- Query Multiple Post types each with own meta query
- Get array of posts from the current archive page loop
- pre_get_posts with get_posts
- Is it true $wpdb->get_results is faster than WP_Query in most cases?
- How-to exclude terms from the main query the most performant way?
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- Execute a large WP_Query with many “AND” Meta_Queries?
- Executing Queries in tag.php
- Display posts the match taxonomy term linked from wp_list_categoies?
- How can I save an array from a random post sequence for later use?
- How to place a loop within another loop?
- WordPress Custom Query to show posts from last x years
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Query all posts where meta value is empty
- How to order posts tag by tag?
- WP_Query min and max values
- Query Custom Meta Value with Increment
- “pre_get_posts” firing on every query
- Show two random posts from custom post type
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Loop through all tags & output posts in alphabetical list
- Use WP_Query with a custom SQL query
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Pagination with 5 posts per page
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- Using custom meta_query with relation not working as expected
- Identify which loop you are hooking into; primary or secondary?
- Perform query with meta_value date