为什么 single-{slug}.php 不调用 wordpress 来显示单个帖子?

php*_*oob 0 wordpress custom-wordpress-pages

大家好,当我显示特定帖子时,我在 WordPress 中调用 single-{slug}.php 时遇到问题。

例如,我有一个名为 php 的帖子,所以我在主题目录的二十七文件夹中创建了一个文件 single-php.php 但它没有调用。

Ahm*_*ani 5

这是更正

\n\n
single-{post-type}-{slug}.php \xe2\x80\x93 (Since 4.4) First, WordPress looks for a template for the specific post. For example, if post type is product and the post slug is dmc-12, WordPress would look for single-product-dmc-12.php.\n
Run Code Online (Sandbox Code Playgroud)\n\n

参考:模板层次结构

\n\n

所以对于单个帖子来说它将是 single-post-{slug}.php 。

\n