The loop doesn’t really contain anything.
It does include methods in order to easily output your data such as the_title()
, this is done when calling the_post()
Then, within the loop you’ll be able to use get_the_ID() and get_post_meta() to get your custom fields (including ACF ones).
So if you have retrieved your desired posts from that query then you’ll be able to do this:
<?php while($loop->have_posts()) : $loop->the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<p>My Custom Field: <?php echo get_post_meta(get_the_ID(),'my-custom-field', true); ?>
<?php endwhile; wp_reset_postdata(); ?>
Hope that helps.
Related Posts:
- ACF – Get lowest & highest value from field
- Multiple taxonomy And acf filter group by
- Any number in meta key (wp query)
- How do I run through a WordPress loop called from a filter function?
- Excluding pages in WP_query using ACF
- Stuck in the query loop
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Expecting statement error from php loop using ACF plugin
- Populate select list with meta values from all posts of a Custom Post Type
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Issue in If else condition [closed]
- Creating array to compare custom field values
- Output ACF field dynamicaly within a taxonomy loop [closed]
- WP_query shortcode inside acf Repeater breaks the repeater loop
- Get post count of current loop when using multiple queries on one page
- Show posts without term
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- Display products from specific category in shop page
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Sort posts by custom taxonomy name
- Loop inside the loop
- Looping through tabular data
- Show default content if custom WP_Query has no posts
- Display featured products through custom loop in WooCommerce 3 [closed]
- meta_query on a date range using an array of values
- Multiple WP_Query loops with Pagination Not Working
- WooCommerce Only OnSale Products Loop Snippet [closed]
- Apply CSS class to every second database record [closed]
- How to prevent writing duplicate loops?
- Get posts for last working week in WP_Query
- How To Fix WP Query Returns Results But Shouldn’t?
- Reset postdata to custom query in nested queries
- What is the random string I am seeing when I use get_query_var?
- WP_Query condition affects posts_per_page count
- Custom Search Not Consistent with Results
- Display both standard posts in a specific category along with a custom post type in a single loop?
- Orderby is working with one query but not with other
- Is there a way to work with a specific the_field from an already queried post? [closed]
- 1/3 of posts different class
- Two loops on archive page
- Loop Split two Columns
- How to order posts by title after they have already been sorted by category
- How to list posts with disabled/closed comments, with pagination?
- How to make a second query offset -2 from current post
- Custom taxonomy.php not working
- Transient api Caches confused
- Best choice for multiple loop in page?
- WP Query – order posts by meta field first and then order the rest
- WP User Query with Custom Fields and Search Results
- Wp_query with 2 meta keys and array of meta values
- How to create custom query by keyword in post title?
- Create a loop on my pages with new “WP_Query”
- WP ForLoop to compare meta information of posts to determine what post to display
- How to filter query loop block with a search string from the query parameters
- How to display post list in a table layout (multiple queries in single loop)
- Different Loop for tag pages?
- Pagination for custom loop on custom page template is not displaying anything
- Filtering by multiple conditions in the loop
- How to access $wp_query object from array of posts given by get_posts?
- Display all attached image of every post of custom post type and link to original post
- 2 queries with counters
- Writing less unnecessary code with WordPress
- Search.php – return number of results but cannot loop through
- Creating ‘posts page’ loop based on the page itself
- WordPress Queries Not Working?
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- How can I use arrays and a foreach to generate many lists with WP_Query?
- Nearby locations using Advanced custom fields, maps?
- Custom wp_query inside a conditional stament inside a template part doesn’t work: why?
- display ACF repater field in archive page
- Duplice post with standard WP loop – fixed by using query_posts() instead
- create custom shortcode wp and put php code in
- Check the stored / cached WP_Query with transients on post change
- New template file does not load category-specific post
- Related posts queries
- Get categories within specific term
- Custom query for custom post type not getting correct post ID
- Query post with content only
- ACF query-pass field value
- Why is my query not giving results?
- why default wordpress loop not working outside index.php
- how to show more than 1 post into three columns query
- Wrap group of wp query posts to parent div by date/year
- Continue loop after $queryObject
- active link for most recent post on vertical tabs
- Wrote a WP Cron Plugin and it triggers a fatal error upon activation
- custom query – offset to pagination
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- List ALL posts within last week from current category on category page
- Get the type of an advanced custom field (ACF) in a WP_Query loop [closed]
- loop through custom post types with meta data
- Using Query In Post Type Archives
- How ‘secure’ are loops?
- Multiple loops on index page with sticky post and pagination
- How to do a loop inside a loop?
- tax_query not working properly with get_posts
- the_excerpt() not working in custom archive
- How can I display sticky posts at first in wp_query?
- How do I subquery with custom meta fields?
- Show number of posts AND number on current page (cannot make it work)