Drop menu from custom field values of several child pages
-
I have been searching around but haven’t found a solution that seems to cover my whole problem.
On the “Stock” page of the site I am working on, I need to produce a drop menu of stock “categories”. The categories are stored as the values of custom fields on the child pages of the “Stock” page (“Stock Item” pages). The issue arises from the fact that each child page could have several values for the “categories” custom field.
As far as I can work out, I need to create an array of the field values for each child page for example by separating them with commas and using “explode”, and then use those arrays to create a new array, i.e. the complete list of categories from all child pages of “Stock”.
I then need to remove duplicate values from this list, leaving only one instance of each existing category. I believe this part is possible using the php, array_unique().
If anyone has any solutions to this problem, I would be eternally grateful! I am pretty new to both php and wordpress, so please make any explanations as straightforward as possible.
Thanks in advance.
- The topic ‘Drop menu from custom field values of several child pages’ is closed to new replies.