Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

[box id='1' text="some texte"]

the shortcode, at one point is outputting text

the html result is : </p> some text </p>

There is an extra closing paragraph in the start and and opening at the end... WHY ?

where those come from ?.... any idea ?.. it screw my w3 validation !

** note i have found that... but look all "patched" to me...any clean solution... wp is dirty ? reference

share|improve this question

3 Answers 3

up vote 3 down vote accepted

I discover that it's a know bug, and will be fix in future release Reference here So then, i used this code... not pretty, but do the magic !, thanks

$content = do_shortcode( shortcode_unautop( $content ) );
if ( '</p>' == substr( $content, 0, 4 )
and '<p>' == substr( $content, strlen( $content ) - 3 ) )
    $content = substr( $content, 4, strlen( $content ) - 7 );
return '<div my stuff>' . $content . '</div>';
share|improve this answer
    
menardmam, <p> still remains - how to remove it? –  user20303 Sep 11 '12 at 21:45

I had the same problem and checked the $content in the add_filter() function. There you can see what happen with the shortcodes. I ended up with an easy plugin, that removes silly p and br tags on shortcodes: http://www.johannheyne.de/wordpress/shortcode-empty-paragraph-fix/

share|improve this answer

Make sure there is a double line-break before and after the shortcode in the editor;

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sodales, neque vitae imperdiet aliquet, elit tortor egestas dui, vel fermentum neque est eu est.

[box id='1' text="some texte"]

Lorem ipsum dolor sit amet...

share|improve this answer
    
does not change anything.... or just add : # </p> # <p>&nbsp;</p> –  menardmam Mar 16 '11 at 9:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.