我添加了一个小的自定义函数,在我的函数中的每个博客条目的底部显示一个小的作者简介。我正在使用的当前主题中的php文件。到目前为止,它工作得很好,但我注意到该功能正在应用于每个页面,例如,它显示在我的“联系人”页面的底部。
下面是我所说的一个例子,可以直观地看到正在发生的事情:
以下是我在函数中使用的代码:
function get_author_bio ($content=\'\'){
global $post;
$post_author_name=get_the_author_meta("display_name");
$post_author_description=get_the_author_meta("description");
$html.="<div class=\'author_text\'>\\n";
$html.="<h4>About the Author: <span>".$post_author_name."</span></h4>\\n";
$html.= $post_author_description."\\n";
$html.="</div>\\n";
$html.="<div class=\'clear\'></div>\\n";
$content .= $html;
return $content;
}
add_filter(\'the_content\', \'get_author_bio\');
如何使此功能仅应用于我的博客文章主页,而不应用于我网站上的其他页面?希望这足以帮助我,但我可以更新这些问题,以提供您可能需要的任何其他信息。谢谢