doucai6663 2015-07-09 04:35
浏览 52

Wordpress,自定义帖子类型关系到很多帖子

I have an e-book that I would like to integrate in wordpress. I would have to get a page listing the books from a custom post "books". When clicking on a book, I would display the different chapter of the book. Finally when clicking on a chapter i would like to display it. Knowing that chapters would be store in a custom post "chapters". I made some search for custom type relationship one to many. Help welcome knowing that if you have another solution to offer me rather than go through the custom types I'm interested too.

  • 写回答

2条回答 默认 最新

  • duanci9305 2015-07-09 05:44
    关注

    I think you are overthinking this, there are several ways to achieve what you want without any custom post types...

    Categories are hierarchical (as opposed to tags) so:

    • your book can be a top level category (or you can have a top level category called "books" under which you place all books)
    • your chapters are simply posts under each of the categories
    • or you could make chapters into categories, and have each individual page be a post under that

    You don't need any custom post types to do this, though it might be nice to separate the books from other posts by using one custom post type for chapters (or individual pages if you go that way) and using one custom taxonomy for the books (and chapters if you split to individual pages).

    You could even do it using only the parent / child relationship of standard wordpress' pages (they are hierarchical too!):

    • A book is a page
    • Under each book is a child page that holds the chapter text (just create a new page and set its parent to the books main page)

    Now to actually display everything the way you want you will probably want to study the template hierarchy and create some custom templates for your specific "types"

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)