Use Output buffering for the best result of shortcode, especially when you are outputting some HTML in it:
function f_girl_shortcode( $atts , $content = null )
{
ob_start(); ?>
<div class="talk girl"><?php echo do_shortcode($content); ?></div>
<?php
return ob_get_clean();
}
add_shortcode( 'talk-girl', 'f_girl_shortcode' );
and
function p_generic_shortcode( $atts , $content = null )
{
ob_start(); ?>
<div class="pov generic"><?php echo do_shortcode($content); ?></div>
<?php
return ob_get_clean();
}
add_shortcode( 'pov-generic', 'p_generic_shortcode' );
EDIT
Yes, block level element is not the issue, I found the issue is the <p>
tag only. The <p>
tag doesn’t support another <p>
tag or any block level element within (More here). So I changed my answer with <div>
tags.
And another good practice, I tend to follow: the [talk-girl]
is the parent, and the [pov-generic]
is the child. In such case, I follow a simple rule: no child without a parent – so declare parent first, then the child – it may be nothing, but in some cases, it’s many thing. I changed the position of the declaration of the code too. 🙂
Reference:
- Output Control Functions – PHP.net
- Shortcode API – WordPress Codex