the_ID()显示当前文章ID

目录

描述

Displays the numeric ID of the current post. This tag must be within The Loop.

Note: This function displays the ID of the post, to return the ID use get_the_ID().

the_ID() 描述

用法

 <?php the_ID(); ?> 

the_ID() 用法

参数

This tag has no parameters.

the_ID() 参数

示例

Default Usage

Post Anchor Identifier

Provides a unique anchor identifier to each post:

Note: In XHTML, the id attribute must not start with a digit. Since the_ID returns the post ID as numerical data, you should include at least one alphabetical character before using it in an id attribute, as in the example above.

the_ID() 示例

历史

添加于 版本: 0.71

the_ID() 历史

源文件

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

the_ID() 源文件

相关