WordPress.org

Ready to get started?Download WordPress

Forums

Basic Google Maps Placemarks
Enable automatic CSS and JS loading (5 posts)

  1. webembassy
    Member
    Posted 10 months ago #

    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/

  2. webembassy
    Member
    Posted 9 months ago #

    Guys please help me out. Need to get this job done as soon as possible, though the disabled autoload prevents me from finishing it.

  3. Ian Dunn
    Member
    Plugin Author

    Posted 9 months ago #

    This should work:

    function bgmpShortcodeCalled()
    {
                add_filter( 'bgmp_map-shortcode-called', '__return_true' );
    }
    add_action( 'wp', 'bgmpShortcodeCalled' );
  4. webembassy
    Member
    Posted 9 months ago #

    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.

  5. webembassy
    Member
    Posted 9 months ago #

    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!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.