I'm trying to create a shortcode to add a CSS style attribute to a page. I added the following code to my theme's functions.php.
function add_style( $atts, $content = null ) {
return '<style>' . $content . '</style>';
}
add_shortcode( 'style', 'add_style' );
In the editor of the page I used it as:
[style]
.image-main{
border:5px solid lightblue;
}
[/style]
On the rendered page it outputs to:
<style>
<br />
.image-main{<br />
border:5px solid lightblue;<br />
}<br />
</style>
How can I set up the shortcode to remove the <br />
when I have multi-line content?