//添加简码

functionBing_add_google_map($atts,$content){

    $GLOBALS['google_map_shortcode']=true;

    return'地图的代码';

}

add_shortcode('google_map','Bing_add_google_map');

//挂载脚本

functionBing_add_javascript(){

    global$google_map_shortcode;

    if(isset($google_map_shortcode)&&$google_map_shortcode)wp_enqueue_script('map_scripts');

}

add_action('wp_footer','Bing_add_javascript');