Custom CSS and JS
The Custom CSS and JS plugin allows you to add stylesheets and JavaScript to any individual post by adding custom fields. Both CSS and JavaScript can be either internal or external. Since this is a plugin, the custom CSS and JavaScript are available to any theme used to display the post.
Installation
- Unpack the download package.
- Upload folder include all files to the “/wp-content/plugins/” directory
- Activate the plugin through the “Plugins” menu in WordPress
Using the Plugin
To use the plugin, add any combination of the following custom fields to your post.
Custom Fields
- custom_css
- Add an external stylesheet by adding a custom field with the name custom_css. The value of the field should be the path to your css file.
- custom_css_code
- Add an internal stylesheet by adding a custom field with the name custom_css_code. Include your CSS code as the value. (Do not include the
styletags.) - custom_js
- Add an external JavaScript by adding a custom field with the name custom_js. The value of the field should be the path to your script.
- custom_js_code
- Add an internal JavaScript by adding a custom field with the name custom_js_code. Include your JavaScript code as the value. (Do not include the
scripttags.)
Order
The external styles and scripts are included before the internal ones.
If you include multiple entries for a given field, the entries will be included in order.
Okay, but what if I don’t like those tags?
Just edit custom-css-js.php and change the constants defined near the top of the file.
Note
This plugin only works with individual posts and pages. It does not work for list pages (e.g., the index page, search results).



17 Comments
if (is_single() or is_page())…and change it to…if (is_single() or is_page() or is_home())Worked great for my site! Thanks!!12 Trackbacks