-
-
Save nirbhay18/f437bfdfc209a17e29b7965f1801df23 to your computer and use it in GitHub Desktop.
Shortcode to Fetch data from ACF Pro Google Map Field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode( 'pp_map' , function( $atts ) { | |
if (!function_exists('get_field') ) return ''; | |
$atts = shortcode_atts( array( 'field' => false , 'sub' => 'address' ) , $atts, $shortcode = 'pp_map' ); | |
if ($atts[ 'field' ] && $map = get_field( $atts[ 'field'] ) ) { | |
if ( isset( $map[ $atts['sub'] ] ) ) return $map[ $atts['sub'] ]; | |
} | |
return '[ something went wrong ]'; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment