Stopping google maps javascript from slowing page load

This topic contains 6 replies, has 3 voices, and was last updated by  adyp 7 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #363667

    adyp
    Expired Member
    Post count: 496

    Like the member in this post – https://wpgeodirectory.com/support/topic/speed-addiction/ – I have moved the dynamic GD map off home page to improve page speed. I am still getting slowed down by google maps javascript though. Can I use the code suggested in that thread in my case? And if so, where do I put it? (the other red speed-bumps are the subject of a separate ticket).

    #363760

    Paolo
    Site Admin
    Post count: 31206

    I haven’t tested it, but this should work only in the home page:

    
    
    function _my_dequeue_script() {
    	if ( is_home() ) {
     wp_dequeue_script( 'geodirectory-googlemap-script' ); 
    }}
    add_action( 'wp_print_scripts', '_my_dequeue_script', 100 );

    Thanks

    #363816

    adyp
    Expired Member
    Post count: 496

    Thanks Paolo, I will give it a try – I assume in functions.php?

    #363821

    adyp
    Expired Member
    Post count: 496

    Hello, although I put in the code I am not sure this is resolved – check out the pingdom results:
    https://tools.pingdom.com/#!/cNOOvT/http://loopyfood.net

    I am aware there are one or two other speed issues, that I am working on – although I am also hoping to get a response on my other ticket about the top problem flagged (minimise request size), which appears to be a gd-booster issue 🙂

    Thanks,

    Adrian

    #363822

    adyp
    Expired Member
    Post count: 496
    This reply has been marked as private.
    #363888

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Everythign was correct except u used is_home() instead of is_front_page(), yes its very confusing but is_home() refers to your blog page homepage… 🙂

    Stiofan

    #363971

    adyp
    Expired Member
    Post count: 496

    That’s great – thanks Stiofan.

    Now I just need to figure if I can use something similar to stop facebook taking chunk of my load-time (without turning off social share for the rest of the site!)

    Cheers,
    Adrian

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount