本文整理自网络,侵删。
comments_template()(获取评论模板)
comments_template() 函数用来获取评论模板,一般只能用在文章或者页面上,如果不是文章或者页面将无法显示。
用法
comments_template( $file, $separate_comments );
参数
$file
(字符串)(可选)要评论模板文件。
默认值:/comments.php(当前主题根目录的 comments.php 文件)。
$separate_comments
(布尔)(可选)是否根据评论的类型区分评论。
默认值:False
返回值
此函数无返回值。
例子
默认引入当前主题根目录的 comments.php 文件。
<?php comments_template(); ?>
引入自定义文件:
<?php comments_template( '/short-comments.php' ); ?>
其它
此函数位于:wp-includes/comment-template.php
get_search_form()(获取搜索表单)
get_search_form() 函数用来获取搜索表单,搜索表单的代码位于当前主题根目录的 searchform.php 文件。
用法
get_search_form( $echo );
参数
$echo
相关阅读 >>
wordpress特定文章对搜索引擎隐藏或只允许搜索引擎查看
wordpress高级自定义布局的内容编辑器(tinymce)模板
wordpress wp_head()函数使页面顶部总空白28px
更多相关阅读请进入《wordpress》频道 >>