自定义帖子类型模板

时间:2011-10-28 02:18:21

标签: wordpress custom-post-type

我有自定义帖子类型“食谱”。我使用自定义帖子类型UI插件创建了它。

名称是ic_recipes,标签是Recipes,重写slug是食谱

网址形成为mysite.com/recipes/lentil-soup /

这是问题......

我想为这些自定义帖子类型创建模板文件以供使用..

但无论我怎样尝试,wordpress最终都使用了single.php。

我已将以下文件提供给twentyten主题文件夹;

recipes.php
ic_recipes.php
archive-recipes.php
and finally archive-ic_recipes.php

没有踢进去.single.php每次都是一次。

我检查了手抄本。 codex有关于模板命名的以下内容(我在这个问题的底部复制/粘贴)!

请告诉我我错过了什么..

http://codex.wordpress.org/Template_Hierarchy#Custom_Post_Types_display

自定义帖子类型显示

archive-{post_type}.php - If the post type were product, WordPress would look for archive-product.php.
archive.php
index.php

1 个答案:

答案 0 :(得分:1)

archive-xxx.php用于存档。您希望使用single-xxx.php作为single.php的替代。