/** * 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; }
/** * 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; }
/** * 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; }
/** * Get's info for a series attached to the sermon. * * @since 0.1.3 * * @param mixed $sermon Post object or ID or (GCS_Sermon_Post object). * @param boolean $args Args array * @param array $get_series_args Args for GCS_Sermon_Post::get_series() * * @return string Sermon series info output. */ function gc_get_sermon_series_info($sermon = 0, $args = array(), $get_series_args = array()) { if (!($sermon = gc_get_sermon_post($sermon))) { // If no sermon, bail. return ''; } $args = wp_parse_args($args, array('remove_thumbnail' => false, 'remove_description' => true, 'thumbnail_size' => 'medium', 'wrap_classes' => '')); $get_series_args['image_size'] = isset($get_series_args['image_size']) ? $get_series_args['image_size'] : $args['thumbnail_size']; if (!($series = $sermon->get_series($get_series_args))) { // If no series, bail. return ''; } $series->classes = $args['wrap_classes']; $series->do_image = !$args['remove_thumbnail'] && $series->image; $series->do_description = !$args['remove_description'] && $series->description; $series->url = $series->term_link; $content = ''; $content .= GCS_Style_Loader::get_template('list-item-style'); $content .= GCS_Template_Loader::get_template('list-item', (array) $series); // Not a list item. $content = str_replace(array('<li', '</li'), array('<div', '</div'), $content); return $content; }