但是\\u内容过滤器做什么呢?
content\\u筛选器允许您在内容之前或之后返回自定义内容。
在自定义函数中使用\\u内容过滤器的两个非常基本的实际示例如下:
This example returns custom content before the content
add_filter( \'the_content\', \'return_before_content\' );
function return_before_content( $content ) {
if ( is_singular(\'post\')) {
$before_content = \'<p>Text Returned Before the_content</p>\';
$content = $before_content . $content;
}
return $content;
}
This example returns custom content after the content
add_filter( \'the_content\', \'return_after_content\' );
function return_after_content( $content ) {
if ( is_singular(\'post\')) {
$after_content = \'<p>Text Returned After the_content</p>\';
$content = $content . $after_content;
}
return $content;
}