在WordPress插件中使用wp_enQueue_script

时间:2014-11-27 作者:A Johnson

这是我当前的代码:

<script src="http://unibet-affiliate.enetscores.com/xjs/hour/theme/affiliate/361/client"></script>
<script>
__initLivescore({"c1":"F0F0F0","c2":"BABCC3","c4":"FFFFFF","c5":"FFFFFF","c6":"C90000","affiliate_id":"0","menu":"1","sportFK":"1","odds":"decimal","lang":"3","timezone":"AUTO","selected_tab":"all"});
</script>
是否可以对此代码使用wp\\u enqueue\\u脚本?

非常感谢你!

1 个回复
SO网友:Yatendra

把这些

__initLivescore({"c1":"F0F0F0","c2":"BABCC3","c4":"FFFFFF","c5":"FFFFFF","c6":"C90000","affiliate_id":"0","menu":"1","sportFK":"1","odds":"decimal","lang":"3","timezone":"AUTO","selected_tab":"all"});
在类似js的演示中编写代码。js文件。然后使用wp\\u enqueue\\u脚本并将此文件排入队列

wp_enqueue_script( \'script-name1\', \'http://unibet-affiliate.enetscores.com/xjs/hour/theme/affiliate/361/client\');
wp_enqueue_script( \'script-name2\',  plugin_dir_path( __FILE__ ) . \'/demo.js\', array(), \'1.0.0\', true );

结束

相关推荐