/** * Return post media by format * * @param $post_format * @param $options * @return string * * @since 3.0 */ function kleo_get_post_media($post_format = 'standard', $options = array()) { global $kleo_config; if (isset($options['icons']) && $options['icons']) { $icons = true; } else { $icons = false; } if (isset($options['media_width']) && isset($options['media_height'])) { $media_width = $options['media_width']; $media_height = $options['media_height']; } else { $media_width = $kleo_config['post_gallery_img_width']; $media_height = $kleo_config['post_gallery_img_height']; } $output = ''; switch ($post_format) { case 'video': //oEmbed video $video = get_cfield('embed'); // video bg self hosted $bg_video_args = array(); $k_video = ''; if (get_cfield('video_mp4')) { $bg_video_args['mp4'] = get_cfield('video_mp4'); } if (get_cfield('video_ogv')) { $bg_video_args['ogv'] = get_cfield('video_ogv'); } if (get_cfield('video_webm')) { $bg_video_args['webm'] = get_cfield('video_webm'); } if (!empty($bg_video_args)) { $attr_strings = array('preload="none"'); if (get_cfield('video_poster')) { $attr_strings[] = 'poster="' . get_cfield('video_poster') . '"'; } $k_video .= '<div class="kleo-video-wrap"><video ' . join(' ', $attr_strings) . ' controls="controls" class="kleo-video" style="width: 100%; height: 100%;">'; $source = '<source type="%s" src="%s" />'; foreach ($bg_video_args as $video_type => $video_src) { $video_type = wp_check_filetype($video_src, wp_get_mime_types()); $k_video .= sprintf($source, $video_type['type'], esc_url($video_src)); } $k_video .= '</video></div>'; $output .= $k_video; } elseif (!empty($video)) { global $wp_embed; $output .= apply_filters('kleo_oembed_video', $video); } break; case 'audio': $audio = get_cfield('audio'); if (!empty($audio)) { $output .= '<div class="post-audio">' . '<audio preload="none" class="kleo-audio" id="audio_' . get_the_ID() . '" style="width:100%;" src="' . $audio . '"></audio>' . '</div>'; } break; case 'gallery': $slides = get_cfield('slider'); $output .= '<div class="kleo-banner-slider">' . '<div class="kleo-banner-items" >'; if ($slides) { foreach ($slides as $slide) { if ($slide) { $image = aq_resize($slide, $media_width, $media_height, true, true, true); //small hack for non-hosted images if (!$image) { $image = $slide; } $output .= '<article> <a href="' . $slide . '" data-rel="modalPhoto[inner-gallery]"> <img src="' . $image . '" alt="' . get_the_title() . '">' . kleo_get_img_overlay() . '</a> </article>'; } } } $output .= '</div>' . '<a href="#" class="kleo-banner-prev"><i class="icon-angle-left"></i></a>' . '<a href="#" class="kleo-banner-next"><i class="icon-angle-right"></i></a>' . '<div class="kleo-banner-features-pager carousel-pager"></div>' . '</div>'; break; case 'aside': if ($icons) { $output .= '<div class="post-format-icon"><i class="icon icon-doc"></i></div>'; } break; case 'link': if ($icons) { $output .= '<div class="post-format-icon"><i class="icon icon-link"></i></div>'; } break; case 'quote': if ($icons) { $output .= '<div class="post-format-icon"><i class="icon icon-quote-right"></i></div>'; } break; case 'image': default: if (kleo_get_post_thumbnail_url() != '') { $output .= '<div class="post-image">'; $img_url = kleo_get_post_thumbnail_url(); $image = aq_resize($img_url, $media_width, $media_height, true, true, true); if (!$image) { $image = $img_url; } $output .= '<a href="' . get_permalink() . '" class="element-wrap">' . '<img src="' . $image . '" alt="' . get_the_title() . '">' . kleo_get_img_overlay() . '</a>'; $output .= '</div><!--end post-image-->'; } elseif ($icons) { $post_icon = $post_format == 'image' ? 'picture' : 'doc'; $output .= '<div class="post-format-icon"><i class="icon icon-' . $post_icon . '"></i></div>'; } break; } return $output; }
} else { $different_kitten = 400 + $i; $post_thumbnail = array(); $post_thumbnail['thumbnail'] = '<img src="http://placekitten.com/g/' . $different_kitten . '/300" />'; $post_thumbnail['p_img_large'][0] = 'http://placekitten.com/g/1024/768'; } $thumbnail = $post_thumbnail['thumbnail']; $p_img_large = $post_thumbnail['p_img_large']; $link_start = '<li class="kleo-masonry-item el-zero-fade"><div class="kleo-gallery-inner">'; $link_end = '</div></li>'; if ($onclick == 'link_image') { $link_start .= '<a class="prettyphoto" href="' . $p_img_large[0] . '"' . $pretty_rel_random . '>' . kleo_get_img_overlay(); $link_end .= '</a>'; } else { if ($onclick == 'custom_link' && isset($custom_links[$i]) && $custom_links[$i] != '') { $link_start .= '<a href="' . $custom_links[$i] . '"' . (!empty($custom_links_target) ? ' target="' . $custom_links_target . '"' : '') . '>' . kleo_get_img_overlay(); $link_end .= '</a>'; } } $gal_images .= $link_start . $thumbnail . $link_end; } } } $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_gallery wpb_content_element' . $el_class . ' clearfix', $this->settings['base']); $output .= "\n\t" . '<div class="' . $css_class . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_gallery_heading')); $gap = $gap != '' ? ' kleo-' . $gap . '-gap' : ''; $output .= '<div class="kleo-gallery-container kleo-gallery-' . $type . $gap . '">' . $slides_wrap_start . $gal_images . $slides_wrap_end . $gal_images_thumb . '</div>'; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment('.wpb_gallery');
$params = array('type' => $type, 'per_page' => $number); if ($perline != '') { $class .= ' ' . $perline . '-thumbs'; } if ($animation != '') { $anim1 = ' animate-when-almost-visible'; $class .= ' kleo-thumbs-animated th-' . $animation; } if ($rounded == 'rounded') { $class .= ' rounded'; } if (function_exists('bp_is_active')) { // begin bp members loop if (bp_has_members($params)) { $output .= '<div class="wpb_wrapper">'; $output .= '<div class="kleo-gallery' . $anim1 . '">'; $output .= '<div class="kleo-thumbs-images ' . $class . '">'; while (bp_members()) { bp_the_member(); $output .= '<a href="' . bp_get_member_permalink() . '" title="' . bp_get_member_name() . '">'; $output .= bp_get_member_avatar(array('type' => 'full', 'width' => '250', 'height' => '250')); $output .= kleo_get_img_overlay(); $output .= '</a>'; } $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; } } else { $output = __("This shortcode must have Buddypress installed to work.", "k-elements"); }
foreach ($bg_video_args as $video_type => $video_src) { $video_type = wp_check_filetype($video_src, wp_get_mime_types()); $k_video .= sprintf($source, $video_type['type'], esc_url($video_src)); } $k_video .= '</video></div>'; echo '<div class="article-media clearfix">'; echo $k_video; echo '</div>'; } elseif (!empty($video)) { echo '<div class="article-media clearfix">'; echo wp_oembed_get($video); echo '</div>'; } elseif (!empty($slides)) { echo '<div class="article-media kleo-banner-slider">' . '<div class="kleo-banner-items" >'; foreach ($slides as $slide) { echo '<article>' . '<a href="' . $slide . '" data-rel="modalPhoto[inner-gallery]">' . '<img src="' . $slide . '" alt="">' . kleo_get_img_overlay() . '</a>' . '</article>'; } echo '</div>' . '<a href="#" class="kleo-banner-prev"><i class="icon-angle-left"></i></a>' . '<a href="#" class="kleo-banner-next"><i class="icon-angle-right"></i></a>' . '<div class="kleo-banner-features-pager carousel-pager"></div>' . '</div>'; } elseif (!empty($audio)) { ?> <div class="article-media clearfix"> <audio id="audio_<?php the_id(); ?> " class="kleo-audio" src="<?php echo $audio; ?> "></audio> </div><!--end article-media-->
case 'link': echo '<div class="inner-content">' . get_the_content() . '</div><!--end inner-content-->'; break; case 'status': echo '<div class="inner-content">' . get_the_content() . '</div><!--end inner-content-->'; break; case 'image': default: if (kleo_get_post_thumbnail_url() != '') { echo '<div class="post-image">'; $img_url = kleo_get_post_thumbnail_url(); $image = aq_resize($img_url, $kleo_config['post_gallery_img_width'], null, true, true, true); if (!$image) { $image = $img_url; } echo '<a href="' . get_permalink() . '" class="element-wrap">' . '<img src="' . $image . '" alt="' . get_the_title() . '">' . kleo_get_img_overlay() . '</a>'; echo '</div><!--end post-image-->'; } break; } ?> <?php if ($kleo_post_format != 'quote' && $kleo_post_format != 'link') { ?> <div class="post-header"> <?php if ($kleo_post_format != 'status') { ?>
?> </a> <?php } elseif ($onclick == 'custom_link' && isset($custom_links[$i]) && $custom_links[$i] != '') { ?> <a href="<?php echo $custom_links[$i]; ?> "<?php echo !empty($custom_links_target) ? ' target="' . $custom_links_target . '"' : ''; ?> > <?php echo $thumbnail; if ($max_items != '1') { echo kleo_get_img_overlay(); } ?> </a> <?php } else { echo '<a class="kleo-gallery-img">' . $thumbnail . '</a>'; } ?> <?php } } } ?> </div>
$link_end .= '</a>'; break; case 'custom_link': if (!empty($custom_links[$i])) { $link_start .= '<a href="' . $custom_links[$i] . '"' . (!empty($custom_links_target) ? ' target="' . $custom_links_target . '"' : '') . '>'; if ($type == 'grid') { $link_start .= kleo_get_img_overlay(); } $link_end .= '</a>'; } break; } if ($type == 'thumbs') { $link_end .= '</div>'; $gal_images .= $link_start . '<img src="' . $p_img_large . '">' . $link_end; $gal_images_thumb .= '<a href="#gall_' . $elem_id . '_' . $i . '">' . $thumbnail . kleo_get_img_overlay() . '</a>'; } elseif ($type == 'grid') { $link_end .= '</div></li>'; $gal_images .= $link_start . $thumbnail . $link_end; } } if ($type == 'thumbs') { $gal_images_thumb .= '</div> <a class="kleo-thumbs-prev" href="#"><i class="icon-angle-left"></i></a> <a class="kleo-thumbs-next" href="#"><i class="icon-angle-right"></i></a> </div>'; } $class_to_filter = 'wpb_gallery wpb_content_element vc_clearfix'; $class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts); $output .= "\n\t" . '<div class="' . $css_class . '">';
*/ $output = ''; extract(shortcode_atts(array('type' => 'newest', 'number' => 12, 'class' => '', 'rounded' => "rounded", 'online' => 'show'), $atts)); $params = array('type' => $type, 'per_page' => $number); if ($rounded == 'rounded') { $rounded = 'rounded'; } if (function_exists('bp_is_active')) { if (bp_has_members($params)) { ob_start(); echo '<div class="wpb_wrapper">'; echo '<div id="members-dir-list" class="members dir-list">'; echo '<ul id="members-list" class="item-list row kleo-isotope masonry ' . $class . '">'; while (bp_members()) { bp_the_member(); echo '<li class="kleo-masonry-item">' . '<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">' . '<div class="item-avatar ' . $rounded . '">' . '<a href="' . bp_get_member_permalink() . '">' . bp_get_member_avatar() . kleo_get_img_overlay() . '</a>'; if ($online == 'show') { echo kleo_get_online_status(bp_get_member_user_id()); } echo '</div>' . '<div class="item"> <div class="item-title">' . '<a href="' . bp_get_member_permalink() . '">' . bp_get_member_name() . '</a> </div> <div class="item-meta"><span class="activity">' . bp_get_member_last_active() . '</span></div>'; if (bp_get_member_latest_update()) { echo '<span class="update"> ' . bp_get_member_latest_update() . '</span>'; } do_action('bp_directory_members_item'); echo '</div>'; echo '<div class="action">'; do_action('bp_directory_members_actions'); echo '</div>';