나는 'list-two'(Advanced Custom Fields 사용)라는 사용자 정의 메타 상자가 있는데 편집 창에서 'more'태그를 사용하여 텍스트/내용을 두 개로 나누고 싶습니다. 열. 이것은 지금까지 내 코드 만 내가 필요의 절반이 할을 수행합니다두 개의 열로 내용 나누기 - Wordpress
<?php
// split text into array
$copy = split_morecontent();
// output first content section in column1
echo '<section class="split">', array_shift($copy), '</section>';
// output remaining content sections in column2
echo '<section class="split">', implode($copy), '</section>';
?>
출력 : 내 게시물 템플릿 파일에서
function split_morecontent() {
global $morecontent;
$morecontent = true;
$copy = preg_split('/<span id="more-\d+"><\/span>/i', get_field('list_two'));
for($c = 0, $csize = count($copy); $c < $csize; $c++) {
$copy[$c] = apply_filters('list_two', $copy[$c]);
}
return $copy;
}
: 내 functions.php 파일에서
다음 HTML을 실행하면 (실제로 두 태그로 콘텐츠가 분할되지 않음을 알 수 있습니다) :
<section class="split">
<ul class="footnote">
<li>Christopher Gray</li>
<li>Jean Jullien<!--more--></li>
<li>Nous Vous</li>
<li>Liv Bargman</li>
<li>Luke Drozd</li>
</ul>
</section>
<section class="split">
<!-- the last 3 <li> tags from the list above should be displayed within here.-->
</section>
내가 편집하려고하는 코드가 맞다. 기본적으로 Sitepoint의 코드는 the_content 만 분리합니다. 나는 다른 WYSIWYG 콘텐츠 상자 (나는 list_two를 호출했다)를 분할하기 위해 그것을 적용하려고 노력하고 있지만 작동시키지 못한다. 따라서 Post 편집 페이지에서 추가 WYSIWYG 편집기로 작업하려면 SitePoint 코드가 필요합니다. 내가 어떻게 그럴 수 있니? – egr103