I'm trying to use nested shortcodes, but i'm having problems with it.
Everytime i try to nest two shortcodes created by 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 i enter the following code in bbpress editor:
[talk-girl]TEXT[pov-generic]OTHER TEXT[/pov-generic][/talk-girl]
It outputs the follow code:
<p class="talk girl">TEXT</p>
<p class="pov generic">OTHER TEXT</p>
And not as i expected:
<p class="talk girl">TEXT<p class="pov generic">OTHER TEXT</p></p>
答案 0 :(得分:0)
解决。 根据{{3}}所有的麻烦都是因为我试图嵌套两个p元素,WP不会让我这样做。用span改变子短代码解决了这个问题。