Home › Forums › General Issues › Portfolio Taxonomy: Names of Selcted Categories Under Custom Field › Reply To: Portfolio Taxonomy: Names of Selcted Categories Under Custom Field
To clarify now that I understand more:
I am using my theme’s existing custom taxonomy portfolio-category, but I don’t know how to perform a var_dump of that field (assuming it’s a field and not a subfield) outside of the loop. I want to eventually be able to use each category I assign via checkbox a link, and to use my portfolio’s existing archive view to view the posts under that category.
In my theme:
I have one category in my theme’s ‘portfolio-category’ named ‘media’ (slug is also media) and five children assigned under that category:
Acrylic (slug: acrylic-media)
Textured Acrylic (slug: textured-acrylic-media)
Digital (slug: digital-media)
Prismacolor (slug: prismacolor)
Field label: Media
field name (slug?): media
field type: Taxonomy
Field Type: Checkbox
Term is ID, not object.
Null is currently not allowed
Since I’m using a taxonomy, using anything like [‘label’] would be out of the question (right?), which is why any of the sub-field snippits I tried did not work, and that a value of 5 from the var_dump was because there is 1 field and 4 sub-fields in my theme’s taxonomy assigned the field ‘media’. So if this method is too complex, then I could resort to another option and attempt to create my own archive function in the (probably distant) future…
If checkbox were chosen instead of taxonomy, I could assign each category a label and a variable in the choices fields in ACF
So something like
acrylic: https://www.mysite.com/acrylic prismacolor: https://www.mysite.com/prismacolor etc.
would work if I wanted to set a value to an ‘href’. But…
I would have to call each subfield by name to retrieve the values from that field, right? Or would there be any way to assign a x-variable type value so I can just add what I wanted to ACF as I add more subfields? A pain, but not quite as much writing code for every subfield in addition to adding to ACF and therefore having two areas to edit.
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!
Plugin boilerplates can do some of the heavy lifting during initial development. We look at four options to speed up your plugin creation. https://t.co/ZtMsdBxAHw— Advanced Custom Fields (@wp_acf) June 5, 2023
© 2023 Advanced Custom Fields.