I want my single post to have a style different from the main style. I know we can include a custom CSS file in single.php
but I do not have a single.php
file in my theme!
I just want a custom id, like id="single"
, added to the single post (not in main page posts) and then I can write styles for it.
I found some PHP code but I don't know how I can use it, or if it is what I want or not...
if (is_single()) {
$single_css_styling = get_post_meta($post->ID, 'single_css_styling', true);
if (!empty($single_css_styling)) { ?>
<style type="text/css">
<?php echo $single_css_styling; ?>
<style>
<?php } }
Is there any way to do it?