Title: List by Custom Attribute
Last modified: August 22, 2016

---

# List by Custom Attribute

 *  Resolved [azchipka](https://wordpress.org/support/users/azchipka/)
 * (@azchipka)
 * [12 years ago](https://wordpress.org/support/topic/list-by-custom-attribute/)
 * Ok so what I am trying to do is create a list of locations stored in event manager
   that have a positive value in a custom attribute field.
 * So step one of course is add the conditional placeholder:
 *     ```
       // #_LATT{ServiceOptDetails}
                   case 'has_ServiceOptDetails':
                       if (is_array($EM_Event->location_attributes) && !empty($EM_Event->location_attributes['ServiceOptDetails']))
                           $replacement = preg_replace('/\{\/?has_ServiceOptDetails\}/', '', $match);
                       else
                           $replacement = '';
                       break;
       ```
   
 * Now I had assumed that the following code would generate a list of locations 
   that included a positive value in ServiceOptDetails using the following code 
   on a page.
 *     ```
       <table class="minimal_table">
       <tr><td>Location</td><td align="center">City</td><td align="right">More Info</td></tr>
       [locations_list]
       {has_ServiceOptDetails}
       <tr><td>#_LOCATIONNAME</td><td align="Center">#_LOCATIONTOWN</td><td align="right"><a href="#_LOCATIONURL">Get More Info</a></td></tr>
       <tr><td colspan="3">#_LATT{ServiceOptDetails}</td></tr>
       {/has_ServiceOptDetails}
       [/locations_list]
       </table>
       ```
   
 * And yet my list comes up empty.
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

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

 *  Thread Starter [azchipka](https://wordpress.org/support/users/azchipka/)
 * (@azchipka)
 * [12 years ago](https://wordpress.org/support/topic/list-by-custom-attribute/#post-5198473)
 * Ok so I got it working had it set to $EM_Events instead of locations.
 * The problem that remains is a space is still being made in the table for the 
   locations that do not have ServiceOptDetails set.
 * Resulting in a ton of blank space at the top of the table.
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [12 years ago](https://wordpress.org/support/topic/list-by-custom-attribute/#post-5198607)
 * maybe you can use custom css styling with regards to the blank space?

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

The topic ‘List by Custom Attribute’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/list-by-custom-attribute/#post-5198607)
 * Status: resolved