my script is
function($) {
var google_map_address = $('#address').text();
$(function () {
$('#gmap').gmap3({
marker: {
address: google_map_address
},
map: {
options: {
zoom: 14
}
}
}); });})(jQuery);
and my php code is
init_shortcode();
function init_shortcode() {
$shortcodes = array(
'gmap' => 'spyrowebs_gmap');
foreach( $shortcodes as $tag => $func )
add_shortcode( $tag, $func );
}
function spyrowebs_gmap( $atts = array(), $content = '' ) {
$defaults = array(
'address' =>'',
);
$atts = shortcode_atts( $defaults, $atts );
extract( $atts );
$address=$address;
return ' <div class="gmap" id="gmap"><div id="address" style="display:none">'.$address.'</div></div>';
}
but this does not work i want to create a shortcode like
[gmap address="your address"]
now what is the problem when i assign a value to javascript variable like
var google_map_address = 'your address';
then its work while in the above its not working please any help. when i put the above code in my theme its work but when i use it in my plugin its not work.
(at the start of the first piece of JavaScript code a typo?function($) {, shouldn't that be(function($) {?