最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Is there a way to move WPML scripts in footer?

programmeradmin1浏览0评论

I found out that wpml force my jquery to load into header. (I already deregistered it and registered my own one).

Is there a way to move wpml script in footer?

I found out that wpml force my jquery to load into header. (I already deregistered it and registered my own one).

Is there a way to move wpml script in footer?

Share Improve this question asked Nov 4, 2016 at 9:38 MarcoMarco 1134 bronze badges 3
  • wpml/forums/topic/how-to-load-wpml-scripts-in-footer – Rishabh Commented Nov 4, 2016 at 9:47
  • first result on google, already read. I asked here because maybe I need more infos or maybe I'd like to find different approach? – Marco Commented Nov 4, 2016 at 9:59
  • Yep! I deregister jquery, register it again with footer option 'true', but when I activate wpml main plugin, it forces jquery (and jquery ui) in the header. I'm going to search for wpml register script function, get scripts handles, deregister them in my theme and register them again with footer option. – Marco Commented Nov 4, 2016 at 17:18
Add a comment  | 

1 Answer 1

Reset to default 0

It depends. As commented on OP, WPML documentation and support are very minimal on this front.

I found that for me, the only culprit forcing jQuery to the head of the HTML was wpml-xdomain-data.js from sitepress-multilingual-cms/classes/url-handling/class-wpml-xdomain-data-parser.php:53. This script appears to handle some part of the language switchers and, as I have a custom language switcher, I could deregister this script without loss of functionality:

wp_deregister_script('wpml-xdomain-data');

In functions.php through wp_enqueue_scripts hook.

Also see: https://wpml/forums/topic/how-to-load-browser-redirect-js-and-jquery-cookie-js-in-the-footer/

发布评论

评论列表(0)

  1. 暂无评论