下面是我用“更多”按钮(也可用于页面)拆分它的解决方案:
$child_pages = get_pages( array(
\'parent\' => get_the_ID(),
\'hierarchical\' => false,
\'sort_column\' => \'post_date\',
\'sort_order\' => \'desc\',
) );
foreach ( $child_pages as $child_page ) {
$short_content = $child_page->post_content;
if ( preg_match( \'/<!--more(.*?)?-->/\', $short_content, $matches, PREG_OFFSET_CAPTURE ) ) {
$short_content = substr( $short_content, 0, $matches[0][1] );
}
echo apply_filters( \'the_content\', $short_content );
}