Created
October 8, 2012 19:08
-
-
Save jimmyrosen/3854286 to your computer and use it in GitHub Desktop.
Simple fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function gets staff data from a staff database and displays it. | |
// front-end wise we will get a sweet "select post" box in the admin gui. from here we select the staff member and that person is displayed on this page. | |
// And yes. the values could be imported a lot prettier. You do it! | |
$staff_selectors = simple_fields_get_post_group_values(get_the_id(), "Personallistning", true, 1); | |
$staff_count = 1; | |
foreach ($staff_selectors as $staff) { | |
foreach($staff as $staffmember) { | |
$staff_sf_data = get_post_meta($staffmember); | |
$staff_wp_data = get_post($staffmember); | |
if ( has_post_thumbnail($staffmember) ) { | |
echo get_the_post_thumbnail( $staffmember, 'contact-post-thumbnail' ); | |
} else { | |
// fallback image | |
} | |
echo '<h4>' . $staff_wp_data->post_title . '</h4>'; // name | |
$title = simple_fields_get_post_value($staffmember, "Titel", true); | |
if ($title != "") { | |
echo '<em>' . $title . '</em><br />'; // title | |
} | |
echo '<p>'; | |
$dept = simple_fields_get_post_value($staffmember, "Avdelning", true); | |
if ($dept != "") { | |
echo '<em>' . $dept . '</em><br />'; // department | |
} | |
echo '</p>'; | |
$staff_count++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment