the_title_attribute()自定义文章标题的输出形式

目录

描述

Displays or returns the title of the current post. It somewhat duplicates the functionality of the_title(), but provides a “clean” version of the title for use in HTML attributes by stripping HTML tags with strip_tags() and by converting certain characters (including quotes) to their character entity equivalent with esc_attr(); it also uses query-string style parameters. This tag must be within The Loop.

the_title_attribute() 描述

用法

 <?php the_title_attribute$args ); ?> 

the_title_attribute() 用法

参数

$before

(string) (可选) Text to place before the title.

默认值: None

$after

(string) (可选) Text to place after the title.

默认值: None

$echo

(Boolean) (可选) Display the title (TRUE) or return it for use in PHP (FALSE).

默认值: TRUE

$post

(integer or object) (可选) The ID of the post or an object that specifies the post from which to get the title. By default the current post is fetched.

默认值: null

the_title_attribute() 参数

注意

历史

  • 添加于 版本: 2.3.0

the_title_attribute() 历史

源文件

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

the_title_attribute() 源文件

相关