Title: ACF plugin  &#8211; showing data?
Last modified: August 30, 2016

---

# ACF plugin – showing data?

 *  [jbiddulph](https://wordpress.org/support/users/jbiddulph/)
 * (@jbiddulph)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/acf-plugin-showing-data/)
 * Hi,
 * So I started using Advanced Custom Fields but I am not sure how to use it, I 
   have been through their documentation and I have managed to get SOME data out
   but not all….
 *     ```
       <?php while ( have_posts() ) : the_post(); ?>
   
       				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
   
       				<?php if ( ! $is_page_builder_used ) : ?>
   
       					<h1 class="main_title">&nbsp;</h1>
       					<?php
   
       $posts = get_posts(array(
       	'numberposts' => -1,
       	'post_type' => 'pub',
       	'meta_key' => 'pub_name'
       ));
   
       if($posts)
       {
       	echo '<ul>';
   
       	foreach($posts as $post)
       	{
       		echo '<li><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a> - '. the_post('town').'</li>';
       	}
   
       	echo '</ul>';
       }
   
       ?>
       ```
   
 * My code here outputs the following:
    another pub – The Spotted Cow Inn –
 * this is correct but ‘town’ is not being output?!
 * Please help

Viewing 1 replies (of 1 total)

 *  [Sören Wünsch](https://wordpress.org/support/users/soean/)
 * (@soean)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/acf-plugin-showing-data/#post-6804223)
 * try
    `the_field('town')` Doc: [http://www.advancedcustomfields.com/resources/the_field/](http://www.advancedcustomfields.com/resources/the_field/)

Viewing 1 replies (of 1 total)

The topic ‘ACF plugin – showing data?’ is closed to new replies.

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Sören Wünsch](https://wordpress.org/support/users/soean/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/acf-plugin-showing-data/#post-6804223)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
