[Resolved] Change list in two Columns – than jquery

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Change list in two Columns – than jquery

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #35748
    Uwe
    Participant

    Hi there,

    I’ve been using Generatepress and Wpshowposts Pro for a long time. Everything has been wonderful so far.

    Now at WPShowposts I wanted to switch my list from one column to two columns on the start page.

    After the changeover, the following will be displayed on Google Pagespeed or Lighthouse:

    Reduce unused JavaScript and enable text compression

    URL “… jquery / jquery.min.js? Ver = 3.6.0”

    How do I get rid of the message? Is there a solution for this?

    Many thanks in advance for help …

    Uwe

    #35754
    elvin
    Moderator

    Hi there,

    You can remove it with a PHP snippet manually or by an optimization plugin.

    For the PHP snippet, you can try this:

    add_action( 'wp_enqueue_scripts', function() {
        wp_dequeue_script( 'jquery' );
    },99 );
    #35760
    Uwe
    Participant

    Hi elvin,

    the php snippet does not work …

    Greetings

    #35762
    elvin
    Moderator

    Can you link me to a sample page on your site were it loads? To check how it’s being added.

    #35764
    Uwe
    Participant

    Hi elvin,

    here it is https://www.fastflip.de/

    regards

    #35777
    elvin
    Moderator

    I see,

    Can you try this instead?

    if (!is_admin()) {
    add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); 
    }
    
    function my_jquery_enqueue() {
       wp_deregister_script('jquery');
       wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null);
       wp_enqueue_script('jquery');
    }

    If it still doesn’t work, can you tell me how you’re adding the PHP snippet?

    #35782
    Uwe
    Participant

    Hi elvin,

    PHP snippet adding with code snippets.

    Now lighthouse reports under the two points performance and best practises:

    Performance

    Eliminate render-blocking resources

    1.10.2/jquery.min.js(ajax.googleapis.com)

    Best Practices

    Trust and Safety, Includes front-end JavaScript libraries with known security vulnerabilities 4 vulnerabilities detected.

    Some third-party scripts may contain known security vulnerabilities that are easily identified and exploited by attackers. Learn more.

    Library Version: jQuery@1.10.2
    Vulnerability Count: 4
    Highest Severity: Medium

    Regards from Germany

    #35784
    elvin
    Moderator

    Ah my bad.

    This part shouldn’t be included.

       wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null);
       wp_enqueue_script('jquery');

    Try this instead:

    if (!is_admin()) {
    add_action("wp_enqueue_scripts", "my_jquery_dequeue", 11); 
    }
    
    function my_jquery_dequeue() {
        wp_dequeue_script( 'jquery');
        wp_deregister_script( 'jquery');   
    }

    This should remove the jquery completely. Let us know how it goes.

    If it still doesn’t remove the jquery, can you send us temporary backend access so I can check?

    Send it through our contact form here – https://wpshowposts.com/contact/

    #35786
    Uwe
    Participant

    Hi elvin,

    now it works … 🙂

    Thanks a lot

    Regards

    #35788
    elvin
    Moderator

    Nice one. No problem. 😀

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