WordPress函数Single_post_title文章页输出文章标题
WordPress中输出文章标题的函数有不少,方式也很多,比如the_title、$post->title等等,single_post_title函数也可以输出文章页文章标题,下面是它的结构与用法,看看它与the_title函数的区别在哪儿。 WordPress中输出文章标题的函数有不少,方式也很多,比如the_title、$post->title等等,single_post_title函数也可以输出文章页文章标题,下面是它的结构与用法,看看它与the_title函数的区别在哪儿。 函数描述 显示文章页面标题,single_post_title这个函数没有过滤器,但是你可以自己定义。 函数原型 single_post_title函数位于wp-includes/general-template.php文件中,下面是它的源代码。 function single_post_title( $prefix = '', $display = true ) { $_post = get_queried_object(); if ( !isset($_post->post_title) ) return; /** * Filters the page title for a single post. * * @since 0.71 * * @param string $_post_title The single post...