Home › Forums › Pro Support › Change list in two Columns – than jquery
Tagged: Jquery
- This topic has 9 replies, 2 voices, and was last updated 2 years ago by
elvin.
-
AuthorPosts
-
November 24, 2021 at 9:33 am #35748
Anonymous
InactiveHi 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
November 24, 2021 at 4:50 pm #35754elvin
ModeratorHi 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 );
November 25, 2021 at 12:07 am #35760Anonymous
InactiveHi elvin,
the php snippet does not work …
Greetings
November 25, 2021 at 12:11 am #35762elvin
ModeratorCan you link me to a sample page on your site were it loads? To check how it’s being added.
November 25, 2021 at 1:25 am #35764Anonymous
InactiveNovember 25, 2021 at 7:44 pm #35777elvin
ModeratorI 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?
November 26, 2021 at 12:08 am #35782Anonymous
InactiveHi 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: MediumRegards from Germany
November 26, 2021 at 12:36 am #35784elvin
ModeratorAh 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/
November 26, 2021 at 12:46 am #35786Anonymous
InactiveHi elvin,
now it works … 🙂
Thanks a lot
Regards
November 26, 2021 at 12:52 am #35788elvin
ModeratorNice one. No problem. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.