I am looking for advice on whether it’s possible to use ACF for the purposes listed below and if so, how to go about it. Or maybe there’s a different plugin or solution that would work better.
I have gone through several parts of the documentation and done some experimenting, but I haven’t been able to wrap my head around it for quite some time now. If anyone is willing to chip in with their advice, I would appreciate it very much.
So I have a content website that includes product reviews. I choose to link to multiple vendors for every product mentioned. Example:
“You can buy the best blue widget in the world at:
1. Vendor A
2. Vendor B
3. Vendor C”
(So this one I am able to do succesfully) Display the product name, image and vendors in the content and in the sidebar “dynamically”. So I would list the vendors at the top of the page, at the bottom and in a sticky sidebar widget using placeholders. The placeholders get filled with custom field information I fill out for every page. I use the ACF shortcode functionality. Works great.
Remove/hide a vendor across the website with a couple of clicks (without editing every page) in a central place in the backend.
Rearrange the order of vendors across the website with a couple of clicks (without editing every page). If the vendor order is ABC now, I want to be able to test CBA instead by changing the order in a central place in the backend.
When information for a vendor is not filled out for a product, do not show anything in the content and use the next available vendor that does have information filled out for that product. Reason: not every product is available from every vendor. So I want to fill the three vendor slots on the frontend dynamically, even if there are more than three vendors listed in the backend. Some products may have a vendor combination that looks like ABE or AFG or even MNO.
So hiding fields should be possible although I don’t quite grasp how to implement it yet: https://www.advancedcustomfields.com/resources/hiding-empty-fields/
But can I also tell ACF/Wordpress to move onto the next vendor/field until 3 vendor slots are filled?
// Possible setup
I’ve already created a single field group containing fields like:
Product image (url)
Vendor A name
Vendor A logo (url)
Vendor A affiliate links (url)
Vendor B name
Vendor B logo (url)
Vendor B etc.
I imagine I have to split this up and create multiple field groups that can then be embedded within each other. I’ve seen several older discussions about this and it’s currently supposed to be possible using https://www.advancedcustomfields.com/resources/clone/ ?
If I create a Field Group called Vendors, I can use it to list every vendor I work with. This will be higher amount than the three vendor limit I actually want to use on a product review page. And not every product will have information filled out for all vendors.
But can I use it to change the order on the front end by changing the order in the back end? Or is the back end order only used to display the fields when editing the page or post?
I feel like I have some individual puzzle pieces and I know what I want the completed puzzle to look like, but I’m having trouble seeing how I need to put it all together.
Any advice, pointers or links you are willing to provide will be greatly appreciated. I’ve searched on different occasions, but I’m probably not using the right terms or looking in the right places.
Thank you very much for your time and replies.
I don’t know how you select the vendor.
I would have at least 2 post types for this and optionally 3. These might be custom post types
I would have a bidirectional relatioship field between the product and the vendor and I would have a bidirectional relationship field between the review and the product. If the product post type is not used then I’d have a relationship directly between the review and the vendor. The vendor post would have information on the vendor, active, inactive, display order, etc. When generating the content for the review I would query this relationship and alter the results based on whatever is stored for each vendor.
This is boiled down, but it would basically give you the ability to do whatever you need to do.
You must be logged in to reply to this topic.
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!