Use this code:
$args = array(
'post_type' => 'food',
'orderby' => 'meta_value_num',
'meta_key' => 'listing_price',
'order' => 'DESC',
'posts_per_page' => $count,
'paged' => $paged,
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ):
while ( $loop->have_posts() ) :
$loop->the_post();
echo get_the_title();
echo get_the_content();
endwhile;
endif;
Related Posts:
- Adding additional data to WP_Post object
- WP_Query: Why is sticky post not first item in loop?
- Displaying the category name of a custom post type
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Reverse chronology of post listing
- WP_Query to work with custom view
- Most viewed post for the last 2 days using WP_Query
- Adding Post Counts to Menu (Nav) Programmatically?
- This AJAX Code Doesn’t Work – Looking for elegant solution
- How to add posts to wp_query result?
- Posts for next month
- WP_Query only ONE post, won’t work
- Unable to modify(update) posts – Page not found
- Replace Main Query With Custom Query
- Fetch posts from current week (Sunday to Saturday)
- Hide Post comments when displayed via WP_Query
- Hiding posts in a list from specified categories
- Group posts by year in loop
- wp query with dynamic taxonomies and terms?
- How to get posts by multiple post slugs? [duplicate]
- Blogroll – Different layout for first post
- WP_Query do not load specifed number of post
- WP_Query: offset ignored when posts_per_page is -1?
- How do I use `posts_distinct` correctly?
- How can I remove posts of a certain category from homepage after a specified time period?
- Automatic value for custom fields for posts
- Loop through all product posts?
- Get random posts between specific dates / of specific age
- How to find what index page a post is on?
- Display post from current category and same tag?
- Ajax load more button in Recent posts widget
- WP_Query orderby not working with meta_value_num and menu_order
- Custom WP_Query with complex ‘post_status’ argument
- 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?
- Blog post per page setting conflicting with custom WP_Query?
- How to filter my search in post if contains a word in title, content or excerpt?
- How to return another post than requested
- Select only post id and meta value with WP_Query
- Random ajax load only works with posts_per_page set to -1
- Query posts and return XML
- how to change the number of posts returned in a specific loop without making it global?
- posts_per_page option limits the number of Gallery items
- Nested WP_Query breaking loop
- Why Query is returning empty array?
- meta_value timestamp older than now
- Get posts with multiple categories
- Do not show children of a category
- Query for first 3 posts to change the look and feel
- Getting blog pagination to work on page set as front page
- search blog posts by author first name and or last name
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- How to give classname to post if post has no content?
- Custom wp-query in wordpress rest api
- posts_per_page returning only one post
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- WP_Query custom field pass the post id
- WordPress query portfolio posts
- Current and next month posts
- Get latest author posts inside the loop
- Same post appears in related Posts?
- Display 3 posts with different HTML markup using a loop
- How to show multiple posts thumbnail, title and date in widget
- WP_Query outputs wrong post in custom post type
- how to show comments only author which send own posts in wordpress
- Group first, 2nd, 3rd, etc posts by category terms
- Manipulated offset and pagination, can’t display last post anymore
- How to sort WP_Post Object array by object field in php?
- Order by meta_key field in WordPress not meta_value field value
- How to display particular set of wordpress post on a webpage?
- How to create page with post content in it?
- How to remove a post from results by ID after query?
- Show 5 posts and than 3 posts offset with pagination
- Override wp_link_pages pagebreak with filter
- WP_Query extended with AJAX
- Is it possible to query a category with specified posts?
- Blog only showing one post even though more published
- WordPress loop uses unmodified posts array, why?
- Sort / Filter Queries
- Show posts between two Custom Fields date
- Query to get data of a post, if in category?
- Order posts by custom field
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- Remove duplicated posts in the loop if post has more than one category
- Order posts by separate menu order for different sub-categories
- Adding a category at even positions on main loop with modified pagination
- Why I getting only 1 post?
- What is wrong with this wp_query?
- Exclude sub sub categories from displaying in the archive page
- First post in loop displays twice
- Get related posts matching most of the provided tags using WP_Query
- WP_Query post_tilte search in posts table
- Is it possible to use the_post 2 times in one loop