1. 首页
  2. WordPress 函数手册

get_page_template_slug()

get_page_template_slug( int|WP_Post $post = null )

获取给定文章的特定模板文件名。
Get the specific template filename for a given post.

目录锚点:#参数#返回#源码#笔记


参数(Parameters)

参数 类型 必填 说明
$post (int | WP_Post) 可选 Post ID或WP_Post对象。默认值为全局$post。

返回(Return)

(string|false)页面模板文件名。使用默认页模板时返回空string。如果帖子不存在,则返回false。


源码(Source)


更新版本 源码位置 使用 被使用
4.7.0 wp-includes/post-template.php:1783 8 2

笔记(Notes)

显示当前页的页模板文件名:

get_page_template_slug() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_page_template_slug/