This could be due to the do_shortcode
running through wpautop
, see here for details on disabling that:
https://stackoverflow.com/questions/5940854/disable-automatic-formatting-inside-wordpress-shortcodes
But as frogg3862
said, what you need to do instead of that is to just trim out the beginning and ending whitespace from $content
to prevent the non-breaking space from being automatically added.
function infoButton($atts, $content = null) {
extract( shortcode_atts( array(
'class' => '',
), $atts ));
$str="<div class="box " . $class . '">' . do_shortcode( trim( $content ) ) . '</div>';
return $str;
}
add_shortcode('box', 'infoButton');