Support » Plugin: Material Design for Contact Form 7 » material design slows considerably the loading of my web

  • Resolved graficoantonio

    (@graficoantonio)


    I have installed material design for contact form 7 on my wordpress website. The problem is that it has considerably worsened the punctuation in the pageSpeed of google, since all my resources have 1 to 2kb of load (except bootstrap that has 20kb). But Material design has 23kb .. and it makes the punctuation much worse. Is there any way that material design consumes fewer resources? Some version .min or something?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Addons for Contact Form 7

    (@contactform7addons)

    Hi @graficoantonio

    The material design assets are already minified. The best thing you can do for performance is to just prevent them from being loaded on pages that don’t include forms.

    You’ll need to be comfortable adding PHP to your theme’s functions.php file, but it’s otherwise quite simple. You’d just add something like this:

    function graficoantonio_dequeue_cf7md() {
        if( !is_page( 'contacto' ) {    
            wp_dequeue_script( 'autosize' );
            wp_dequeue_script( 'cf7-material-design' );
            wp_dequeue_style( 'cf7md_roboto' );
            wp_dequeue_style( 'cf7-material-design' );
        }
    }
    add_action( 'wp_print_scripts', 'graficoantonio_dequeue_cf7md', 100 );
    

    Thanks,
    Angus

    graficoantonio

    (@graficoantonio)

    Are you sure that this code is correct to prevent the code from only loading on the “contact” page? I have included it in my funcitons.php and the page speed gives me an error:

    An error has occurred

    Lighthouse returned error: ERRORED_DOCUMENT_REQUEST. Lighthouse could not load the page you requested correctly. Check that you are testing the correct URL and that the server responds correctly to all requests. (Status code: 500) You can update to try again.
    If the problem continues, visit the PageSpeed Insights distribution list for assistance
    .

    Plugin Author GusRuss89

    (@gusruss89)

    Hi @graficoantonio

    Looks like it’s missing a bracket. Sorry about that. Try this.

    function graficoantonio_dequeue_cf7md() {
        if( !is_page( 'contacto' ) ) {    
            wp_dequeue_script( 'autosize' );
            wp_dequeue_script( 'cf7-material-design' );
            wp_dequeue_style( 'cf7md_roboto' );
            wp_dequeue_style( 'cf7-material-design' );
        }
    }
    add_action( 'wp_print_scripts', 'graficoantonio_dequeue_cf7md', 100 );

    Thanks,
    Angus

    • This reply was modified 4 months ago by  GusRuss89.
    graficoantonio

    (@graficoantonio)

    It seems that it does not work as it should … this is still appearing in the google speed:

    …css/cf7-material-design.css?ver=2.5.4
    (pyrans.com)

    20 KB

    1.530 ms

    can u see results here:
    https://ibb.co/6yf9dnM
    https://ibb.co/vVQ45Rw

    or check u in:
    https://developers.google.com/speed/pagespeed/insights/?hl=es&url=https%3A%2F%2Fpyrans.com%2F&tab=mobile

    Works ! Thnks @gusruss89

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.