Example #1
0
 /**
  * Shortcode Output
  */
 public function shortcode()
 {
     /*
      * Because it's possible to trigger inception, we need to keep track which
      * level we are in, and reset the shortcode object accordingly.
      *
      * Clever alert. The ++ happens AFTER the value is read, So $my_level starts at 0.
      */
     $my_level = self::$inception_levels++;
     $args = $this->map_related_term_args($this->get_initial_query_args());
     if (!$args) {
         // We failed the related term check.
         return '';
     }
     if (!isset($args['post__not_in']) && is_singular($this->sermons->post_type())) {
         $args['post__not_in'] = array(get_queried_object_id());
     }
     $sermons = $this->sermons->get_many($args);
     if (!$sermons->have_posts()) {
         return '';
     }
     $max = $sermons->max_num_pages;
     $sermons = $this->map_sermon_args($sermons, $my_level);
     $content = '';
     if (0 === $my_level) {
         $content .= GCS_Style_Loader::get_template('list-item-style');
     }
     $args = $this->get_pagination($max);
     $args['wrap_classes'] = $this->get_wrap_classes();
     $args['sermons'] = $sermons;
     $content .= GCS_Template_Loader::get_template('sermons-list', $args);
     return $content;
 }
 public function get_search_results()
 {
     $args = $this->get_initial_query_args();
     $number = $args['number'];
     $offset = $args['offset'];
     // We want to get them all. (well, up to 1000).
     $args['number'] = 1000;
     $args['offset'] = 0;
     $args['hide_empty'] = true;
     $allterms = $this->series->search(sanitize_text_field($this->search_query), $args);
     $allterms = $this->orderby_post_date($allterms);
     if (empty($allterms)) {
         return '';
     }
     $count = count($allterms);
     $total_pages = ceil($count / $number);
     $allterms = array_splice($allterms, $offset, $number);
     if ($count > 900) {
         // Whoops, warn!
         trigger_error('You have more than 900 sermon series terms, and search queries which are requesting greater than 900 sermon series terms. You may want to look into additional performance optimizations.', E_USER_WARNING);
     }
     $args = $this->get_pagination($total_pages);
     $args['terms'] = array($this->augment_terms($allterms));
     $args['remove_dates'] = true;
     $args['wrap_classes'] = $this->get_wrap_classes();
     $this->results = '';
     $this->results .= GCS_Style_Loader::get_template('list-item-style');
     $this->results .= GCS_Template_Loader::get_template('series-list', $args);
     return $this->results;
 }
Example #3
0
 /**
  * Shortcode Output
  */
 public function shortcode()
 {
     $sermon = $this->get_sermon();
     if (!$sermon || !isset($sermon->ID)) {
         return apply_filters('gcs_sermon_play_button_shortcode_output', GCS_Template_Loader::get_template('play-button-shortcode-not-found'), $this);
     }
     if ($this->att('do_scripts')) {
         $this->do_scripts();
     }
     $output = GCS_Style_Loader::get_template('play-button-shortcode-style');
     list($style, $has_icon_font_size) = $this->get_inline_styles();
     $output .= apply_filters('gcs_sermon_play_button_shortcode_output', GCS_Template_Loader::get_template('play-button-shortcode', array('extra_classes' => $this->get_extra_classes($has_icon_font_size), 'sermond_id' => $sermon->ID, 'style' => $style, 'video_url' => get_post_meta($sermon->ID, 'gc_sermon_video_url', 1))), $this);
     return $output;
 }
 /**
  * Loads the view and outputs it
  *
  * @since  0.1.3
  *
  * @param  boolean $echo Whether to output or return the template
  *
  * @return string        Rendered template
  */
 public function load($echo = false)
 {
     $content = '';
     // If we haven't done the template before (or we're forcing it)...
     if (!isset(self::$done[$this->template]) || $this->force) {
         // Then get the content.
         $content = parent::load(false);
     }
     // If we got content...
     if ($content) {
         $content = $this->format_css_tag($content);
         // Ok, this one is done, don't load it again.
         self::$done[$this->template] = $this->template;
     }
     if (!$echo) {
         return $content;
     }
     echo $content;
 }
Example #5
0
 /**
  * Shortcode Output
  */
 public function shortcode()
 {
     $allterms = $this->series->get_many(array('orderby' => 'sermon_date'));
     if (empty($allterms)) {
         return '';
     }
     $args = $this->get_initial_query_args();
     $total_pages = ceil(count($allterms) / $args['posts_per_page']);
     $allterms = array_splice($allterms, $args['offset'], $args['posts_per_page']);
     if (empty($allterms)) {
         return '';
     }
     $args = $this->get_pagination($total_pages);
     $args['terms'] = $this->add_year_index_and_augment_terms($allterms);
     $args['remove_dates'] = $this->bool_att('remove_dates');
     $args['wrap_classes'] = $this->get_wrap_classes();
     $content = '';
     $content .= GCS_Style_Loader::get_template('list-item-style');
     $content .= GCS_Template_Loader::get_template('series-list', $args);
     return $content;
 }
Example #6
0
    ?>
		<?php 
    if (!$this->get('remove_dates')) {
        ?>
		<h4><?php 
        echo $year;
        ?>
</h4>
		<?php 
    }
    ?>
		<ul class="gc-sermons-list">
		<?php 
    foreach ($terms as $term) {
        ?>
			<?php 
        GCS_Template_Loader::output_template('list-item', (array) $term);
        ?>
		<?php 
    }
    ?>
		</ul>
	<?php 
}
?>

	<?php 
GCS_Template_Loader::output_template('nav', $this->args);
?>
</div>
Example #7
0
/**
 * Get's related links output for the sermon.
 *
 * @since  0.1.3
 *
 * @param  mixed   $sermon Post object or ID or (GCS_Sermon_Post object).
 *
 * @return string Sermon related links output.
 */
function gc_get_sermon_related_links($sermon = 0)
{
    $sermon = gc_get_sermon_post($sermon);
    // If no sermon or no related links, bail.
    if (!$sermon || !($links = $sermon->get_meta('gc_related_links')) || !is_array($links)) {
        return '';
    }
    $content = GCS_Template_Loader::get_template('related-links', array('title' => __('Related Links', 'gc-sermons'), 'links' => $links));
    return $content;
}
Example #8
0
 protected function series_search_results()
 {
     $atts = $this->atts;
     unset($atts['search']);
     unset($atts['wrap_classes']);
     $atts = wp_parse_args($atts, $this->att('series_search_args', array()));
     $search = new GCSS_Series_Search_Run($this->search_query, $atts, $this->sermons, $this->taxonomies->series);
     $search->get_search_results();
     return GCS_Template_Loader::get_template('series-search-results', array('wrap_classes' => $this->att('wrap_classes'), 'results' => empty($search->results) ? __('No results.', 'gc-sermons') : $search->results, 'search_notice' => sprintf(__('%s search results for: <em>%s</em>', 'gc-sermons'), $this->taxonomies->series->taxonomy('singular'), esc_html($this->search_query))));
 }