让我们首先从一点知识库开始:the_content
是这个吗
/**
* Display the post content.
*
* @since 0.71
*
* @param string $more_link_text Optional. Content for when there is more text.
* @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
*/
function the_content( $more_link_text = null, $strip_teaser = false) {
$content = get_the_content( $more_link_text, $strip_teaser );
$content = apply_filters( \'the_content\', $content );
$content = str_replace( \']]>\', \']]>\', $content );
echo $content;
}
有关
content 是否生成检查:
get_the_content()
所以video
和write-up
将是$more_link_text
在<a href="...">$more_link_text</a>
现在回到您身边content
你有你想要的信息filtered (分开/分开)在两个区域执行此操作:
add_filter(\'the_content\', \'filter_only_video\')
the_content();
remove_filter(\'the_content\', \'filter_only_video\');
add_filter(\'the_content\', \'filter_only_write\')
the_content();
remove_filter(\'the_content\', \'filter_only_write\');
并且在
functions.php
添加以下内容:
function filter_only_video($content) {
// your code that only keeps that video part on (removing the rest)
return $content;
}
function filter_only_write($content) {
// your code that only keeps write-up part on (removing the rest)
return $content;
}
如果正确编写这两个函数,可以在两个单独的位置显示所需的内容。