简体   繁体   English

如何在wordpress中正确使用= wp_enqueue_style和CDN?

[英]How to correctly use = wp_enqueue_style with a CDN in wordpress?

My current code: 我目前的代码:

wp_enqueue_style( 'script-css', plugins_url( 'script/myscript.js', __FILE__ ));

My goal: Instead of loading the file from the plugins directory, I want to load above script file from http://mycloudfronturl.net/myscript.js 我的目标:我想从http://mycloudfronturl.net/myscript.js加载上面的脚本文件,而不是从plugins目录加载文件。

But somehow I am messing with either the quotes or while replacing the plugins_url. 但不知怎的,我正在搞乱引号或替换plugins_url。 I am not a hard code php coder, so can someone tell me what to do please? 我不是一个硬编码的PHP编码器,所以有人可以告诉我该怎么办?

Use enqueue_script instead. 请改用enqueue_script。 Sample example: 示例示例:

wp_register_script('some_script', 'http://anywhereyouwant.com');
wp_enqueue_script('some_script');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM