开发者 | peterwilsoncc |
---|---|
更新时间 | 2010年8月26日 22:05 |
PHP版本: | 2.8 及以上 |
WordPress版本: | 3.0.1 |
/wp-content/plugins/
directory of your install.
Activate the plugin through the 'Plugins' menu in WordPress
In your theme or plugin, use wp_register_style
and/or wp_enqueue_style
to load your CSS. This requires you to remove any html tags you have in your theme and add the following code to your functions.php file:
function mytheme_enqueue_css(){ if (!is_admin()){ wp_enqueue_style ( 'mytheme-print', /* handle */ '/path-to/print.css', /* source */ null, /* no requirements */ '1.0', /* version */ 'print' /* media type */ ); } } add_action('wp_print_styles', 'mytheme_enqueue_css');
To wrap your stylesheet in conditional tags, add the following below the wp_enqueue_style call in your new function
global $wp_styles; $wp_styles->registered['mytheme-print']->extra['conditional'] = 'IE 6'
You may not be loading your JavaScript the WordPress way. If wp_enqueue_script
means nothing to you, then have a read of a tutorial I wrote on the subject
Make sure you are using wp_enqueue_style
to load your CSS, an explanation is in the Installation section of this readme file.
Yes. If you set your stylesheet to be for a particular version of IE, this plugin will respect that.
This plugin was written as a proof of concept, has a sub 1.0 version number and has been tested for a few common situations only. I don't use it on a production website but let me know of your experiences if you choose to.