Skip to content

Instantly share code, notes, and snippets.

@marcel-valdez
Created December 18, 2012 04:03
Show Gist options
  • Save marcel-valdez/4324899 to your computer and use it in GitHub Desktop.
Save marcel-valdez/4324899 to your computer and use it in GitHub Desktop.
Piece of code to add custom css to a specific wordpress post using custom fields.
<?php
$custom_css = get_post_custom_values('custom_css', $post->ID);
if ($custom_css != null && count($custom_css) > 0 ) {
echo '<link rel="stylesheet" type="text/css" media="all" href="'. $custom_css[0] .'" />';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment