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>
';
}

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 ?

Read more here: WordPress nested shortcode content


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: