Title: CSS per page
Last modified: August 18, 2016

---

# CSS per page

 *  [pixel](https://wordpress.org/support/users/pixel/)
 * (@pixel)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/)
 * Hey,
    I have searched around but I came up with nothing. I was wondering if anyone
   knows how to set up a custom field that is called css or something and the value
   being a additional css file to add into the header. But have a default one if
   nothing is put in the custom field. Here is a example:
 * 1. I post something on my blog, but do not do a custom field for the css, this
   post will not have a custom css file in the header. When someone goes to that
   post, it has the theme css template (the current theme style.css) and a default
   additional css template that adds a set of default classes.
 * 2. I post a page and fill in a field called css and then put the path to the 
   additional css document in the value. When the viewer goes to that page, the 
   page has the theme css template (the current theme style.css) and also another
   css template that adds a set of different classes (like header background img)
   instead of the default additional css template.
 * On the index page only the default theme css template and the default additional
   css template would load.
 * I hope this isn’t too complicated to do… I would do it if I understood php, but
   I don’t. ~_~. My blog is: [http://www.bloonlabs.com](http://www.bloonlabs.com).
   Tell me if this is possible. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/#post-192148)
 * _2. I post a page and …_
    Are we talking here about the Pages feature of WP or
   just posts?
 *  Thread Starter [pixel](https://wordpress.org/support/users/pixel/)
 * (@pixel)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/#post-192191)
 * Posts and pages. Sorry. ^_^
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/#post-192588)
 * (_I seem to have stumbled upon a generic plugin framework that easily customizes
   for certain requests…_)
 * Pixel, I may have what you’re looking for, that is a plugin that will grab the
   custom css value and match it to a stylesheet in the current theme’s directory(
   then display the link tag for it in the `<head>` element). If instead you’re 
   using a separate directory for your post-specific stylesheets, let me know and
   I can make a small mod to it for that, as well as link to it here.
 *  Thread Starter [pixel](https://wordpress.org/support/users/pixel/)
 * (@pixel)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/#post-192804)
 * It will be in the same dir as the theme. Thanks so much! Please link it here,
   that would be brilliant. Will it allow a default linked css stylesheet? Like 
   if I don’t put a value in the custom field for the additional css style sheet
   can it automatically link a additional style sheet to the page? Thanks so much!
 *  Thread Starter [pixel](https://wordpress.org/support/users/pixel/)
 * (@pixel)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/#post-192910)
 * Bump ^_^
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/css-per-page/#post-192956)
 * Pixel, sorry about the delay. Was stuck on other things and forgot my offer. 
   I apologize for that. Anyway, here finally is the plugin:
 * [http://guff.szub.net/wp-content/post-css.zip](http://guff.szub.net/wp-content/post-css.zip)
 * Two “user” variables at the top of the `post_css()` function in the plugin: $
   key, which is the custom field key you use for your stylesheets (‘css’ by default);
   $stylesheet_url, which if given a value overrides the plugin’s search for the
   stylesheet in the active theme’s directory (empty by default).
 * Couple points:
 * * You can assign more than one stylesheet to any post/Page.
 * * The `<?php wp_head(); ?>` tag (a WP plugin hook) must be in a theme so the 
   stylesheet link can be output to the `<head>` of the page. Just make sure the
   tag resides somewhere in the `<head>` portion of your template(s) — typically
   header.php.
 *  [RonR](https://wordpress.org/support/users/ronr/)
 * (@ronr)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/css-per-page/#post-193108)
 * this plugin works great on the single-post page–thanks!
 * is there a simple way to modify it so that it also includes -all- of the appropriate
   posts’ stylesheets on multi-post pages (most importantly, the main page)?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘CSS per page’ is closed to new replies.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 7 replies
 * 4 participants
 * Last reply from: [RonR](https://wordpress.org/support/users/ronr/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/css-per-page/#post-193108)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
