I have three Custom Post Types: Book, Volume and Chapter where one Book can contain many Volumes and one Volume can contain many Chapters.
I want to do something like this:
-
The user access “Books”
-
The user select a book for editing and, inside that page, on the meta box, he can add/edit just the volumes relating to that book
-
The user select a volume for editing and, inside that page, on the meta box, he can add/edit just the chapters relating to that volume
-
The user finally select a chapter to edit
I initially thought of putting an iframe inside the meta box area on the post types using the src
attribute as edit.php?post_type=post_type
with some filters on its query string, to list just the post type related to the respective page.
What would be best in that situation?
Is that a pattern on WordPress to work with situations like that, where Custom Post Types needs to be Custom Fields of another Custom Post Type, i.e. one to many entity relationship?
Just using hierarchical post types is completely valid. You can do nearly everything with that and probably won’t need to go beyond that.
If you really need n/n relationships (which I doubt from your description), take a look at the Posts2Posts plugin.
why don’t you use Book as Custom post type and Volume and Chapter as Custom Taxonomy?
or
If you want to use only Custom Post Type. Please use [Advanced Custom Fields][1]
[1]: http://www.advancedcustomfields.com/ plugin.
With that plugin you can do many things. and it has very good documentation.
I agree with @Kaung Ko’s answer – I just finished a project using Custom Post Type and Custom Taxonomies. Very similar to yours but for Wine Reviews. Also used the Advanced Custom Fields plugin for further customization.
@João Paulin – do you have a plugin installed for that custom Admin style (black left column) in the screeshots? That looks much better than native WordPress.