当我在显示特定帖子时,嘿大家在wordpress中调用单个{slug} .php时遇到了麻烦。
例如我发帖称为php,所以我在主题目录的二十七个文件夹中创建了一个文件single-php.php,但它没有调用。
答案 0 :(得分:2)
这是更正
single-{post-type}-{slug}.php – (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.
因此,对于单个帖子,它将是单后{slug} .php。