I have created a products page which includes a sidebar. The sidebar has a list of products with many sub categories and the product(s) themselves have many options to be customised (such as the images, information, descriptions, tables, etc). The problem I am having is trying to find a clean way to do this. My current idea is to create an AFC post object called product. Everytime a user wanted to create/add a product they would create a product post. However, how would that product be added to a new product page(template) and be linked using the sidebar? Is there a way to have the sidebar customisable using ACF as well(where someone can add new products, sub categories etc).
For example, as seen in the images above, if I wanted to create an EACF product under Terminal Connectors-Conductor I would add a product post called EACF which would be linked to that button on the sidebar.
Let me know if anyone can help with this! I’m stumped
You’re correct, you should create a custom post type for product https://codex.wordpress.org/Function_Reference/register_post_type. You would set up the post type as having an archive. Then you would create two templates
archive-product.php. The archive template will show lists of product just like the blog archives page.
Alternately you could create custom taxonomies https://codex.wordpress.org/Function_Reference/register_taxonomy for things like “product-category” or “product-brand”, other divisions of products. You could then show a list of categories on the product archive page and then show to list of products on each category page by creating a template for the product category taxonomy. See the WP template hierarchy for more information https://developer.wordpress.org/themes/basics/template-hierarchy/
Your sidebar menu for products, categories, brands, etc could all be dynamically generated pulling information from the correct taxonomies and products. When a new category or brand or product is created it would automatically be added to the menu.
Most of this stuff is not ACF. You would use ACF for adding things to the custom post type and taxonomies that WP does not support, like images for each category if you wanted, field for product details that you want to show in some special way that cannot be easily done in the content editor.
Hope that helps you in the right direction.
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!
© 2023 Advanced Custom Fields.