你需要检查WordPresstemplate-hierarchy 工作原理。
单立柱#
单篇文章模板文件用于渲染单篇文章。WordPress使用以下路径:
1.single-{post-type}.php – First, WordPress looks for a template for the specific post type. For example, post type is product, WordPress would look for single-product.php.
2.single.php – WordPress then falls back to single.php.
3.index.php – Finally, as mentioned above, WordPress ultimately falls back to index.php.
第页#
用于呈现静态页面(页面帖子类型)的模板文件。请注意,与其他帖子类型不同,页面是WordPress专用的,并使用以下补丁:
1. custom template file – The page template assigned to the page. See get_page_templates().
2. page-{slug}.php – If the page slug is recent-news, WordPress will look to use page-recent-news.php.
3.page-{id}.php – If the page ID is 6, WordPress will look to use page-6.php.
4. page.php
5. index.php
对于您可以使用的特定id
page-{id}.php
样板