Title: Enable automatic CSS and JS loading
Last modified: August 21, 2016

---

# Enable automatic CSS and JS loading

 *  [webembassy](https://wordpress.org/support/users/webembassy/)
 * (@webembassy)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/enable-automatic-css-and-js-loading/)
 * Greetings,
 * I’m getting stuck trying to figure out how to enable automatic CSS and JS loading.
 * > For efficiency, the plugin only loads the required JavaScript, CSS and markup
   > files on pages where it detects the map shortcode is being called.
 * In my case I need them to be loaded all the time, as there are some spots where
   the page slug is not available. I’ve checked the installation guide and the do_shortcode
   works well on the most pages, though, as I mentioned before, I need to disable
   the slug-check and make the JS/CSS available all the time.
 * I appreciate any help! Thanks in advance
 * [http://wordpress.org/extend/plugins/basic-google-maps-placemarks/](http://wordpress.org/extend/plugins/basic-google-maps-placemarks/)

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

 *  Thread Starter [webembassy](https://wordpress.org/support/users/webembassy/)
 * (@webembassy)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/enable-automatic-css-and-js-loading/#post-3863472)
 * Guys please help me out. Need to get this job done as soon as possible, though
   the disabled autoload prevents me from finishing it.
 *  Plugin Author [Ian Dunn](https://wordpress.org/support/users/iandunn/)
 * (@iandunn)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/enable-automatic-css-and-js-loading/#post-3863481)
 * This should work:
 *     ```
       function bgmpShortcodeCalled()
       {
                   add_filter( 'bgmp_map-shortcode-called', '__return_true' );
       }
       add_action( 'wp', 'bgmpShortcodeCalled' );
       ```
   
 *  Thread Starter [webembassy](https://wordpress.org/support/users/webembassy/)
 * (@webembassy)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/enable-automatic-css-and-js-loading/#post-3863482)
 * Thanks for your reply.
 * I’ve added your code to the functions.php though it **doesn’t** work in my case.
 * Here is what I’m trying to achieve:
    I’m calling a custom shortcode on a WordPress
   page, which includes some custom search form. When the visitor clicks on search,
   an additional *.php file is called using AJAX, showing the search results. What
   I’m trying to do is include a BGMP map in the search results (called with AJAX),
   with dynamically generated BGMP options.
 * The *.php, which is loaded using AJAX includes the wp-load.php file, so all WP
   functions shall be working fine. When I `echo do_shortcode('[bgmp-map]');` I’m
   still getting this error – “Basic Google Maps Placemarks error: JavaScript and/
   or CSS files aren’t loaded”. Tried including the CSS & JS files directly in my
   files, but it doesn’t work also :(.
 * Hope these are enough details.
 *  Thread Starter [webembassy](https://wordpress.org/support/users/webembassy/)
 * (@webembassy)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/enable-automatic-css-and-js-loading/#post-3863508)
 * Please let me know if it’s possible. I’ve spent loads of hours to find a solution,
   but without success. Can’t find any workaround for this one… Got to finish my
   project tomorrow, haven’t got any proper solution yet. Thanks in advance!

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

The topic ‘Enable automatic CSS and JS loading’ is closed to new replies.

 * ![](https://ps.w.org/basic-google-maps-placemarks/assets/icon-128x128.png?rev
   =1152531)
 * [Basic Google Maps Placemarks](https://wordpress.org/plugins/basic-google-maps-placemarks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/basic-google-maps-placemarks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/basic-google-maps-placemarks/)
 * [Active Topics](https://wordpress.org/support/plugin/basic-google-maps-placemarks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/basic-google-maps-placemarks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/basic-google-maps-placemarks/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [webembassy](https://wordpress.org/support/users/webembassy/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/enable-automatic-css-and-js-loading/#post-3863508)
 * Status: not resolved