I have a short code like this:
function requestaquote($atts, $content = null){
extract(shortcode_atts(array(
'text'=>'',
'link'=>'',
'colour'=>''
), $atts));
return '<div class="speed-button"><img src="'.get_stylesheet_directory_uri().'/images/request-a-quote.jpg" alt="request a quote " /><p class="requstaquote">'.esc_attr($text).'</p></div><!--speed-button-->';
}
add_shortcode( 'quotetext', 'requestaquote' );
It's working except that its introducing extra <p></p>
pairs like this:
<div class="textwidget">
<p></p>
<div class="speed-button">...</div>
<p></p>
</div>
which is messing up my formatting.
I have tried remove_filter('the_content', 'wpautop');
How do I removed these <p></p>
pairs.
simply remove the new lines as it appears that the new lines are whats being made into paragraphs.
You can pospone the
wp_autop
because it processes before the shortcode output:Or use the
cleanup_shortcode_fix()
function:Source : Remove auto added <p> from a page that has no literal content (uses shortcodes)