Title: Using the plugin with advanced custom fields
Last modified: September 7, 2018

---

# Using the plugin with advanced custom fields

 *  [biscuitier0](https://wordpress.org/support/users/itsaskew/)
 * (@itsaskew)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/using-the-plugin-with-advanced-custom-fields/)
 * Hi, great plugin!
 * I have a page which shows posts that are a custom post type called ‘writers’,
   the trouble is that the Writer names are put into the post title field (first
   name, surname) meaning that the A-Z only works by first name. I thought I could
   use the ACF plugin to create a custom field called ‘A-Z surname’ or similar and
   use that but cannot quite make it work. Is it possible? or is there a better 
   way to achieve what I am aiming for?
 * Many thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fusing-the-plugin-with-advanced-custom-fields%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * (@diddledani)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/using-the-plugin-with-advanced-custom-fields/#post-10667467)
 * It might be possible to do this by adding some PHP code that hooks into the filter
   called `a_z_listing_item_indices`:
 * [https://a-z-listing.com/reference/hooks/a_z_listing_item_indices/](https://a-z-listing.com/reference/hooks/a_z_listing_item_indices/)
 * The return value needs to be of the format:
 *     ```
       return array( $index_letter => array( array(
           array(
               'title'     => get_the_title( $post ),
               'item'      => $post, // the post object as passed into the function
               'permalink' => get_the_permalink( $post ),
           )
       ) );
       ```
   
 * Yes there is a double-nested array, allowing for you to add multiple index letters
   for the same post, or multiple instances under the same index letter.
 * You’ll need to take the title from the post and perform your custom match to 
   find the correct index letter (last name’s first letter) and use that in your
   return.
 *  Thread Starter [biscuitier0](https://wordpress.org/support/users/itsaskew/)
 * (@itsaskew)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/using-the-plugin-with-advanced-custom-fields/#post-10673069)
 * Thanks very much for your reply.
 * Unfortunately this poses something of a puzzle for my current level of php understanding.
   Are we talking about adding your code above to the functions.php as part of a
   function, something like the one you talk about here? [https://wordpress.org/support/topic/sort-posts-on-a-custom-fields-value/](https://wordpress.org/support/topic/sort-posts-on-a-custom-fields-value/)
 * Any extra info you could give would be greatly appreciated
 *  Plugin Author [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * (@diddledani)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/using-the-plugin-with-advanced-custom-fields/#post-10686221)
 * Yes, exactly like that.

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

The topic ‘Using the plugin with advanced 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

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

 * 3 replies
 * 2 participants
 * Last reply from: [Dani Llewellyn](https://wordpress.org/support/users/diddledani/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/using-the-plugin-with-advanced-custom-fields/#post-10686221)
 * Status: not resolved