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 comments
Comments are closed.
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 totags
) so: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!):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”
I think best way is custom post type i.e book but if don’t want it then you can create a category for that i.e book and for chapter you can create sub categories like chapter1 and chapter2 and so on…
And follow below code for displaying list of all subcategories….