[wp-trac] [WordPress Trac] #34722: Open P Tag in shortcode related to h tag

WordPress Trac noreply at wordpress.org
Wed Nov 18 13:22:30 UTC 2015


#34722: Open P Tag in shortcode related to h tag
--------------------------+------------------------------
 Reporter:  BackuPs       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------

Comment (by BackuPs):

 Hi

 Why should i call  wpautop() or wptexturize() as when the shortcode call
 adds the p-tag and does not close it.


 I know this returns a perfect html as that is what i wrote in the first
 place.


 {{{
 <h3>Integer in ex vel urna tempor ultrices.</h3> Morbi vehicula a orci nec
 dignissim.
 }}}

 But that same code embedded in a shortcode does not and returns


 {{{
 <h3>Integer in ex vel urna tempor ultrices.</h3> <p>Morbi vehicula a orci
 nec dignissim.
 }}}

 Moreover if i dont add h3 (or any h-tag) it returns


 {{{
 Integer in ex vel urna tempor ultrices. Morbi vehicula a orci nec
 dignissim.
 }}}

 No p-tag added at all. The open p-tag only is added when a h3 tag is in
 the text.


 Given this shortcode. What should be changed to make it work correctly? I
 just want a div with a class around my text so i can add css to
 manipulate. Why is the shortcode routine altering the text and adds a open
 p-tag? I believe if it alters it it should so it correctly.


 {{{#!php
 <?php
 function theme_shortcode_div($atts, $content = null, $code) {

         $content = do_shortcode($content);


         return '<div class="theme-div">' . $content .'</div>';
 }

 add_shortcode('theme_div', 'theme_shortcode_div');
 }}}



 I still believe this is a bug. Please provide the solution for it or the
 correct shortcode.

 Thank you

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34722#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list