sixfootjames
Member
Posted 4 months ago #
Hi,
I have a number of pages for staff members in my WP installation and each of these has additional custom fields for telephone, email, fax, a class room number.
I need to create a directory listing page which will pull all the custom fields from these pages depending on the department they are in.
The custom fields on my Staff Details page is working superbly but now I need a way to extract all that information to create a list for all the departments please.
Many thanks
sixfootjames
Member
Posted 4 months ago #
It seems there is no categories associated with pages specifically. Is there any other way to loop through all the staff pages and know what department they might be in?
sixfootjames
Member
Posted 4 months ago #
I am then assuming there must be a way to loop through sub pages and fetch all custom fields in those pages?
sixfootjames
Member
Posted 3 months ago #
Anyone able to help with this please?
anthonynmwangi
Member
Posted 2 months ago #
Hi sixfootjames, was encountering a similar problem and came across your posts. Here a link that helped me around my problem: http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters.
My take is the staff members should be posts, different departments should be different categories, Directory should remain a page, and custom fields for telephone, email, fax, a class room number are fine. So when you open your Directory listings page it lists only the staff in a particular department and using meta_query you can filter using your Custom Fields.
Hope I was of some help :)