Created
May 9, 2013 19:23
-
-
Save petenelson/5549854 to your computer and use it in GitHub Desktop.
WordPress: Add custom CSS file to a post/page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add to header.php prior to wp_head() | |
$custom_css_file = get_post_meta( get_the_id(), $key = 'custom-css-file', $single = true ); | |
if (false !== $custom_css_file && !empty($custom_css_file)) | |
wp_enqueue_style( get_the_id() . '-custom-css-file', get_template_directory_uri() . '/' . $custom_css_file, array(), $version_tag_here ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment