[Resolved] Instructions to dequeue some unused GP js (related to menu etc)

Home Forums Support [Resolved] Instructions to dequeue some unused GP js (related to menu etc)

Home Forums Support Instructions to dequeue some unused GP js (related to menu etc)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #531503
    Mike

    Since I use a separate menu plugin (Max Mega Menu), can I assume that I no longer need the menu related js files enqueued by GP:

    menu.min.js
    dropdown.min.js

    If so, could you please kindly post the PHP snippets to dequeue these scripts?

    Also I use the Sections module, but do not use the parallax feature, is it safe to also dequeue:

    parallax.min.js

    And if so, could you please also provide the code?

    Finally, what is a11y.min.js for? Is it safe to be dequeued as well?

    Thanks!

    GeneratePress 2.0.2
    GP Premium 1.6
    #531910
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    If you’re not using the GP menu at all (not even on mobile), then you safely dequeue those files:

    add_action( 'wp_enqueue_scripts', 'tu_remove_menu_scripts', 50 );
    function tu_remove_menu_scripts() {
        wp_dequeue_script( 'generate-menu' );
        wp_dequeue_script( 'generate-dropdown' );
    }

    The parallax script will only enqueue if parallax is turned on within a Section.

    a11y.js is required for people with disabilities. It allows them to navigate your site successfully. I highly suggest you keep it.

    #532013
    Mike

    Hi Tom,

    Thanks a lot for your prompt response. I was able to dequeue the menu scripts as you instructed; however, the parallax.min.js was still loaded for my site even though all my sections had parallax set to “Disabled”. Upon taking a look at the plugin’s PHP file, I was able to infer that the name of the parallax enqueue script is generate-sections-parallax, so I added:

    wp_dequeue_script( 'generate-sections-parallax');

    to the codes you gave me, and it worked to get rid of parallax.min.js for me.

    Thanks again.

    P.S. I’m so happy that I found this great theme. IMO this theme literally should be WordPress’s default starting theme (instead of those Twenty xx every year…). It is just about everything a framework needs to be, and nothing it shouldn’t be. The more I use it, the more it amazes me how well-thought of everything is in this theme. I think you and everyone using this theme should pitch the idea to WP haha.

    #532016
    Tom
    Lead Developer
    Lead Developer

    Thank you so much for the kind words! I really appreciate it!

    I’m glad you got everything working as you need it 🙂

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