Home › Forums › General Issues › Relationship between fields and tables
I’m doing a book database. Obviously books have authors. These authors have not just written a book than I have on file.
How can I do to have in the form a drop down box with the author to select for the book by insert on database?
I thought to relate the archive books with that of the authors.
What is better to use taxonomies, relationship field types or repeater fields?
Thanks and sorry
I’m a bit new in ACF
Carlo Carlini
P.S.: I have PRO version
Hi @boxcarlo
I’m afraid I don’t understand your question, so forgive me if I’m wrong.
If you want to add the authors of the books, I believe the best thing to do is to use a custom post type for the authors and then you can use a post object field type to set the author. By using a custom post type, you can specify more fields and custom query in the future.
Also, if a book has more than one authors, you can set the “Select multiple values?” option on the post object field or use a repeater fields for the authors.
I hope this helps 🙂
Hi James and thanks
I apologize if I messed up
I would like to store books by choosing the author via a selection box.
This means, for example, that the same writer who wrote more than one book may appear on more than one record books.
Example:
Joseph Conrad wrote Lord Jim and The Shadow Line. If I put on file the book Lord Jim, as a writer I have to put Joseph Conrad.
The same thing must I do to store The Shadow Line.
But I think it is not necessary to enter another time Joseph Conrad into the book data. In fact, if I have the authors archive, Conrad is already registered and you only need to choose him from a selection box, but will have to be dynamically linked to the archive authors.
This is what I would do and would like to know how to do it using ACF.
I hope I have clarified my request.
Carlo
Hi @boxcarlo
Thanks for the explanation.
Like I said before, I think the best way to achieve this is to create a custom post type to store the authors. That way, it will be more flexible and easy to manage. You can use a plugin like Custom Post Type UI to create the custom post type. After that, just link the books to the authors by using the post object field type.
I hope this makes sense 🙂
The topic ‘Relationship between fields and tables’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.