Example #1
0
function wpfc_display_sermons_shortcode($atts)
{
    // Pull in shortcode attributes and set defaults
    extract(shortcode_atts(array('id' => false, 'posts_per_page' => '10', 'order' => 'DESC', 'hide_nav' => false, 'taxonomy' => false, 'tax_term' => false, 'image_size' => 'sermon_small', 'tax_operator' => 'IN'), $atts, 'sermons'));
    // pagination
    global $paged;
    if (get_query_var('paged')) {
        $my_page = get_query_var('paged');
    } else {
        if (get_query_var('page')) {
            $my_page = get_query_var('page');
        } else {
            $my_page = 1;
        }
        set_query_var('paged', $my_page);
        $paged = $my_page;
    }
    // pagination end
    $args = array('post_type' => 'wpfc_sermon', 'posts_per_page' => $posts_per_page, 'order' => $order, 'meta_key' => 'sermon_date', 'meta_value' => date("m/d/Y"), 'meta_compare' => '>=', 'orderby' => 'meta_value', 'paged' => $my_page);
    // If Post IDs
    if ($id) {
        $posts_in = explode(',', $id);
        $args['post__in'] = $posts_in;
    }
    // If taxonomy attributes, create a taxonomy query
    if (!empty($taxonomy) && !empty($tax_term)) {
        // Term string to array
        $tax_term = explode(', ', $tax_term);
        // Validate operator
        if (!in_array($tax_operator, array('IN', 'NOT IN', 'AND'))) {
            $tax_operator = 'IN';
        }
        $tax_args = array('tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $tax_term, 'operator' => $tax_operator)));
        $args = array_merge($args, $tax_args);
    }
    $listing = new WP_Query($args, $atts);
    // Now that you've run the query, finish populating the object
    ob_start();
    ?>
	<div id="wpfc_sermon">	
	<div id="wpfc_loading">
	<?php 
    if (!$listing->have_posts()) {
        return;
    }
    while ($listing->have_posts()) {
        $listing->the_post();
        global $post;
        ?>
	<div id="wpfc_sermon_wrap">
		<h3 class="sermon-title"><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        printf(esc_attr__('Permalink to %s', 'sermon-manager'), the_title_attribute('echo=0'));
        ?>
" rel="bookmark"><?php 
        the_title();
        ?>
</a></h3> 
	<!--	<?php 
        render_wpfc_sermon_excerpt();
        ?>
  -->
		<?php 
        do_action('sermon_excerpt');
        ?>
	</div>
	<?php 
    }
    //end loop
    ?>
		<div style="clear:both;"></div>

			<?php 
    wp_reset_postdata();
    ?>

			<div id="sermon-navigation">
				<?php 
    $big = 999999;
    echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, $args['paged']), 'total' => $listing->max_num_pages));
    ?>
			</div>
		<div style="clear:both;"></div>
	</div>
	</div>
	<?php 
    $buffer = ob_get_clean();
    return $buffer;
}
            ?>
</a></h2>
			<?php 
        } else {
            ?>
			<span class="entry-title" style="display: none;"><?php 
            the_title();
            ?>
</span>
			<?php 
        }
        ?>

			<div class="post-content">
				<?php 
        render_wpfc_sermon_excerpt();
        ?>
			</div>
			<div style="clear:both;"></div>
			<?php 
        if ($smof_data['post_meta'] && (!$smof_data['post_meta_author'] || !$smof_data['post_meta_date'] || !$smof_data['post_meta_cats'] || !$smof_data['post_meta_comments'] || !$smof_data['post_meta_tags'])) {
            ?>
			<div class="meta-info">
				<div class="alignleft vcard">
					<?php 
            if (!$smof_data['post_meta_author']) {
                echo __('By', 'Avada');
                ?>
 <span class="fn"><?php 
                echo the_terms($post->ID, 'wpfc_preacher', '', ', ', ' ');
                ?>
Example #3
0
function add_wpfc_sermon_content($content)
{
    if ('wpfc_sermon' == get_post_type() && in_the_loop() == true) {
        if (is_archive() || is_search()) {
            $new_content = render_wpfc_sermon_excerpt();
        } elseif (is_singular() && is_main_query()) {
            $new_content = render_wpfc_sermon_single();
        }
        $content = $new_content;
    }
    return $content;
}