Problems with nested shortcodes

0

Hello! I'm trying to use some nested shortcuts, but I'm not succeeding.

The shortcodes are these, in order of declaration in functions.php:

function p_generico_shortcode( $atts , $content = null )
{
    return '<p class="pov generico">' . do_shortcode($content) . '</p>';
}
add_shortcode( 'pov-generico', 'p_generico_shortcode' );

Second:

function f_moca_shortcode( $atts , $content = null )
{
    return '<p class="fala moca">' . do_shortcode($content) . '</p>';
}
add_shortcode( 'fala-moca', 'f_moca_shortcode' );

When attempting to use:

[fala-moca]TEXT[pov-generico]OTHER TEXT[/pov-generico][/fala-moca]

I'm getting:

<p class="fala moca">TEXT</p>
<p class="pov generico">OTHER TEXT</p>

Instead of:

<p class="fala moca">TEXT<p class="pov generico">OTHER TEXT</p></p>

I noticed that by nesting shortcodes that return HTML with different elements (eg p and span) it renders correctly.

    
asked by anonymous 29.04.2015 / 03:24

1 answer

1

SOLVED! The problem was simply because wordpress did not accept (like the w3c standards), two nested p tags . Changing to span the daughter tag solved everything.

    
30.04.2015 / 11:31