<?php //** //* A template for LLED Profiles. http://lled.educ.ubc.ca/faculty-and-staff/faculty/ // Fetch the post ID for the currently set up post - we're in the loop $post_id = get_the_ID(); // How to get the post thumbnail $post_thumbnail = wp_get_attachment_url(get_post_thumbnail_id(absint($post_id))); // Replacement for [plain_tags_slug] $plain_tags_slug = \UBC\Helpers::get_plain_tags(absint($post_id), 'slug', ' '); // Replacement for [plain_term_slug] $plain_term_slug = \UBC\Helpers::get_plain_terms(absint($post_id), 'slug', ' '); // To get Taxonomies as names $plain_term_name = \UBC\Helpers::get_plain_terms(absint($post_id), 'name', ' '); // Replacement for [odd-even] but *really* this should be done in CSS. global $usage_id; $usage_id++; $odd_even = 0 === $usage_id % 2 ? 'even' : 'odd'; //Get the Profile Fields $profile_cct = get_post_meta($post_id, 'profile_cct', true); $salutations = isset($profile_cct['name']['salutations']) ? $profile_cct['name']['salutations'] : false; $first_name = isset($profile_cct['name']['first']) ? $profile_cct['name']['first'] : false; $middle_name = isset($profile_cct['name']['middle']) ? $profile_cct['name']['middle'] : false; $last_name = isset($profile_cct['name']['last']) ? $profile_cct['name']['last'] : false; $position = isset($profile_cct['position']['0']['position']) ? $profile_cct['position']['0']['position'] : false; $clone_room_number = isset($profile_cct['clone_room_number']['0']['position']) ? $profile_cct['clone_room_number']['0']['position'] : false; $phone1 = isset($profile_cct['phone']['0']['tel-1']) ? $profile_cct['phone']['0']['tel-1'] : false; $phone2 = isset($profile_cct['phone']['0']['tel-2']) ? $profile_cct['phone']['0']['tel-2'] : false; $phone3 = isset($profile_cct['phone']['0']['tel-3']) ? $profile_cct['phone']['0']['tel-3'] : false; $email = isset($profile_cct['email']['0']['email']) ? $profile_cct['email']['0']['email'] : false; $bio = isset($profile_cct['bio']['textarea']) ? $profile_cct['bio']['textarea'] : false;
* use them sparingly - WITH ESCAPING - in the markup * */ // Fetch the post ID for the currently set up post - we're in the loop $post_id = get_the_ID(); // Some custom fields $location = get_post_meta(absint($post_id), 'location', true); $department = get_post_meta(absint($post_id), 'department', true); $programlink = get_post_meta(absint($post_id), 'programlink', true); $applylink = get_post_meta(absint($post_id), 'applylink', true); // How to get the post thumbnail $post_thumbnail = wp_get_attachment_url(get_post_thumbnail_id(absint($post_id))); // Replacement for [plain_tags_slug] $plain_tags_slug = \UBC\Helpers::get_plain_tags(absint($post_id), 'slug', ' '); // Replacement for [plain_term_slug] $plain_term_slug = \UBC\Helpers::get_plain_terms(absint($post_id), 'slug', ' '); // Replacement for [odd-even] but *really* this should be done in CSS. global $usage_id; $usage_id++; $odd_even = 0 === $usage_id % 2 ? 'even' : 'odd'; ?> <div id="<?php echo absint($post_id); ?> " class="<?php echo esc_attr($plain_tags_slug); ?> "> <div class="boxey <?php
$coursecodeundergrad = get_post_meta($post_id, 'CourseCodeUndergrad', true); $coursecodegrad = get_post_meta($post_id, 'CourseCodeGrad', true); $vanityurl = get_post_meta($post_id, 'VanityUrl', true); $credit = get_post_meta($post_id, 'Credit', true); $promophoto = get_post_meta($post_id, 'PromoPhoto', true); $subtitle = get_post_meta($post_id, 'Subtitle', true); $dates = get_post_meta($post_id, 'Dates', true); $location = get_post_meta($post_id, 'Location', true); $deliverymode = get_post_meta($post_id, 'DeliveryMode', true); $programtype = get_post_meta($post_id, 'ProgramType', true); // How to get the post thumbnail $post_thumbnail = wp_get_attachment_url(get_post_thumbnail_id($post_id)); // Replacement for [plain_tags_slug] $plain_tags_slug = \UBC\Helpers::get_plain_tags($post_id, 'slug', ' '); // Replacement for [plain_term_slug] $plain_term_slug = \UBC\Helpers::get_plain_terms($post_id, 'slug', ' '); // Replacement for [odd-even] but *really* this should be done in CSS. global $usage_id; $usage_id++; $odd_even = 0 === $usage_id % 2 ? 'even' : 'odd'; //change the icon based on the delivery mode $icon = ""; switch ($deliverymode) { case "Face-to-Face": $icon = 'icon-group'; break; case "Online": $icon = 'icon-laptop'; break; case "Mixed Mode": $icon = 'icon-road';