Title: convert ids to names
Last modified: August 21, 2016

---

# convert ids to names

 *  Resolved [tkhan](https://wordpress.org/support/users/tkhan/)
 * (@tkhan)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/convert-ids-to-names/)
 * Hi,
 * I am now trying to display
    your search for (category name, style name, location)
   etc above the search results.
 * I can get the location and distance using $get, but the category and style
    are
   returned as ids, how can I convert the ids to names?
 * Cheers
 * Tkhan
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

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

 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/convert-ids-to-names/#post-4726320)
 * Hi Tkhan,
 * All the search parameters are contained in an array called $args.
 * If you add `print_r($args);` to your search template and run a search you’ll 
   see a listing of all the parameters you can access.
 *  Thread Starter [tkhan](https://wordpress.org/support/users/tkhan/)
 * (@tkhan)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/convert-ids-to-names/#post-4726349)
 * Hi,
    Have tried ‘print_r($args);’ as suggested, unfortunately the category and
   style are in id format. For instance if I use ‘print_r($args[category]);’ it 
   prints the category id of 73.
 * Although I have managed to sort this for the categories as they are taxonomies
   by using
 * ‘$array = get_term_by(‘id’, $_POST[‘category’], ‘event-categories’, ‘ARRAY_A’);
   print_r($array[name]);}’
 * it doesn’t work for the styles which are generated via the ‘CREATING AN EVENTS
   MANAGER ADD-ON : A COMPLETE WALKTHROUGH’ tutorial and are not taxonomy terms.
 * Any pointers would be fantastic.
 * Tkhan
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/convert-ids-to-names/#post-4726383)
 * Can post the code you’re using?
 *  Thread Starter [tkhan](https://wordpress.org/support/users/tkhan/)
 * (@tkhan)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/convert-ids-to-names/#post-4726388)
 * Hi caimin_nwl
 * wasn’t sure what code you are referring to the code used to create the styles
   as per walkthrough or the code used to produce the output. To create the output
   I am using the events-list.php.
 * As mentioned above ‘$args’ produces [category] => 73 [style] => 2.
 * my events-list.php is as follows:
 * ‘$args = apply_filters(’em_content_events_args’, $args);
    if( get_option(‘dbem_css_evlist’))
   echo “<div class=’css-events-list’>”;
 * $array = get_term_by(‘id’, $_POST[‘category’], ‘event-categories’, ‘ARRAY_A’);
   print_r($array[name]);
 * print_r($args[style]);
 * echo EM_Events::output( $args );
 * if( get_option(‘dbem_css_evlist’) ) echo “</div>”;’
 * I can output each of the styles using
 * ‘$my_em_styles = (is_array(get_option(‘my_em_styles’))) ? get_option(‘my_em_styles’):
   array();
    printArray2($my_em_styles); function printArray2($array){ foreach (
   $array as $key => $value){ echo “$value”; } }’ unfortunately this prints all 
   the style names and is not restricted to those searched for, would it be possible
   to modify the top line to include only search values.
 * Sorry for asking so many questions its not that important really, just really
   annoying when you get a idea and don’t know have a clue how to implement it.
 * Thanks again Tkhan.

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

The topic ‘convert ids to names’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [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/)

 * 4 replies
 * 2 participants
 * Last reply from: [tkhan](https://wordpress.org/support/users/tkhan/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/convert-ids-to-names/#post-4726388)
 * Status: resolved