Title: adding data from custom post type
Last modified: August 30, 2016

---

# adding data from custom post type

 *  Resolved [rudtek2](https://wordpress.org/support/users/rudtek2/)
 * (@rudtek2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/adding-data-from-custom-post-type/)
 * I’m creating a site that links doctors to locations.
    I have a ACF field in my
   custom doctor post-type.
 * I’m trying to link back on the locations list page to show the doctors that are
   using the certain location as their offices.
 * when I set the plugin to permalinks, I can get the desired results. Doctors pages
   show the locations i chose for them, and the location single pages show the doctors
   that chose to work at those locations. I cannot get this to work on the list 
   page though (main locations page). Where would i go to edit the code do do this.
   Is there a wordpress loop anywhere?
 * this is the code i need injected into the list page:
 *     ```
       $doctors = get_posts(array(
       	'post_type' => 'team_member',
       	'meta_query' => array(
       		array(
       			'key' => 'relational_relationship',
       			'value' => '"' . get_the_ID() . '"',
       			'compare' => 'LIKE'
       		)
       	)
       ));
   
       if( $doctors ):
       	$doclink='<ul>';
       	foreach( $doctors as $doctor ):
       	$doclink.='<li><a href="'.get_permalink( $doctor->ID ).'">'.get_the_title( $doctor->ID ).'</a></li>';
       	endforeach;
       	$doclink.='</ul>';
       else:
       $doclink='no doctors at this location';
       endif;
       ```
   
 * [https://wordpress.org/plugins/wp-store-locator/](https://wordpress.org/plugins/wp-store-locator/)

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

 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/adding-data-from-custom-post-type/#post-6876547)
 * If I understand correctly, then [this](https://wpstorelocator.co/document/wpsl_store_meta/)
   filter will help you get what you want.
 * You can add the doctor data under for example ‘doctors’, and then use [this](https://wpstorelocator.co/document/wpsl_listing_template/)
   filter to show it in the search result template.
 * If you decided to add the doctor data under the ‘doctors’ key, then you can access
   it under the same key in the template. So in the wpsl_listing_template usage 
   example, you can replace ‘my_textinput’ with ‘doctors’ to make it show up.
 * If that somehow doesn’t work, then you should first make sure the data is include
   in the ajax response. You can do this in a tool like [Firebug](http://getfirebug.com/),
   or any other browser webdevtool.
 *  [lundnick](https://wordpress.org/support/users/lundnick/)
 * (@lundnick)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/adding-data-from-custom-post-type/#post-6876708)
 * Can you have a “search result template” for different categories?
 * From the WP Store Locator interface, I want to return standard mapped results,
   but I also want to return all the locations in the “online” category in a custom
   result to just show the image, and name with a url to the website entered in 
   WP Store Locator. Is this possible?
 * Thanks

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

The topic ‘adding data from custom post type’ is closed to new replies.

 * ![](https://ps.w.org/wp-store-locator/assets/icon-256x256.jpg?rev=1007784)
 * [WP Store Locator](https://wordpress.org/plugins/wp-store-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-store-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-store-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-store-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-store-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-store-locator/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [lundnick](https://wordpress.org/support/users/lundnick/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/adding-data-from-custom-post-type/#post-6876708)
 * Status: resolved