admin管理员组文章数量:1130349
I created a custom post type called Game, and created 3 posts under it, Game A, Game B and Game B.
I also want to create more posts, like guides and tutorials, for Game A, is thre a way to group these posts under Game A? I can create a tag called Game A, and group the posts under it. but then I will have duplicate tag and a post for custom post type.
Right now, the only ways (that I know) to group posts are by tag and category. I am clueless when it comes to grouping posts for a post created with a custom post type.
Thank you.
I created a custom post type called Game, and created 3 posts under it, Game A, Game B and Game B.
I also want to create more posts, like guides and tutorials, for Game A, is thre a way to group these posts under Game A? I can create a tag called Game A, and group the posts under it. but then I will have duplicate tag and a post for custom post type.
Right now, the only ways (that I know) to group posts are by tag and category. I am clueless when it comes to grouping posts for a post created with a custom post type.
Thank you.
Share Improve this question asked Jan 6, 2019 at 22:59 Noob CoderNoob Coder 1691 silver badge8 bronze badges1 Answer
Reset to default 1Solution 1.
As you've already mentioned, you can use terms, but - it will cause some redundancy, because for every post you'll have to create a term. And you'll have to maintain this post-term connection later on.
Solution 2.
On the other hand, you can use Custom Fields. So for every Guide and Tutorial you can add Custom Field like "related_game_id" and store the ID of related game in that field.
You can use Advanced Custom Fields and its Relation field to make some nicer interface for editing these relations.
Solution 3.
But there is one more way of achieving this. You can remove CPT Game and add Custom Taxonomy Game.
Then you can add this taxonomy to Guides, Tutorials, and all other post types and use description of a term to edit Game info.
I created a custom post type called Game, and created 3 posts under it, Game A, Game B and Game B.
I also want to create more posts, like guides and tutorials, for Game A, is thre a way to group these posts under Game A? I can create a tag called Game A, and group the posts under it. but then I will have duplicate tag and a post for custom post type.
Right now, the only ways (that I know) to group posts are by tag and category. I am clueless when it comes to grouping posts for a post created with a custom post type.
Thank you.
I created a custom post type called Game, and created 3 posts under it, Game A, Game B and Game B.
I also want to create more posts, like guides and tutorials, for Game A, is thre a way to group these posts under Game A? I can create a tag called Game A, and group the posts under it. but then I will have duplicate tag and a post for custom post type.
Right now, the only ways (that I know) to group posts are by tag and category. I am clueless when it comes to grouping posts for a post created with a custom post type.
Thank you.
Share Improve this question asked Jan 6, 2019 at 22:59 Noob CoderNoob Coder 1691 silver badge8 bronze badges1 Answer
Reset to default 1Solution 1.
As you've already mentioned, you can use terms, but - it will cause some redundancy, because for every post you'll have to create a term. And you'll have to maintain this post-term connection later on.
Solution 2.
On the other hand, you can use Custom Fields. So for every Guide and Tutorial you can add Custom Field like "related_game_id" and store the ID of related game in that field.
You can use Advanced Custom Fields and its Relation field to make some nicer interface for editing these relations.
Solution 3.
But there is one more way of achieving this. You can remove CPT Game and add Custom Taxonomy Game.
Then you can add this taxonomy to Guides, Tutorials, and all other post types and use description of a term to edit Game info.
本文标签: categoriesGroup posts by custom post type
版权声明:本文标题:categories - Group posts by custom post type 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749033390a2306025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论