function alaya_format_media($thumbnail = 'yes', $title = "yes", $thumbnail_size = 'large') { $post_media = vp_metabox('post_format_meta.embed_code'); $post_media = str_replace('&', '&', $post_media); $return_html = ''; if (has_post_format('video') && $post_media != '') { $return_html .= '<div class="thumbnail">' . $post_media . '</div>'; if (alaya_opt('format_icon') == 1) { $return_html .= '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } } elseif (has_post_format('audio') && $post_media != '') { $return_html .= '<div class="thumbnail">' . $post_media . '</div>'; if (alaya_opt('format_icon') == 1) { $return_html .= '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } } elseif (has_post_format('gallery')) { if ($images = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => 50, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image'))) { $slider_id = get_the_ID() . '-' . alaya_random_string(6, false); $return_html .= '<div id="slider-' . esc_html($slider_id) . '" class="flexslider post_slider no_height"><div id="loader-' . esc_html($slider_id) . '" class="alaya_loader"><i class="fa fa-spinner fa-spin"></i></div><ul class="slides">'; foreach ($images as $image) { $attachmenturl = wp_get_attachment_url($image->ID); $attachmentimage = wp_get_attachment_image($image->ID, 'large'); $return_html .= '<li><a href="' . esc_url($attachmenturl) . '" class="lightbox">' . $attachmentimage . '</a></li>'; } $return_html .= '</ul></div>'; if (alaya_opt('format_icon') == 1) { $return_html .= '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } $return_html .= '<script type="text/javascript"> jQuery(document).ready(function($){ $(window).load(function(){ $("#slider-' . esc_html($slider_id) . '").flexslider({ slideshow:true, video: true, keyboard: true, animation: "slide", controlNav:true, smoothHeight:false, multipleKeyboard: true, prevText:"", nextText:"", start: function(slider) { $.flexloader(slider); $("#slider-' . esc_html($slider_id) . '").removeClass("no_height"); }, after: function(slider) { $.flexloader(slider); } }); $("#loader-' . esc_html($slider_id) . '").fadeOut(); }); }); </script>'; } } else { if (has_post_thumbnail() && $thumbnail == 'yes') { $return_html .= '<div class="thumbnail"><a title="' . esc_html(get_the_title()) . '" href="' . esc_url(get_permalink()) . '">' . get_the_post_thumbnail(get_the_ID(), 'large', array('class' => 'featured_image', 'alt' => esc_html(get_the_title()))) . '</a></div>'; } } $return_html = apply_filters('alaya_format_media', $return_html); return $return_html; }
function alaya_post_loop($atts) { static $alaya_custom_loop; if (!isset($alaya_custom_loop)) { $alaya_custom_loop = 1; } else { $alaya_custom_loop++; } $sticky = get_option('sticky_posts'); $atts = shortcode_atts(array('paging' => 'paginate' . $alaya_custom_loop, 'post_type' => 'post', 'posts_per_page' => '10', 'post_status' => 'publish', 'category_name' => '', 'columns' => 3, 'template' => 'standard', 'hide_sticky_posts' => 'no', 'pagination' => 'no', 'orderby' => 'date'), $atts); $paging = $atts['paging']; unset($atts['paging']); $hide_sticky_posts = $atts['hide_sticky_posts']; unset($atts['hide_sticky_posts']); $pagination = $atts['pagination']; unset($atts['pagination']); $template = $atts['template']; unset($atts['template']); $columns = $atts['columns']; unset($atts['columns']); if (isset($_GET[$paging])) { $atts['paged'] = $_GET[$paging]; } else { $atts['paged'] = 1; } if ($hide_sticky_posts == 'yes') { $atts['post__not_in'] = $sticky; $atts['ignore_sticky_posts'] = 1; } else { $atts['ignore_sticky_posts'] = false; } $custom_query = new WP_Query($atts); $pagination_base = add_query_arg($paging, '%#%'); $wrapper = ""; $post_class_ex = ""; if ($template == 'standard' || $template == 'list') { $wrapper = '<div class="standard_blog">'; } elseif ($template == 'masonry') { if ($columns == 3) { $wrapper = '<div class="masonry_blog">'; $post_class_ex = ' three_columns'; } elseif ($columns == 2) { $wrapper = '<div class="masonry_blog_2">'; $post_class_ex = ' two_columns'; } } if ($custom_query->have_posts()) { $html = $wrapper; while ($custom_query->have_posts()) { $custom_query->the_post(); $thumbnail = ''; $excerpt = get_the_excerpt(); $more = '<a class="morelink" href="' . esc_url(get_permalink()) . '">' . __('Continue to read', 'alaya') . ' <i class="fa fa-long-arrow-right"></i></a>'; $post_icon = '<a class="overlay" href="' . esc_url(get_permalink()) . '">' . alaya_format_icon() . '</a>'; if (has_post_format() == 0) { $post_icon = ''; } if (has_post_thumbnail()) { $thumbnail = '<div class="thumbnail">' . $post_icon . ' <a href="' . esc_url(get_permalink()) . '">' . get_the_post_thumbnail(get_the_ID(), 'large') . '</a></div>'; } else { $thumbnail = '<div class="post_format_icon">' . alaya_format_icon() . '</div>'; } if ($template == 'list') { $post_class_ex = ' thumbnail_s'; $excerpt = alaya_truncate(get_the_excerpt(), 150); } $html .= sprintf('<article class="post' . esc_attr($post_class_ex) . '"> %4$s <div class="entry-body"> <span class="category">%5$s</span> <h4 class="entry-title"><a href="%1$s" title="%2$s">%2$s</a></h4> <span class="title-divider"></span> <div class="entry-content">%3$s</div> <footer class="entry-tools"> <span>%7$s</span> %6$s </footer> </div> <div class="clear"></div> </article>', get_permalink(), get_the_title(), $excerpt, $thumbnail, get_the_category_list(', '), $more, get_the_time(get_option('date_format'))); } $html .= '</div>'; if ($pagination == 'yes') { $html .= '<div class="alaya_pagenavi">'; $html .= paginate_links(array('type' => '', 'base' => $pagination_base, 'format' => '?' . $paging . '=%#%', 'current' => max(1, $custom_query->get('paged')), 'total' => $custom_query->max_num_pages)); $html .= '</div>'; } } return $html; }