php - Nesting shortcodes in Wordpress results in the inner shortcode being placed AFTER outer shortcode -
i'm trying use nested shortcodes, i'm having problems it.
everytime try nest 2 shortcodes created me...
first declared in functions.php (the inner):
function p_generic_shortcode( $atts , $content = null ) { return '<p class="pov generic">' . do_shortcode($content) . '</p>'; } add_shortcode( 'pov-generic', 'p_generic_shortcode' ); second declared in functions.php (the outer):
function f_girl_shortcode( $atts , $content = null ) { return '<p class="talk girl">' . do_shortcode($content) . '</p>'; } add_shortcode( 'talk-girl', 'f_girl_shortcode' ); when enter following code in bbpress editor:
[talk-girl]text[pov-generic]other text[/pov-generic][/talk-girl] it outputs follow code:
<p class="talk girl">text</p> <p class="pov generic">other text</p> and not expected:
<p class="talk girl">text<p class="pov generic">other text</p></p>
solved. according this answer in wp stackoverflow trouble because tried nest 2 p elements, , wp wont let me this. changing child shortcode span solves that.
Comments
Post a Comment