Example #1
0
 public function video_modal()
 {
     static $done;
     // Get shortcode instances
     $shortcodes = WDS_Shortcode_Instances::get($this->shortcode);
     if ($done || empty($shortcodes)) {
         return;
     }
     $videos = array();
     foreach ($shortcodes as $shortcode) {
         // Check for found sermons
         if (!($sermon = $shortcode->att('sermon'))) {
             continue;
         }
         // Check for video player
         if (!($player = $sermon->get_video_player())) {
             return;
         }
         // Ok, add the video player
         $videos[$sermon->ID] = $player;
     }
     if (!empty($videos)) {
         echo new GCS_Template_Loader('play-button-shortcode-modal-videos', array('videos' => $videos));
     }
     $done = true;
 }
Example #2
0
 protected function map_sermon_args($all_sermons, $my_level)
 {
     global $post;
     $sermons = array();
     $do_thumb = !$this->bool_att('remove_thumbnail');
     $do_content = $this->bool_att('content');
     $type_of_content = $this->att('content');
     $thumb_size = $this->att('thumbnail_size');
     while ($all_sermons->have_posts()) {
         $all_sermons->the_post();
         $obj = $all_sermons->post;
         $sermon = array();
         $sermon['url'] = $obj->permalink();
         $sermon['name'] = $obj->title();
         $sermon['image'] = $do_thumb ? $obj->featured_image($thumb_size) : '';
         $sermon['do_image'] = (bool) $sermon['image'];
         $sermon['description'] = '';
         $sermon['do_description'] = $do_content;
         if ($do_content) {
             $sermon['description'] = 'excerpt' === $type_of_content ? $obj->loop_excerpt() : apply_filters('the_content', $obj->post_content);
         }
         $sermons[] = $sermon;
     }
     wp_reset_postdata();
     if ($do_content) {
         /*
          * Reset shortcode_object as well, as calling the content/excerpt
          * could trigger inception and change the object under us.
          */
         $this->shortcode_object = WDS_Shortcode_Instances::get($this->shortcode, $my_level);
     }
     return $sermons;
 }
 /**
  * Generates a new unique WDS_Shortcode object to hold this shortcode's data
  *
  * @since  0.1.0
  *
  * @param  array  $atts    Array of attributes after shortcode_atts.
  * @param  string $content Shortcode content.
  *
  * @return WDS_Shortcode
  */
 public function create_shortcode_object($atts, $content)
 {
     $this->shortcode_object = WDS_Shortcode_Instances::add(new WDS_Shortcode($this->shortcode, $atts, $content));
     $this->shortcode_object->content();
     return $this->shortcode_object;
 }
 function test_count_instances_of_shortcode()
 {
     $this->assertEquals(1, WDS_Shortcode_Instances::count('sc'));
 }