/ Published in: PHP
URL: http://digwp.com/2010/02/custom-css-per-post
To use it, simply create a new folder called “art-direction” in your theme. Then to style any particular Post or Page, just drop a file in that folder named style-XXXX.css where XXXX is the ID of the Post or Page. When that Post or Page loads, WordPress will look for a file of that name. If it exists, it will load in in the head section.
Expand |
Embed | Plain Text
function artStyle() { global $post; if (is_single()) { $currentID = $post->ID; $serverfilepath = TEMPLATEPATH.'/art-direction/style-'.$currentID.'.css'; $publicfilepath = get_bloginfo('template_url'); $publicfilepath .= '/art-direction/style-'.$currentID.'.css'; } } } add_action('wp_head', 'artStyle');
You need to login to post a comment.
