comment_ID()显示当前评论的ID

目录

描述

Displays the numeric ID of the current comment. This tag must be within The Loop, or a comment loop.

Use get_comment_ID to retrieve the value.

comment_ID() 描述

用法

 <?php comment_ID(); ?> 

comment_ID() 用法

参数

This function does not accept parameters

comment_ID() 参数

返回值

see get_comment_ID() Echoes Result

comment_ID() 返回值

示例

Default Usage

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

<p>This is comment <?php comment_ID(); ?> for all comments.</p>

Comment ID as Anchor ID

Uses the comment ID as an anchor id for a comment.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

<div id="comment-<?php comment_ID() ?>">Comment by 
<?php comment_author() ?>: </div>
<div class="comment-text"><?php comment_text() ?></div>

comment_ID() 示例

历史

添加于 版本: 1.5.0

comment_ID() 历史

源文件

comment_ID() 函数的代码位于 wp-includes/comment-template.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Display the comment id of the current comment.
 *
 * @since 0.71
 */
function comment_ID() {
	echo get_comment_ID();
}

comment_ID() 源文件

相关