comment_type( string $commenttxt = false, string $trackbacktxt = false, string $pingbacktxt = false )
Display the comment type of the current comment.
描述
参数
- $commenttxt
-
(string)
(Optional)
String to display for comment type.Default value: false
- $trackbacktxt
-
(string)
(Optional)
String to display for trackback type.Default value: false
- $pingbacktxt
-
(string)
(Optional)
String to display for pingback type.Default value: false
源代码
File: wp-includes/comment-template.php
function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) {
if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
$type = get_comment_type();
switch( $type ) {
case 'trackback' :
echo $trackbacktxt;
break;
case 'pingback' :
echo $pingbacktxt;
break;
default :
echo $commenttxt;
}
}
更新日志
Version | 描述 |
---|---|
0.71 | Introduced. |
相关函数
Uses
-
wp-includes/l10n.php:
_x() -
wp-includes/l10n.php:
__() -
wp-includes/comment-template.php:
get_comment_type()
User Contributed Notes
-
Skip to note content
You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
Contributed by
Codex
Basic Example
<p><?php comment_type(); ?> to <?php the_title(); ?>: </p>
你可能对这些文章感兴趣:
- wordpress函数esc_html_x()用法示例
- wordpress函数esc_html()用法示例
- wordpress函数esc_html_e()用法示例
- wordpress函数esc_attr_x()用法示例
- wordpress函数esc_attr__()用法示例
- wordpress函数esc_attr_e()用法示例
- wordpress函数esc_attr()用法示例
- wordpress函数enqueue_embed_scripts()用法示例
- wordpress函数ent2ncr()用法示例
- wordpress函数enqueue_comment_hotkeys_js()用法示例
- wordpress函数edit_user()用法示例
- wordpress函数email_exists()用法示例
- wordpress函数endElement()用法示例
- wordpress函数edit_term_link()用法示例
如有疑问,请前往问答中心反馈!
反馈