WordPress.org

Ready to get started?Download WordPress

Forums

How to loop through custom fields for a staff directory list (5 posts)

  1. sixfootjames
    Member
    Posted 2 years 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

  2. sixfootjames
    Member
    Posted 2 years 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?

  3. sixfootjames
    Member
    Posted 2 years ago #

    I am then assuming there must be a way to loop through sub pages and fetch all custom fields in those pages?

  4. sixfootjames
    Member
    Posted 2 years ago #

    Anyone able to help with this please?

  5. anthonynmwangi
    Member
    Posted 2 years 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 :)

Topic Closed

This topic has been closed to new replies.

About this Topic