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;
The topic ‘adding data from custom post type’ is closed to new replies.