Exemple #1
0
function cultiv8_the_location_details($post_id, $glyph = 'fa')
{
    $classes = array('container' => 'ctcex-location-container', 'details' => 'ctcex-location-details', 'media' => 'ctcex-location-media', 'title' => 'ctcex-location-title', 'address' => 'ctcex-location-address', 'times' => 'ctcex-location-times', 'phone' => 'ctcex-location-phone', 'img' => 'ctcex-location-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_location_data($post_id);
    // Address
    $addr_src = '';
    if ($data['address']) {
        $addr_src = sprintf('<div class="%s"><i class="%s %s"></i> %s</div>', $classes['address'], $glyph === 'gi' ? 'genericon' : 'fa', $glyph === 'gi' ? 'genericon-location' : 'fa-map-marker', $data['address']);
    }
    // Times
    $time_src = '';
    if ($data['times']) {
        $time_src = sprintf('<div class="%s"><i class="%s %s"></i> %s</div>', $classes['times'], $glyph === 'gi' ? 'genericon' : 'fa', $glyph === 'gi' ? 'genericon-time' : 'fa-clock-o', $data['times']);
    }
    // Phone
    $phone_src = '';
    if ($data['phone']) {
        $phone_src = sprintf('<div class="%s"><i class="%s %s"></i> %s</div>', $classes['phone'], $glyph === 'gi' ? 'genericon' : 'fa', $glyph === 'gi' ? 'genericon-phone' : 'fa-mobile', $data['phone']);
    }
    // Get image
    $img_src = $data['slider'] ? do_shortcode($data['slider']) : '';
    $img_src = !$img_src ? sprintf('%s
			<img class="%s" src="%s" alt="%s" width="960" height="540"/>
		%s', $data['map_used'] ? '<a href="' . $data['map_url'] . '" target="_blank">' : '', $classes['img'], $data['img'], get_the_title(), $data['map_used'] ? '</a>' : '') : $img_src;
    $names = cultiv8_get_option('ctc-people', __('locations/location', 'cultiv8'));
    $plural_name = explode('/', strtolower($names));
    $single_name = array_pop($plural_name);
    // Prepare output
    $item_output = sprintf('<div class="%s">
			<div class="%s">%s</div>
			<div class="%s">
				%s
				%s
				%s
				</div>
			</div>
		', $classes['container'], $classes['media'], $img_src, $classes['details'], $addr_src, $time_src, $phone_src);
    echo $item_output;
}
?>

<?php 
$data = cultiv8_get_sermon_data($post->ID);
if ($data['series']) {
    $tax_query[] = array('taxonomy' => 'ctc_sermon_series', 'field' => 'slug', 'terms' => $data['series_slug']);
    if ($data['topic']) {
        $tax_query[] = array('taxonomy' => 'ctc_sermon_topic', 'field' => 'slug', 'terms' => $data['topic_slug']);
        $tax_query['relation'] = 'AND';
    }
    $args = array('post_type' => 'ctc_sermon', 'tax_query' => $tax_query, 'order' => 'DESC', 'posts_per_page' => 3, 'no_found_rows' => true, 'post__not_in' => array($post->ID));
    $related_pages = new WP_Query($args);
    $topic_name = cultiv8_get_option('ctc-sermon-topic', __('Topic', 'cultiv8'));
    $topic = explode('/', $topic_name);
    $topic = strtolower(array_pop($topic));
    $series_name = cultiv8_get_option('ctc-sermon-series', __('Series', 'cultiv8'));
    $series = explode('/', $series_name);
    $series = strtolower(array_pop($series));
    ?>

<?php 
    if ($related_pages->have_posts()) {
        ?>

<h2><?php 
        echo __('Other messages from this ', 'cultiv8') . strtolower($series) . ($data['topic'] ? _x(' and ', 'Space before and after', 'cultiv8') . strtolower($topic) : '');
        ?>
</h2>

<div class="pique-grid-three">
<?php

/**
 * The template for displaying sermon topic archive pages.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package Cultiv8
 */
$term = get_queried_object();
$titles = cultiv8_option('ctc-sermon-topic', __('Topic', 'cultiv8'));
$titles = explode('/', $titles);
$title = array_pop($titles);
$query_term = $wp_query->query;
$topic_option = cultiv8_get_option('ctc-sermon-topic');
if (!empty($topic_option) && !isset($qv['ctc_sermon_topic'])) {
    // Set the first location as the default
    $locs = get_terms('ctc_sermon_topic', array('order_by' => 'id', 'order' => 'DESC'));
    $min_loc_slug = $locs[0]->slug;
    if (!empty($min_loc_slug)) {
        $tax_query = array(array('taxonomy' => 'ctc_sermon_topic', 'field' => 'slug', 'terms' => $min_loc_slug));
        $args['tax_query'] = $tax_query;
    }
    $query_term = array_merge($args, $query_term);
    $wp_query = new WP_Query($query_term);
}
get_header();
?>


	<div id="primary" class="content-area">