Title: Displaying custom fields
Last modified: March 9, 2021

---

# Displaying custom fields

 *  [aron77](https://wordpress.org/support/users/aron77/)
 * (@aron77)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/)
 * Hello,
    I really like the plugin, thanks for your great work! 🙂 I’m using the
   plugin to display titles from a custom post type. It works great, but I would
   like to add a custom field next to the title. Is it possible?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * (@diddledani)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14155727)
 * Yes, you can do this. The default template at `plugins/a-z-listing/templates/
   a-z-listing.php` must be copied to your theme alongside `style.css` with the 
   name `a-z-listing.php`. From there you can edit it to suit. To access custom 
   fields I suspect you’ll need to add `$post = $a_z_query->get_the_item_object('
   I understand the issues!' );`. The parameter `I understand the issues!` indicates
   to the plugin that you appreciate that larger listings might be slow or cause
   PHP to hit the memory limit defined on your server while using this feature. 
   This is because it loads more information from the database than it normally 
   does to support accessing the full post including custom fields.
 * I’ve shown below with context to indicate where it should go:
 *     ```
       <ul class="columns <?php echo $a_z_listing_column_class; ?>">
       	<?php
       	while ( $a_z_query->have_items() ) :
       		$a_z_query->the_item();
       		$post = $a_z_query->get_the_item_object( 'I understand the issues!' );
       		?>
       		<li>
       			<a href="<?php $a_z_query->the_permalink(); ?>">
       				<?php $a_z_query->the_title(); ?>
       			</a>
       		</li>
       	<?php endwhile; ?>
       </ul>
       ```
   
 *  Thread Starter [aron77](https://wordpress.org/support/users/aron77/)
 * (@aron77)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14156433)
 * Thank you very much!
    I added the line to the code, then added after the this:
   <?php the_field(‘myfield’); ?> But the field is not showing up. Should I add 
   something else too, or do I need to use some other code?
 *  [mistermarian](https://wordpress.org/support/users/mistermarian/)
 * (@mistermarian)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14157076)
 * Hey aron77,
 * I am working on the same thing at this very moment and got my custom field to
   display via
    `<?php $post_id = false; the_field('myfield', $post_id); ?>` $post_id
   = false -> is current post hope this helps!
 * [@diddledan](https://wordpress.org/support/users/diddledan/) many thanks for 
   your helpful post! =)
    -  This reply was modified 5 years, 2 months ago by [mistermarian](https://wordpress.org/support/users/mistermarian/).
 *  Thread Starter [aron77](https://wordpress.org/support/users/aron77/)
 * (@aron77)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14171616)
 * Thanks, but unfortuantely I still cannot display it. Maybe because I’m using 
   a custom post type?
 *  [mistermarian](https://wordpress.org/support/users/mistermarian/)
 * (@mistermarian)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14172448)
 * That’s strange I am using a cpt too.
    `[a-z-listing post-type="mycustomposttype"]`
 * [@diddledan](https://wordpress.org/support/users/diddledan/) Can you maybe give
   me a pointer on where to add the custom css file?
    I tried a-z-listing.css & 
   a-z-listing-customize.css in theme root folder (next to my custom a-z-listing.
   php) but to no avail… thanks!
 *  [mistermarian](https://wordpress.org/support/users/mistermarian/)
 * (@mistermarian)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14185138)
 * [@aron77](https://wordpress.org/support/users/aron77/) In case you haven’t already:
   Just add some static text to your a-z-listing.php and see if it displays. If 
   it does not, you need to put it in a different folder…
 * About my CSS issue:
    I am using Elementor (which could be the problem with the
   custom.css file). I ended up adding the custom css to the shortcode element in
   the elementor builder, not perfect but it works.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Displaying custom fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/a-z-listing_d8edfd.svg)
 * [A-Z Listing](https://wordpress.org/plugins/a-z-listing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/a-z-listing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/a-z-listing/)
 * [Active Topics](https://wordpress.org/support/plugin/a-z-listing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/a-z-listing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/a-z-listing/reviews/)

## Tags

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

 * 6 replies
 * 3 participants
 * Last reply from: [mistermarian](https://wordpress.org/support/users/mistermarian/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/displaying-custom-fields-10/#post-14185138)
 * Status: not resolved