Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Looping through fields in WordPress #7278
    beades48
    Participant
    This reply has been marked as private.
    in reply to: Looping through fields in WordPress #7253
    beades48
    Participant

    Hi Steve!

    The meta-boxes I am trying to perform the loop over:

    piklist(‘field’, array(
    ‘type’ => ‘text’,
    ‘field’ => ‘last_name’,
    ‘label’ => ‘Last Name’,
    ‘required’ => ‘required’,
    ‘attributes’ => array(
    ‘class’ => ‘regular-text’ // WordPress css class
    )
    ));

    piklist(‘field’, array(
    ‘type’ => ‘select’,
    ‘field’ => ‘org_level’,
    ‘label’ => ‘Organizational Level’,
    ‘value’ => ‘0’,
    ‘choices’ => array(
    ‘0’ => ‘Staff’,
    ’20’ => ‘Department Head’,
    ’40’ => ‘Director’
    )
    ));

    I have tried the following in my function hsl_staff_list ()

    $args = array(
    ‘post_type’ => ‘hsl_staff’,
    ‘post_status’ => ‘publish’,
    ‘numberposts’ => -1,
    ‘meta_query’ => array(
    array (
    ‘key’ => ‘show_directory’,
    ‘value’ => ‘yes’,
    ‘organization’ => array(
    ‘key’ => ‘org_level’,
    ),
    ‘lastname’ => array(
    ‘key’ => ‘last_name’,
    ),
    ),
    ),
    ‘orderby’ => array (
    ‘organization’ => ‘DESC’,
    ‘lastname’ => ‘ASC’,
    ),
    );

    It did order by organization level, but not last name.

    $args = array(
    ‘post_type’ => ‘hsl_staff’,
    ‘post_status’ => ‘publish’,
    ‘numberposts’ => -1,
    ‘meta_query’ => array(
    array (
    ‘key’ => ‘show_directory’,
    ‘value’ => ‘yes’,
    ‘organization’ => array(
    ‘key’ => ‘org_level’,
    ‘value’ => ”,
    ),
    ‘lastname’ => array(
    ‘key’ => ‘last_name’,
    ‘value’ => ”,
    ),
    ),
    ),
    ‘orderby’ => array (
    ‘lastname’ => ‘ASC’,
    ‘organization’ => ‘DESC’,
    ),
    );

    I received the same result as above.

    $args = array(
    ‘post_type’ => ‘hsl_staff’,
    ‘post_status’ => ‘publish’,
    ‘numberposts’ => -1,
    ‘meta_query’ => array(
    array (
    ‘key’ => ‘show_directory’,
    ‘value’ => ‘yes’,
    ),
    ‘meta_key’ => array (‘org_level’, ‘last_name’),
    ‘orderby’ => array (‘meta_value’ => ‘DESC’, ‘meta_value’ => ‘ASC’),
    ),
    );

    This did not order by either organizational level or last name.

    I’m sure it is something that I am missing. I really appreciate the help!

    Lynn

Viewing 2 posts - 1 through 2 (of 2 total)