I have created the following shortcode code:
<?php
function box_handle($atts, $content='')
{
extract(
shortcode_atts(array(
'size' => 'narrow'), $atts));
return '<div class="box '.$size.'">'.$content.'</div>';
}
add_shortcode('box', 'box_handle');
?>
And this:
[box]<h2>Title</h2>
Content
Content
Content[/box]
Gives me
<div class="box narrow"><br>
<h2>Title</h2>
<p>Impingement<br>
Content<br>
Content<br>
Content</p></div>
<p></p>
The problem here being the extra <br>
at the top, after the opening tag. Keep reading and you will find a second error, the unwarranted <p></p>
… How can I fix this? Naturally, I have gone through the HTML code in the admin panel and tried to weed out any new lines and other things around the markup which may cause this but I have not been able to fix it.
There is a plugin, which should let you disable the wpautop()-function on a per-post-basis. I didn’t tested that plugin yet.
http://plugins.trac.wordpress.org/wiki/TextControl