<div class="col-md-9 col-sm-9">
       				<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
   echo '<span class="meta-data"><i class="fa fa-calendar"></i>' . __('Posted on ', 'framework') . get_the_time(get_option('date_format'));
   echo get_the_term_list(get_the_ID(), 'sermons-speakers', ' | Pastor: ', ', ', '');
   echo '</span>
                                    </div>';
   echo '<div class="col-md-3 col-sm-3 sermon-actions">';
   if (!empty($custom['imic_sermons_url'][0])) {
       echo '<a href="' . get_permalink() . '#playvideo" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Video', 'framework') . '" rel="tooltip"><i class="fa fa-video-camera"></i></a>';
   }
   $attach_full_audio = imic_sermon_attach_full_audio(get_the_ID());
   if (!empty($attach_full_audio)) {
       echo '<a href="' . get_permalink() . '#play-audio" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Audio', 'framework') . '" rel="tooltip"><i class="fa fa-headphones"></i></a>';
   }
   echo '<a href="' . get_permalink() . '#read" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Read online', 'framework') . '" rel="tooltip"><i class="fa fa-file-text-o"></i></a>';
   $attach_pdf = imic_sermon_attach_full_pdf(get_the_ID());
   if (!empty($attach_pdf)) {
       echo '<a href="' . IMIC_THEME_PATH . '/download/download.php?file=' . $attach_pdf . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download PDF', 'framework') . '" rel="tooltip"><i class="fa fa-book"></i></a>';
   }
   echo '</div>
            	</div>';
   ?>
                   </header>
                   <div class="post-content">
                       <div class="row">
                       <?php 
   if (has_post_thumbnail()) {
       ?>
                           <div class="col-md-4">
                               <a href="<?php 
       the_permalink();
Esempio n. 2
0
function imic_sermon($atts, $content = null)
{
    extract(shortcode_atts(array("number" => "", "title" => "", "category" => "", "column" => ""), $atts));
    $output = '';
    query_posts(array('post_type' => 'sermons', 'sermons-category' => $category, 'posts_per_page' => $number, 'orderby' => 'ID', 'order' => 'DESC'));
    if (have_posts()) {
        $output .= '<div class="col-md-' . $column . ' sermon-archive">';
        if (!empty($title)) {
            $output .= '<h2>' . $title . '</h2>';
        }
        ?>
        <!-- Sermons Listing -->
        <?php 
        while (have_posts()) {
            the_post();
            if ('' != get_the_post_thumbnail()) {
                $class = "col-md-8";
            } else {
                $class = "col-md-12";
            }
            $custom = get_post_custom(get_the_ID());
            $output .= '<article class="post sermon">
                        <header class="post-title">';
            $output .= '<div class="row">
      					<div class="col-md-9 col-sm-9">
            				<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
            $output .= '<span class="meta-data"><i class="fa fa-calendar"></i>' . __('Posted on ', 'framework') . get_the_time(get_option('date_format'));
            $output .= get_the_term_list(get_the_ID(), 'sermons-speakers', ' | Pastor: ', ', ', '');
            $output .= '</span>
                                         </div>';
            $output .= '<div class="col-md-3 col-sm-3 sermon-actions">';
            if (!empty($custom['imic_sermons_url'][0])) {
                $output .= '<a href="' . get_permalink() . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Video', 'framework') . '" rel="tooltip"><i class="fa fa-video-camera"></i></a>';
            }
            $attach_full_audio = imic_sermon_attach_full_audio(get_the_ID());
            if (!empty($attach_full_audio)) {
                $output .= '<a href="' . get_permalink() . '/#play-audio" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Audio', 'framework') . '" rel="tooltip"><i class="fa fa-headphones"></i></a>';
            }
            $output .= '<a href="' . get_permalink() . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Read online', 'framework') . '" rel="tooltip"><i class="fa fa-file-text-o"></i></a>';
            $attach_pdf = imic_sermon_attach_full_pdf(get_the_ID());
            if (!empty($attach_pdf)) {
                $output .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_pdf . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download PDF', 'framework') . '" rel="tooltip"><i class="fa fa-book"></i></a>';
            }
            $output .= '</div>
                 	</div>';
            $output .= '</header>
                        <div class="post-content">
                            <div class="row">';
            if (has_post_thumbnail()) {
                $output .= '<div class="col-md-4">
                                    <a href="' . get_permalink(get_the_ID()) . '" class="media-box">';
                $output .= get_the_post_thumbnail(get_the_ID(), 'full', array('class' => "img-thumbnail"));
                $output .= '</a></div>';
            }
            $output .= '<div class="' . $class . '">';
            $description = imic_excerpt(100);
            if (!empty($description)) {
                $output .= $description;
            }
            $output .= '<p><a href="' . get_permalink() . '" class="btn btn-primary">' . __('Continue reading ', 'framework') . '<i class="fa fa-long-arrow-right"></i></a></p>';
            $output .= '</div>
                            </div>
                        </div>
                    </article>';
        }
        $output .= '</div>';
    }
    wp_reset_query();
    return $output;
}
Esempio n. 3
0
    function widget($args, $instance)
    {
        global $wp_query;
        $temp_wp_query = clone $wp_query;
        extract($args);
        // these are the widget options
        $post_title = apply_filters('widget_title', $instance['title']);
        $number = apply_filters('widget_number', $instance['number']);
        $category = apply_filters('widget-category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base);
        $autoplay = isset($instance['autoplay']) ? $instance['autoplay'] : 0;
        $numberPost = !empty($number) ? $number : 3;
        echo $args['before_widget'];
        echo '<div class="listing sermons-listing">';
        if (!empty($instance['title'])) {
            echo '<header class="listing-header">';
            echo $args['before_title'];
            echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
            echo $args['after_title'];
            echo '</header>';
        }
        $posts = query_posts(array('order' => 'DESC', 'post_type' => 'sermons', 'sermons-category' => $category, 'posts_per_page' => $numberPost, 'post_status' => 'publish'));
        if (!empty($posts)) {
            echo '<section class="listing-cont">
					<ul>';
            $liFirst = $liOthers = '';
            $flag = 0;
            foreach ($posts as $post) {
                /* check if content has sortcode video */
                if (has_shortcode($post->post_content, 'fullscreenvideo')) {
                    apply_filters('the_content', $post->post_content);
                    $post->post_content = do_shortcode($post->post_content);
                } else {
                    $post->post_content = wp_trim_words($post->post_content, 30);
                }
                /* end check if content has sortcode video */
                $custom = get_post_custom($post->ID);
                if (!empty($custom['imic_sermons_url'][0]) && $flag == 0) {
                    $liFirst .= '<li class="item sermon featured-sermon">
                                    <span class="date">' . get_the_time(get_option('date_format'), $post->ID) . '</span>
                                    <h4><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h4>
                                    <div class="featured-sermon-video">' . imic_video_embed($custom['imic_sermons_url'][0], '200', '150', $autoplay) . '</div><p>' . $post->post_content . '</p><div class="sermon-actions">';
                    if (!empty($custom['imic_sermons_url'][0])) {
                        $liFirst .= '<a href="' . get_permalink($post->ID) . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Video', 'imic-framework-admin') . '"><i class="fa fa-video-camera"></i></a>';
                    }
                    $attach_full_audio = imic_sermon_attach_full_audio($post->ID);
                    if (!empty($attach_full_audio)) {
                        $liFirst .= '<a href="' . get_permalink($post->ID) . '#play-audio" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Audio', 'imic-framework-admin') . '"><i class="fa fa-headphones"></i></a>';
                    }
                    if (!empty($attach_full_audio)) {
                        $liFirst .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_full_audio . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download Audio', 'imic-framework-admin') . '"><i class="fa fa-download"></i></a>';
                    }
                    $attach_pdf = imic_sermon_attach_full_pdf($post->ID);
                    if (!empty($attach_pdf)) {
                        $liFirst .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_pdf . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download PDF', 'imic-framework-admin') . '"><i class="fa fa-book"></i></a>';
                    }
                    $liFirst .= '</div>
                                </li>';
                } else {
                    if (!empty($custom['imic_sermons_video_mp4'][0]) && $flag == 0) {
                        $liFirst .= '<li class="item sermon featured-sermon">
								<span class="date">' . get_the_time(get_option('date_format'), $post->ID) . '</span>
								<h4><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h4><div class="featured-sermon-video">';
                        $poster = '';
                        if (isset($custom['imic_sermons_video_poster'][0]) && !empty($custom['imic_sermons_video_poster'][0])) {
                            $poster = $custom['imic_sermons_video_poster'][0];
                        }
                        $liFirst .= '<div class="video-container">';
                        $liFirst .= '<video width="320" height="240" poster="' . $poster . '" controls preload="none" class="custom-video">';
                        if (isset($custom['imic_sermons_video_mp4'][0]) && !empty($custom['imic_sermons_video_mp4'][0])) {
                            $liFirst .= '<source type="video/mp4" src="' . $custom['imic_sermons_video_mp4'][0] . '" />';
                        }
                        if (isset($custom['imic_sermons_video_webm'][0]) && !empty($custom['imic_sermons_video_webm'][0])) {
                            $liFirst .= '<source type="video/webm" src="' . $custom['imic_sermons_video_webm'][0] . '" />';
                        }
                        if (isset($custom['imic_sermons_video_ogv'][0]) && !empty($custom['imic_sermons_video_ogv'][0])) {
                            $liFirst .= '<source type="video/ogg" src="' . $custom['imic_sermons_video_ogv'][0] . '" />';
                        }
                        $liFirst .= '<object width="320" height="240" type="application/x-shockwave-flash" data="flashmediaelement.swf">';
                        $liFirst .= '<param name="movie" value="' . get_template_directory_uri() . '/plugins/mediaelementflashmediaelement.swf" />';
                        if (isset($custom['imic_sermons_video_poster'][0]) && !empty($custom['imic_sermons_video_mp4'][0])) {
                            $liFirst .= '<param name="flashvars" value="controls=true&file=' . $custom['imic_sermons_video_mp4'][0] . '" />';
                        }
                        $liFirst .= '</object>';
                        $liFirst .= '</video>';
                        $liFirst .= '</div>' . '</div><p>' . $post->post_content . '</p><div class="sermon-actions">';
                        if (isset($custom['imic_sermons_url'][0]) && !empty($custom['imic_sermons_url'][0])) {
                            $liFirst .= '<a href="' . get_permalink($post->ID) . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Video', 'imic-framework-admin') . '"><i class="fa fa-video-camera"></i></a>';
                        }
                        $attach_full_audio = imic_sermon_attach_full_audio($post->ID);
                        if (!$attach_full_audio) {
                            $liFirst .= '<a href="' . get_permalink($post->ID) . '#play-audio" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Audio', 'imic-framework-admin') . '"><i class="fa fa-headphones"></i></a>';
                        }
                        if (!empty($attach_full_audio)) {
                            $liFirst .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_full_audio . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download Audio', 'imic-framework-admin') . '"><i class="fa fa-download"></i></a>';
                        }
                        $attach_pdf = imic_sermon_attach_full_pdf($post->ID);
                        if (!empty($attach_pdf)) {
                            $liFirst .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_pdf . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download PDF', 'imic-framework-admin') . '"><i class="fa fa-book"></i></a>';
                        }
                        $liFirst .= '</div>
									</li>';
                    } else {
                        if (has_post_thumbnail($post->ID) && $flag == 0) {
                            //get the featured image
                            $featured_image_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                            //end
                            $liFirst .= '<li class="item sermon featured-sermon">
								<span class="date">' . get_the_time(get_option('date_format'), $post->ID) . '</span>
								<h4><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h4>
								<div class="featured-sermon-video format-standard">' . '<a href="' . get_permalink($post->ID) . '" class="media-box"><img src="' . $featured_image_url . '" />' . '</a></div><p>' . $post->post_content . '</p><div class="sermon-actions">';
                            if (!empty($custom['imic_sermons_url'][0])) {
                                $liFirst .= '<a href="' . get_permalink($post->ID) . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Video', 'imic-framework-admin') . '"><i class="fa fa-video-camera"></i></a>';
                            }
                            $attach_full_audio = imic_sermon_attach_full_audio($post->ID);
                            if (!empty($attach_full_audio)) {
                                $liFirst .= '<a href="' . get_permalink($post->ID) . '#play-audio" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Audio', 'imic-framework-admin') . '"><i class="fa fa-headphones"></i></a>';
                            }
                            if (!empty($attach_full_audio)) {
                                $liFirst .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_full_audio . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download Audio', 'imic-framework-admin') . '"><i class="fa fa-download"></i></a>';
                            }
                            $attach_pdf = imic_sermon_attach_full_pdf($post->ID);
                            if (!empty($attach_pdf)) {
                                $liFirst .= '<a href="' . get_template_directory_uri() . '/download/download.php?file=' . $attach_pdf . '" data-placement="top" data-toggle="tooltip" data-original-title="' . __('Download PDF', 'imic-framework-admin') . '"><i class="fa fa-book"></i></a>';
                            }
                            $liFirst .= '</div>
									</li>';
                        } else {
                            $liOthers .= '<li class="item sermon">
                                    <h2 class="sermon-title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h2>
                                    <span class="meta-data"><i class="fa fa-calendar"></i>' . __(' on ', 'imic-framework-admin') . get_the_time(get_option('date_format'), $post->ID) . '</span>
                                </li>';
                        }
                    }
                }
                $flag++;
            }
            echo $liFirst . $liOthers;
            echo '</ul></section>';
        } else {
            _e('No Sermon Found', 'imic-framework-admin');
        }
        echo '</div>';
        echo $args['after_widget'];
        $wp_query = clone $temp_wp_query;
    }