Title: do_shortcode JS and CSS files
Last modified: August 21, 2016

---

# do_shortcode JS and CSS files

 *  Resolved [Pepperbase](https://wordpress.org/support/users/pepperbase/)
 * (@pepperbase)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-js-and-css-files/)
 * Hi,
 * On mobile devices I would like to do an Ajax call to show a map. The map is showing,
   but it only shows ‘map is loading’ message. I use do_shortcode to show the map,
   but because do_shortcode is not in the template the JS and CSS files are not 
   loaded. How can I load the appropiates JS and CSS files manually?
 * This code is not working:
 *     ```
       add_action('wp_enqueue_scripts', 'my_scripts_method');
       function my_scripts_method() {
   
       	if((is_home()) || (is_page(array(16,19,21,23,25)))){
       	wp_deregister_script( 'ai1ec_requirejs' );
       	}
   
       	if ('ai1ec_event' !== get_post_type() && is_single()) {
       	global $wp_styles;
       	$plugin_version = get_option('leafletmapsmarker_version');
       	wp_register_style('leafletmapsmarker', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.css', array(), $plugin_version);
       	wp_enqueue_style('leafletmapsmarker');
       	wp_register_style('leafletmapsmarker-ie-only', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.ie.css', array(), $plugin_version);
       	wp_enqueue_style('leafletmapsmarker-ie-only');
       	$wp_styles->add_data('leafletmapsmarker-ie-only', 'conditional', 'lt IE 9');
   
       	wp_register_script( 'leafletmapsmarker', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.js', array('leafletmapsmarker-googlemaps-loader', 'jquery' ), $plugin_version, true);
       	wp_register_script( 'show_map', LEAFLET_PLUGIN_URL . 'inc/js/show_map.js', array('leafletmapsmarker' ), $plugin_version, true);
       	wp_register_script( 'leafletmapsmarker-googlemaps-loader', 'https://www.google.com/jsapi?key='.$google_maps_api_key, array(), 3.7, true);
       }
       }
       ```
   
 * Is there anything else I should do to make it work?
 * [http://wordpress.org/extend/plugins/leaflet-maps-marker/](http://wordpress.org/extend/plugins/leaflet-maps-marker/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Robert Seyfriedsberger](https://wordpress.org/support/users/harmr/)
 * (@harmr)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-js-and-css-files/#post-3896126)
 * Hi Pepperbase,
 * I am not quite sure, but you could try changing the following settings under 
   Misc:
 * Where to insert Javascript files on frontend?
    and Support for conditional css
   loading
 * Perhaps changing the default value here could help.
    best,
 * Robert
 *  Thread Starter [Pepperbase](https://wordpress.org/support/users/pepperbase/)
 * (@pepperbase)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-js-and-css-files/#post-3896127)
 * Hi,
 * Yes that works, but I want to use Ajax on mobiles for performace reasons. Loading
   JS in the header and CSS on all pages wouldn’t help 🙂
 * Anyway, I decided to open a new page and send the marker via the url.
 * Thanks.
 *  Plugin Author [Robert Seyfriedsberger](https://wordpress.org/support/users/harmr/)
 * (@harmr)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-js-and-css-files/#post-3896272)
 * OK (marking this topic as resolved)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘do_shortcode JS and CSS files’ is closed to new replies.

 * ![](https://ps.w.org/leaflet-maps-marker/assets/icon.svg?rev=970936)
 * [Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)](https://wordpress.org/plugins/leaflet-maps-marker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/leaflet-maps-marker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/leaflet-maps-marker/)
 * [Active Topics](https://wordpress.org/support/plugin/leaflet-maps-marker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/leaflet-maps-marker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/leaflet-maps-marker/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 3 replies
 * 2 participants
 * Last reply from: [Robert Seyfriedsberger](https://wordpress.org/support/users/harmr/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-js-and-css-files/#post-3896272)
 * Status: resolved