I would like to use the following shortcodes:
[section]
<h1>Section body content</h1>
[section_footer]<p>Section footer content</p>[/section_footer]
[/section]
So, I have added the following shortcode callbacks:
function sec_cb ($att, $content = null) {
// ...
return
'
<section>
<div class="sec-body">
'.strip_shortcodes($content).'
</div>
'.do_shortcode($content).'
</section>
';
}
function sec_footer_cb ($atts, $content = null) {
return
'
<div class="sec-footer">
'.$content.'
</div>
';
}
add_shortcode('section', 'sec_cb');
add_shortcode('section_footer', 'sec_footer_cb');
But the output is:
<section>
<div class="sec-body">
<h1>Section body content</h1>
</div>
<h1>Section body content</h1>
<div class="sec-footer">
<p>Section footer content</p>
</div>
</section>
How can I fix it and print in footer only footer shortcode content ?
do_shortcode. Please Update the Post and set how/where you call the functionssec_cbandsec_footer_cb.<div <p>Section footer content</p></div>you don't have de section content like<h1>Section body content</h1>Please what's the output needed?