函数原型
get_page_template_slug( int|WP_Post $post = null ): string|false
函数描述
Gets the specific template filename for a given post.
是否弃用
未弃用
函数参数
-
$post
int|WP_Post
Optional - Post ID or WP_Post object. Default is global $post.
Default:
null
函数返回值
string|false Page template filename. Returns an empty string when the default page template is in use. Returns false if the post does not exist.
函数位置
File: wp-includes/post-template.php.
函数源码
my-templates/my-custom-template.php源码链接
变更日志
| Version | Description |
|---|---|
| 4.7.0 | Now works with any post type, not just pages. |
| 3.4.0 | Introduced. |

