示例#1
0
<article <?php 
post_class('post-item-content');
?>
>
    <?php 
$post_id = get_the_ID();
$type = get_post_meta($post_id, '_kt_video_type', true);
$video = get_post_meta($post_id, '_kt_choose_video', true);
$video_id = get_post_meta($post_id, '_kt_video_id', true);
?>
    <div class="post-item-thumb embed-responsive embed-responsive-16by9">
        <?php 
if ($video == 'youtube') {
    echo kt_video_youtube($video_id);
} elseif ($video == 'vimeo') {
    echo kt_video_vimeo($video_id);
}
?>
    </div>
    <div class="post-item-inner">
        <?php 
the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>');
?>
        <div class="post-item-content">
            <?php 
kt_entry_meta_categories();
the_content(sprintf(esc_html__('Continue reading %s', 'adroit'), ' <i class="fa fa-long-arrow-right"></i>'));
kt_entry_meta(true);
?>
        </div>
    </div>
示例#2
0
    function kt_post_thumbnail($size = 'post-thumbnail', $class_img = '', $link = true)
    {
        if (post_password_required() || is_attachment()) {
            return;
        }
        $format = get_post_format();
        $post_id = get_the_ID();
        if (has_post_thumbnail() && $format == '') {
            ?>

            <?php 
            if ($link) {
                ?>
                <a href="<?php 
                the_permalink();
                ?>
" aria-hidden="true" class="entry-thumb">
            <?php 
            } else {
                ?>
                <div class="entry-thumb">
            <?php 
            }
            ?>
                <?php 
            the_post_thumbnail($size, array('alt' => get_the_title(), 'class' => $class_img));
            ?>
            <?php 
            if ($link) {
                ?>
                </a>
            <?php 
            } else {
                ?>
                </div><!-- .entry-thumb -->
            <?php 
            }
            ?>
        <?php 
        } elseif ($format == 'gallery') {
            $type = get_post_meta($post_id, '_kt_gallery_type', true);
            if ($type == 'slider' || !$type) {
                $images = kt_get_galleries_post('_kt_gallery_images', 'kt_blog_post');
                if ($images) {
                    $slider_class = array('blog-posts-slick');
                    $slider_option = '{}';
                    $slider_html = '';
                    foreach ($images as $image) {
                        $slider_html .= sprintf('<div class="gallery-slider-item">%1$s</div>', '<img src="' . $image['url'] . '" title="' . esc_attr($image['title']) . '" alt="' . esc_attr($image['alt']) . '">');
                    }
                    printf('<div class="entry-thumb"><div class="%1$s" data-slick=\'%2$s\'>%3$s</div></div><!-- .entry-thumb -->', implode(' ', $slider_class), esc_attr($slider_option), $slider_html);
                }
            } elseif ($type == 'grid') {
                $images = kt_get_galleries_post('_kt_gallery_images', 'kt_gallery_fullwidth');
                $gallery = '';
                if ($images) {
                    foreach ($images as $image) {
                        $gallery .= sprintf('<div class="%s">%s</div>', 'gallery-image-item', '<img src="' . $image['url'] . '" title="' . esc_attr($image['title']) . '" alt="' . esc_attr($image['alt']) . '">');
                    }
                    printf('<div class="entry-thumb"><div class="%s">%s</div></div><!-- .entry-thumb -->', 'gallery-images gallery-fullwidth clearfix', $gallery);
                }
            } elseif ($type == 'revslider' && class_exists('RevSlider')) {
                if ($rev = rwmb_meta('_kt_gallery_rev_slider')) {
                    echo '<div class="entry-thumb">';
                    putRevSlider($rev);
                    echo '</div><!-- .entry-thumb -->';
                }
            } elseif ($type == 'layerslider' && is_plugin_active('LayerSlider/layerslider.php')) {
                if ($layerslider = rwmb_meta('_kt_gallery_layerslider')) {
                    echo '<div class="entry-thumb">';
                    echo do_shortcode('[layerslider id="' . rwmb_meta('_kt_gallery_layerslider') . '"]');
                    echo '</div><!-- .entry-thumb -->';
                }
            }
        } elseif ($format == 'video') {
            $type = rwmb_meta('_kt_video_type');
            if ($type == 'upload') {
                $mp4 = kt_get_single_file('_kt_video_file_mp4');
                $webm = kt_get_single_file('_kt_video_file_webm');
                if ($mp4 || $webm) {
                    $video_shortcode = "[video ";
                    if ($mp4) {
                        $video_shortcode .= 'mp4="' . $mp4 . '" ';
                    }
                    if ($webm) {
                        $video_shortcode .= 'webm="' . $webm . '" ';
                    }
                    $video_shortcode .= "]";
                    echo '<div class="entry-thumb">' . do_shortcode($video_shortcode) . '</div><!-- .entry-thumb -->';
                }
            } elseif ($type == 'external') {
                $video = get_post_meta($post_id, '_kt_choose_video', true);
                $video_id = get_post_meta($post_id, '_kt_video_id', true);
                if ($video == 'youtube') {
                    printf('<div class="entry-thumb"><div class="embed-responsive embed-responsive-16by9">%s</div></div><!-- .entry-thumb -->', kt_video_youtube($video_id));
                } elseif ($video == 'vimeo') {
                    printf('<div class="entry-thumb"><div class="embed-responsive embed-responsive-16by9">%s</div></div><!-- .entry-thumb -->', kt_video_vimeo($video_id));
                }
            }
        } elseif ($format == 'audio') {
            $type = rwmb_meta('_kt_audio_type');
            if ($type == 'upload') {
                if ($audios = rwmb_meta('_kt_audio_mp3', 'type=file')) {
                    printf('<div class="entry-thumb entry-thumb-audio" style="%s">', "background-image: url('" . get_the_post_thumbnail_url() . "');");
                    foreach ($audios as $audio) {
                        echo do_shortcode('[audio src="' . $audio['url'] . '"][/audio]');
                        break;
                    }
                    echo '</div><!-- .entry-thumb-audio -->';
                }
            } elseif ($type == 'soundcloud') {
                if ($soundcloud = rwmb_meta('_kt_audio_soundcloud')) {
                    echo '<div class="entry-thumb">';
                    echo do_shortcode($soundcloud);
                    echo '</div><!-- .entry-thumb -->';
                }
            }
        } elseif ($format == 'quote') {
            ?>
            <div class="entry-thumb post-quote-wrapper">
                <blockquote class="post-item-quote">
                    <p><?php 
            echo rwmb_meta('_kt_quote_content');
            ?>
</p>
                    <footer><?php 
            echo rwmb_meta('_kt_quote_author');
            ?>
</footer>
                </blockquote>
                <?php 
            if ($link) {
                ?>
                    <a href="<?php 
                the_permalink();
                ?>
" aria-hidden="true" class="post-quote-link"><?php 
                the_title();
                ?>
</a>
                <?php 
            }
            ?>
            </div><!-- .post-quote-wrapper -->
        <?php 
        }
    }
示例#3
0
$post_id = get_the_ID();
$type = get_post_meta($post_id, '_kt_video_type', true);
$video = get_post_meta($post_id, '_kt_choose_video', true);
$video_id = get_post_meta($post_id, '_kt_video_id', true);
?>

    <div class="row row-eq-height">
        <div class="col-md-6 col-sm-6 post-item-thumb">
            <?php 
the_post_thumbnail('kt_first_featured');
?>
        </div>
        <div class="col-md-6 col-sm-6 post-item-info">
            <?php 
the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>');
kt_entry_excerpt();
?>
        </div>
    </div>
    <?php 
if ($video == 'youtube') {
    printf('<div class="embed-responsive embed-responsive-16by9">%s</div>', kt_video_youtube($video_id));
} elseif ($video == 'vimeo') {
    printf('<div class="embed-responsive embed-responsive-16by9">%s</div>', kt_video_vimeo($video_id));
}
?>


</article>