<?php /** * Template part for displaying single person posts. * * @package Cultiv8 */ $data = cultiv8_get_person_data(get_the_ID()); $title = get_the_title(); $url_src = ''; $urls = explode("\r\n", $data['url']); if ($urls) { if ($data['email']) { $urls[] = 'mailto:' . $data['email']; } $url_src = '<div class="gi ctcex-person-urls ctcex-socials" style="width:100%"><ul class="textcenter">'; foreach ($urls as $url_item) { $url_src .= sprintf('<li><a href="%s">%s</a></li>', $url_item, $url_item); } $url_src .= '</ul></div>'; } $img_src = $data['img'] ? sprintf('<div class="cultiv8-fixedratio cultiv8-square"> <div class="cultiv8-fixedratio-content cultiv8-circle"><img class="ctcex-person-img" src="%s" alt="%s" width="960" height="540"/></div></div>', $data['img'], $title) : ''; $position_src = $data['position'] ? sprintf('<h3 class="ctcex-person-position textcenter normfont flush-bottom">%s</h3>', $data['position']) : ''; $item_output = sprintf('<div class="ctcex-person-container" data-groups="%s" data-order="%s"> %s <div class="ctcex-person-details"> <h2 class="ctcex-person-title textcenter flush-bottom"><a href="%s">%s</a></h2> %s %s </div>
function cultiv8_the_person_details($post_id, $glyph = 'fa') { $classes = array('container' => 'ctcex-person-container', 'details' => 'ctcex-person-details', 'title' => 'ctcex-person-title', 'position' => 'ctcex-person-position', 'email' => 'ctcex-person-email', 'urls' => 'ctcex-person-urls', 'img' => 'ctcex-person-img'); wp_enqueue_style('cultiv8-glyphs', get_stylesheet_directory_uri() . '/assets/css/glyphs.css', array(), null, 'screen'); $title = get_the_title($post_id); $data = cultiv8_get_person_data($post_id); $urls = explode("\r\n", $data['url']); if ($data['email']) { $urls[] = 'mailto:' . $data['email']; } // URLs $url_src = sprintf('<div class="%s %s ctcex-socials"><ul>', $classes['urls'], $glyph === 'gi' ? 'gi' : 'fa'); foreach ($urls as $url_item) { $url_src .= sprintf('<li><a href="%s">%s</a></li>', $url_item, $url_item); } $url_src .= '</ul></div>'; // Get position $position_src = $data['position'] ? sprintf('<h3 class="%s">%s</h3>', $classes['position'], $data['position']) : ''; // Get image $img_src = $data['img'] ? sprintf('<img class="%s" src="%s" alt="%s" width="300" height="300"/>', $classes['img'], $data['img'], $title) : ''; $names = cultiv8_get_option('ctc-people', __('people/person', 'cultiv8')); $plural_name = explode('/', strtolower($names)); $single_name = array_pop($plural_name); // Prepare output $item_output = sprintf('<div class="%s"> %s <div class="%s"> %s %s </div> </div> ', $classes['container'], $img_src, $classes['details'], $position_src, $url_src); echo $item_output; }
//error_log( json_encode( $ctc_people ) ); ?> <?php if ($ctc_people->have_posts()) { ?> <div class="pique-grid-three"> <?php while ($ctc_people->have_posts()) { $ctc_people->the_post(); ?> <?php $post_id = get_the_ID(); $data = cultiv8_get_person_data($post_id); $urls = explode("\r\n", $data['url']); echo json_encode($data); ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php if ($data['img']) { ?> <div class="cultiv8-fixedratio cultiv8-square"> <div class="cultiv8-fixedratio-content cultiv8-circle">