首页 文章

Wordpress自定义帖子

提问于
浏览
0

我是wordpress世界的新手 . 我成功创建了自定义帖子,并将其显示在页面模板页面上 . 现在我想使用taxonomy- .php和single- .php来显示自定义帖子,但我在texonomy页面和sigle页面中感到困惑 . 如何工作和如何做 .

在分类中 - .php这里的类别是指我们的自定义类别名称还是其他?

在单 .php这里帖子意味着自定义帖子名称或其他?

请帮我解决这个问题 .

提前致谢 .

2 回答

  • 0

    请参阅Wordpress Codex上的Template_Hierarchy

    taxonomy- .php - 如果分类法是sometax,WordPress会查找taxonomy-sometax.php single- .php - 如果帖子类型是产品,WordPress会寻找single-product.php .

    Example:

    对于post_type

    当在后端的在线商店自定义帖子类型时,URL将是 wp-admin/edit.php?post_type=store . 所以 post_type 在这种情况下是 store ,这意味着我将命名我的文件 single-store.php

    对于分类学

    当在后端的在线商店的“类别”页面上时,URL将为 edit-tags.php?taxonomy=store_categories&post_type=store

    所以分类文件将是 taxonomy-store_categories.php

    enter image description here

  • 0

    在分类中 - .php这里的类别是指我们的自定义类别名称还是其他?

    taxonomy-{category}.php here category means your custom category(taxonomy)
    

    在单 .php这里帖子意味着自定义帖子名称或其他?

    single-{post}.php here post means custom post type name
    

相关问题