我想弄清楚的是如何让页面的内容显示在不同的div中。这意味着如果我在编辑器中添加两段,我希望在div section1中显示第一段,在div section2中显示第二段。
页面代码:<?php
if( have_posts()):
while( have_posts()): the_post();?>
<?php
// original content display
// the_content();
// split content into array
$content = split_content();
// output first content section in column1
echo \'<div id="column1">\', array_shift($content), \'</div>\';
// output remaining content sections in column2
echo \'<div id="column2">\', implode($content), \'</div>\';
?>
<?php endwhile;
endif;
?>
以及功能。php: function split_content() {
global $more;
$more = true;
$content = preg_split(\'/<span id="more-\\d+"><\\/span>i/\', get_the_content(\'more\'));
for($c = 0, $csize = count($content); $c < $csize; $c++) {
$content[$c] = apply_filters(\'the_content\', $content[$c]);
}
return $content;
}