: 그래서워드 프레스 중첩 단축 코드 나는 다음과 같은 단축 코드 사용하고자하는 내용
[section]
<h1>Section body content</h1>
[section_footer]<p>Section footer content</p>[/section_footer]
[/section]
, 내가 추가 한 다음 단축 코드 콜백 :
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');
그러나 출력은 다음과 같습니다
<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>
어떻게 해결할 수 있으며 꼬리말에 짧은 꼬리말 콘텐츠 만 인쇄 할 수 있습니까?
두 함수를 동일한 후크'do_shortcode'에 등록했을 수도 있습니다. 게시물을 업데이트하고'sec_cb' 및'sec_footer_cb' 함수를 호출하는 방법/위치를 설정하십시오. –
안녕하세요 @JoseCarlosRamosCarmenates, 업데이트를 확인하십시오 – DDE
바로 지금 올바른 내용을 보도록 푸터에 인쇄하고 있습니다 : '
섹션 바디 콘텐츠
'과 같은 섹션 콘텐츠가 없습니다. 출력물이 필요하십니까? –