Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertdevore/844b7f7e59cb0bce8718763592485971 to your computer and use it in GitHub Desktop.
Save robertdevore/844b7f7e59cb0bce8718763592485971 to your computer and use it in GitHub Desktop.
Display your menu item's selected locations to shortcode output
<?php
/**
* Display your selected location(s) within the WP Dispensary shortcodes
* Requires the "Dispensary Locations" add-on from WP Dispensary
*
* @link https://www.wpdispensary.com/downloads/dispensary-locations
*/
add_action( 'wpd_shortcode_inside_top', 'acme_mylocation' );
function acme_mylocation() {
global $post;
echo '<span class="mylocation">' . get_the_term_list( $post->ID, 'dispensary_locations', '', ', ' ) . '</span>';
wp_reset_postdata();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment