BlogThemes

Embed Custom CSS in Your Single Posts with Custom Fields

There will probably be instances if you wish to use customized CSS in your single posts. On this tutorial we’ll share one of many methods that you may simply embed customized CSS in your single posts in WordPress with the usage of Customized Fields.

First you have to to open your header.php and insert this code someplace in between <head></head> codes.

<?php if (is_single()) {
$customstyle = get_post_meta($post->ID, ‘customstyle’, true);
if (!empty($customstyle)) { ?>
<fashion kind=”textual content/css”>
<?php echo $customstyle; ?>
<fashion>
<?php }
} ?>

Upon getting finished that you may add a customized subject in every put up with the identify customstyle and add the css codes in there.

For instance if you need the a sure picture to have border you’ll be able to add:

#coolimageclass{border: 5px stable #ccc;}

Use the format above and also you now have customized CSS to your single posts.

Download The WPSaviour App Now

Related posts
Blog

How To Make A Bio Dropdown Box With CSS

Blog

Get The Google Malware Hammer For Commented Out CSS

Best WordPress PluginsBlog

How to Easily Add Custom CSS to Your WordPress Site

Best WordPress PluginsBlog

How to Easily Add CSS Animations in WordPress

Leave a Reply

Your email address will not be published.

Pay in your preferred currency
Indian rupee
Euro