Linux 软件免费装
Banner图

Script Logic

开发者 tahiryasin
更新时间 2015年5月13日 05:46
捐献地址: 去捐款
PHP版本: 2.8 及以上
WordPress版本: 3.9.1
版权: GPLv2 or later

标签

speed admin style script optimize conditional tags

下载

0.2 0.3

详情介绍:

This plugin lists all JavaScripts and Style sheets with a control field that lets you control CSS & JavaScript files to include only on the pages where you actually need them. The text field lets you use WP's Conditional Tags, or any general PHP code. NOTE: The script logic you introduce is evaluated directly. Anyone who has permission to manage options will have the right to add any code, including malicious and possibly destructive code. There is an optional filter 'script_logic_eval_override' which you can use to bypass the EVAL with your own code if needed. (See Other Notes).

安装:

  1. Upload plugin to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Configure the plugin at Settings -> Script Logic
  4. That's it.
Configuration On plugin configuration page you see all script and CSS files with a logic field. Lets suppose you are using Contact Form 7 plugin. You created a page Contact Us (slug = contact-us) and want to include Contact Form 7 scripts only on this page. Find the Contact Form 7 scripts on plugin's configuration page (they have handle = contact-form-7) and put is_page('contact-us') in logic field

屏幕截图:

  • screenshot-1.png
  • screenshot-2.png

升级注意事项:

NA

常见问题:

Why isn't it working?

Try switching to the WP default theme - if the problem goes away, there is something specific to your theme that may be interfering with the WP conditional tags. Most probably the logic text on one of your scripts is invalid PHP

How do I load a certain script X on just my 'home' page? (Or on every page except that.)

There is some confusion between the Main Page and the front page. If you want a script on your 'front page' whether that is a static page or a set of posts, use is_front_page(). If it is a page using is_page(x) does not work. If your 'front page' is a page and not a series of posts, you can still use is_home() to include scripts on that main posts page (as defined in Admin > Settings > Reading).

更新日志:

0.1