/** * Render the parent shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_id' => '', 'cat_slug' => '', 'columns' => 3, 'excerpt' => 'no', 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'layout' => 'default', 'meta' => 'yes', 'number_posts' => 4, 'strip_html' => 'yes', 'title' => 'yes', 'thumbnail' => 'yes', 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => ''), $args); $defaults['strip_html'] == 'yes' ? $defaults['strip_html'] = true : ($defaults['strip_html'] = false); if ($defaults['number_posts']) { $defaults['posts_per_page'] = $defaults['number_posts']; } if ($defaults['excerpt_length'] || $defaults['excerpt_length'] === '0') { $defaults['excerpt_words'] = $defaults['excerpt_length']; } //check for cats to exclude; needs to be checked via exclude_cats param and '-' prefixed cats on cats param //exclution via exclude_cats param $cats_to_exclude = explode(',', $defaults['exclude_cats']); if ($cats_to_exclude) { foreach ($cats_to_exclude as $cat_to_exclude) { $idObj = get_category_by_slug($cat_to_exclude); if ($idObj) { $cats_id_to_exclude[] = $idObj->term_id; } } if (isset($cats_id_to_exclude) && $cats_id_to_exclude) { $defaults['category__not_in'] = $cats_id_to_exclude; } } //setting up cats to be used and exclution using '-' prefix on cats param; transform slugs to ids $cat_ids = ''; $categories = explode(',', $defaults['cat_slug']); if (isset($categories) && $categories) { foreach ($categories as $category) { if ($category) { if (strpos($category, '-') === 0) { $cat_ids .= '-' . get_category_by_slug($category)->cat_ID . ','; } else { $cat_ids .= get_category_by_slug($category)->cat_ID . ','; } } } } $defaults['cat'] = substr($cat_ids, 0, -1); $defaults['cat'] .= $defaults['cat_id']; $items = ''; $args = array('posts_per_page' => $defaults['number_posts'], 'ignore_sticky_posts' => 1, 'has_password' => false); if ($defaults['cat']) { $args['cat'] = $defaults['cat']; } if (isset($defaults['category__not_in']) && is_array($defaults['category__not_in'])) { $args['category__not_in'] = $defaults['category__not_in']; } extract($defaults); self::$args = $defaults; $recent_posts = new WP_Query($args); $count = 1; while ($recent_posts->have_posts()) { $recent_posts->the_post(); $attachment = $date_box = $slideshow = $slides = $content = ''; if ($layout == 'date-on-side') { switch (get_post_format()) { case 'gallery': $format_class = 'images'; break; case 'link': $format_class = 'link'; break; case 'image': $format_class = 'image'; break; case 'quote': $format_class = 'quotes-left'; break; case 'video': $format_class = 'film'; break; case 'audio': $format_class = 'headphones'; break; case 'chat': $format_class = 'bubbles'; break; default: $format_class = 'pen'; break; } $date_box = sprintf('<div %s><div %s><span %s>%s</span><span %s>%s</span></div><div %s><i %s></i></div></div>', FusionCore_Plugin::attributes('date-and-formats'), FusionCore_Plugin::attributes('date-box'), FusionCore_Plugin::attributes('date'), get_the_time('j'), FusionCore_Plugin::attributes('month-year'), get_the_time('m, Y'), FusionCore_Plugin::attributes('format-box'), FusionCore_Plugin::attributes('icon-' . $format_class)); } if ($thumbnail == 'yes' && $layout != 'date-on-side') { if ($layout == 'default') { $image_size = 'recent-posts'; } elseif ($layout == 'thumbnails-on-side') { $image_size = 'portfolio-two'; } if ($smof_data['legacy_posts_slideshow']) { $args = array('exclude' => get_post_thumbnail_id(), 'numberposts' => $smof_data['posts_slideshow_number'] - 1, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => null, 'post_type' => 'attachment'); $attachments = get_posts($args); if ($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) { if (get_post_meta(get_the_ID(), 'pyre_video', true)) { $slides .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true)); } if (has_post_thumbnail()) { $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => get_the_title()))); } if ($smof_data['posts_slideshow']) { foreach ($attachments as $attachment) { $attachment_image = wp_get_attachment_image_src($attachment->ID, $image_size); $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); $attachment_data = wp_get_attachment_metadata($attachment->ID); $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title))); } } $slideshow = sprintf('<div %s><ul %s>%s</ul></div>', FusionCore_Plugin::attributes('recentposts-shortcode-slideshow'), FusionCore_Plugin::attributes('slides'), $slides); } } else { if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) { if (get_post_meta(get_the_ID(), 'pyre_video', true)) { $slides .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true)); } if (has_post_thumbnail()) { $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $attachment = get_post(get_post_thumbnail_id()); $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title))); } if ($smof_data['posts_slideshow']) { $i = 2; while ($i <= $smof_data['posts_slideshow_number']) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_new_id) { $attachment_image = wp_get_attachment_image_src($attachment_new_id, $image_size); $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); $attachment_data = wp_get_attachment_metadata($attachment_new_id); $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => ''))); } $i++; } } $slideshow = sprintf('<div %s><ul %s>%s</ul></div>', FusionCore_Plugin::attributes('recentposts-shortcode-slideshow'), FusionCore_Plugin::attributes('slides'), $slides); } } } if ($title == 'yes') { $content .= sprintf('<h4><a href="%s">%s</a></h4>', get_permalink(get_the_ID()), get_the_title()); } if ($meta == 'yes') { $comments = ''; if (get_comments_number(get_the_ID()) >= 1) { $comments = sprintf('<span %s>|</span><a href="%s">%s %s</a></span>', FusionCore_Plugin::attributes('meta-separator'), get_permalink(get_the_ID()), get_comments_number(get_the_ID()), __('Comments', 'Avada')); } $content .= sprintf('<p %s><span><time %s>%s</time></span>%s</p>', FusionCore_Plugin::attributes('meta'), FusionCore_Plugin::attributes('date'), get_the_time($smof_data['date_format'], get_the_ID()), $comments); } if ($excerpt == 'yes') { $content .= tf_content($excerpt_words, $strip_html); } if ($count == self::$args['columns']) { $count = 0; $items .= sprintf('<article %s>%s%s<div %s>%s</div></article><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content); } else { $items .= sprintf('<article %s>%s%s<div %s>%s</div></article>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content); } $count++; } $html = sprintf('<div %s><section %s><div %s>%s</div></section></div>', FusionCore_Plugin::attributes('recentposts-shortcode'), FusionCore_Plugin::attributes('recentposts-shortcode-section'), FusionCore_Plugin::attributes('row holder'), $items); wp_reset_query(); return $html; }
function avada_number_of_featured_images() { global $post; $number_of_images = 0; if (has_post_thumbnail() && 'yes' != get_post_meta($post->ID, 'pyre_show_first_featured_image', true)) { $number_of_images++; } for ($i = 2; $i <= Avada()->settings->get('posts_slideshow_number'); $i++) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, $post->post_type); if ($attachment_new_id) { $number_of_images++; } } return $number_of_images; }
?> "><img src="<?php echo $attachment_image[0]; ?> " alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?> " /></a> </li> <?php } ?> <?php $i = 2; while ($i <= $smof_data['posts_slideshow_number']) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'page'); if ($attachment_new_id) { ?> <?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?> <li> <a href="<?php echo $full_image[0]; ?>
?> " alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?> " /> <?php } ?> </li> <?php } ?> <?php $i = 2; while ($i <= Avada()->settings->get('posts_slideshow_number')) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'avada_portfolio'); if ($attachment_new_id) { ?> <?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?> <li> <?php if (!Avada()->settings->get('status_lightbox') && !Avada()->settings->get('status_lightbox_single')) { ?>
function venedor_shortcode_posts($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'layout' => 'grid', 'cat' => '', 'post_in' => '', 'count' => 10, 'class' => ''), $atts)); ob_start(); ?> <div class="<?php echo $class; ?> "> <?php $args = array('posts_per_page' => $count, 'post_type' => 'post', 'post_status' => 'publish', 'suppress_filters' => true); if ($cat) { $args['cat'] = $cat; } if ($post_in) { $args['post__in'] = explode(',', $post_in); } $posts = new WP_Query($args); global $venedor_settings; ?> <?php if ($posts->have_posts()) { ?> <?php global $venedor_settings; $post_layout = $layout; $blog_layout = venedor_meta_layout(); $blog_infinite = false; $wrap_class = ''; $post_class = ''; switch ($post_layout) { case 'large-alt': $post_class = "large-alt"; break; case 'medium-alt': $post_class = "medium-alt"; break; case 'small-alt': $post_class = "small-alt"; break; case 'grid': $post_class = "grid-post"; $wrap_class = 'grid-layout row'; break; case 'timeline': $post_class = "timeline-post"; $wrap_class = 'timeline-layout'; break; default: $post_layout = "medium-alt"; $post_class = "medium-alt"; break; } ?> <div class="blog-page-content <?php if ($blog_infinite) { echo 'infinite-content'; } ?> "> <?php if ($title) { ?> <h2 class="page-title"><?php echo $title; ?> </h2><?php } ?> <?php if ($post_layout == 'timeline') { ?> <div class="timeline-icon"><span class="fa fa-comments-o"></span></div> <?php } ?> <div class="<?php if ($blog_infinite) { echo 'posts-infinite'; } ?> posts-wrap <?php echo $wrap_class; ?> clearfix"> <?php if ($post_layout == 'timeline') { ?> <div class="timeline-content-gap"></div> <?php } ?> <?php $post_count = 1; $prev_post_timestamp = null; $prev_post_month = null; $first_timeline_loop = false; while ($posts->have_posts()) { $posts->the_post(); global $post; global $post; $post_timestamp = strtotime($post->post_date); $post_month = date('n', $post_timestamp); $post_year = get_the_date('o'); $current_date = get_the_date('o-n'); $slideshow_type = get_post_meta($post->ID, 'slideshow_type', true); $classes = ' post-item'; global $previousday; unset($previousday); ?> <?php if ($post_layout == 'timeline' && $prev_post_month != $post_month) { $post_count = 1; ?> <div class="timeline-date"><h3 class="timeline-title"><?php echo get_the_date('F Y'); ?> </h3></div> <?php } ?> <?php if ($post_layout == 'grid') { ?> <?php if ($blog_layout == 'left-sidebar' || $blog_layout == 'right-sidebar') { $classes .= ' col-md-6 col-sm-12'; } else { $classes .= ' col-md-4 col-sm-6 col-xs-12'; } ?> <?php } ?> <?php if ($post_layout == 'timeline') { ?> <?php if ($blog_layout == 'left-sidebar' || $blog_layout == 'right-sidebar') { $classes .= ' col-md-6 col-sm-12' . ($post_count % 2 == 1 ? ' align-left' : ' align-right'); } else { $classes .= ' col-sm-6 col-xs-12' . ($post_count % 2 == 1 ? ' align-left' : ' align-right'); } ?> <?php } ?> <div id="post-<?php the_ID(); ?> " <?php post_class($post_class . $classes . ' clearfix'); ?> ><div class="inner"> <?php // Post Slideshow ?> <?php if ($post_layout == 'large-alt' || $post_layout == 'grid' || $post_layout == 'timeline') { ?> <?php $slideshow_type = get_post_meta($post->ID, 'slideshow_type', true); if ($slideshow_type != 'none') { ?> <?php if ($slideshow_type == 'images' && has_post_thumbnail()) { ?> <div class="post-slideshow-wrap <?php echo $layout; ?> "> <div id="post-slideshow-<?php echo $post->ID; ?> " class="post-slideshow owl-carousel"> <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?> <div class="post-image"> <img src="<?php echo str_replace(array('http:', 'https:'), '', $attachment_image[0]); ?> " alt="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?> " data-image="<?php echo $venedor_settings['post-zoom'] ? $full_image[0] : ''; ?> " /> </div> <?php $i = 2; while ($i <= $venedor_settings['post-slideshow-count']) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_new_id) { ?> <?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?> <div class="post-image"> <img src="<?php echo str_replace(array('http:', 'https:'), '', $attachment_image[0]); ?> " alt="<?php echo get_post_field('post_content', $attachment_new_id); ?> " data-image="<?php echo $venedor_settings['post-zoom'] ? $full_image[0] : ''; ?> " /> </div> <?php } $i++; } ?> </div> <?php if ($venedor_settings['post-zoom']) { ?> <div class="figcaption"> <span class="btn btn-inverse zoom-button"><span class="fa fa-search"></span></span> <a class="btn btn-inverse link-button" href="<?php the_permalink(); ?> "><span class="fa fa-link fa-rotate-90"></span></a> </div> <?php } ?> </div> <?php } ?> <?php if ($slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true)) { ?> <div class="post-slideshow-wrap <?php echo $layout; ?> "> <div id="post-slideshow-<?php echo $post->ID; ?> " class="post-slideshow"> <div class="fit-video"> <?php echo get_post_meta($post->ID, 'video_code', true); ?> </div> </div> </div> <?php } } ?> <?php } ?> <div class="post-content-wrap"> <?php if ($post_layout != 'timeline' && $post_layout != 'grid') { ?> <div class="post-info <?php echo $venedor_settings['post-layout']; if (!($slideshow_type == 'images' && has_post_thumbnail()) || $slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true)) { echo ' none-slideshow'; } ?> "> <a href="<?php the_permalink(); ?> "> <div class="post-date"> <span class="post-date-day"><?php echo get_the_time('d', get_the_ID()); ?> </span> <span class="post-date-month"><?php echo get_the_time('M', get_the_ID()); ?> </span> </div> <?php $post_format = get_post_format(); if ($venedor_settings['post-format'] && $post_format) { if ($post_format == 'link') { $ext_link = get_post_meta($post->ID, 'external_url', true); if ($ext_link) { ?> </a><a href="<?php echo $ext_link; ?> "> <?php } else { $post_format = ''; } } if ($post_format) { ?> <div class="post-format <?php echo $post_format; ?> "> <span class="fa fa-<?php switch ($post_format) { case 'aside': echo 'file-text'; break; case 'gallery': echo 'camera-retro'; break; case 'link': echo 'link'; break; case 'image': echo 'picture-o'; break; case 'quote': echo 'quote-left'; break; case 'video': echo 'film'; break; case 'audio': echo 'music'; break; case 'chat': echo 'comments'; break; } ?> "></span> </div> <?php } ?> <?php } ?> </a> </div> <?php } ?> <div class="post-content <?php echo $post_layout; if (!($slideshow_type == 'images' && has_post_thumbnail()) || $slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true)) { echo ' none-slideshow'; } ?> "> <?php // Post Slideshow ?> <?php if ($post_layout == 'medium-alt' || $post_layout == 'small-alt') { ?> <?php $slideshow_type = get_post_meta($post->ID, 'slideshow_type', true); if ($slideshow_type != 'none') { ?> <?php if ($slideshow_type == 'images' && has_post_thumbnail()) { ?> <div class="post-slideshow-wrap <?php echo $layout; ?> "> <div id="post-slideshow-<?php echo $post->ID; ?> " class="post-slideshow owl-carousel"> <?php $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?> <div class="post-image"> <img src="<?php echo str_replace(array('http:', 'https:'), '', $attachment_image[0]); ?> " alt="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?> " data-image="<?php echo $venedor_settings['post-zoom'] ? $full_image[0] : ''; ?> " /> </div> <?php $i = 2; while ($i <= $venedor_settings['post-slideshow-count']) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_new_id) { ?> <?php $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment_new_id); ?> <div class="post-image"> <img src="<?php echo str_replace(array('http:', 'https:'), '', $attachment_image[0]); ?> " alt="<?php echo get_post_field('post_content', $attachment_new_id); ?> " data-image="<?php echo $venedor_settings['post-zoom'] ? $full_image[0] : ''; ?> " /> </div> <?php } $i++; } ?> </div> <?php if ($venedor_settings['post-zoom']) { ?> <div class="figcaption"> <span class="btn btn-inverse zoom-button"><span class="fa fa-search"></span></span> <a class="btn btn-inverse link-button" href="<?php the_permalink(); ?> "><span class="fa fa-link fa-rotate-90"></span></a> </div> <?php } ?> </div> <?php } ?> <?php if ($slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true)) { ?> <div class="post-slideshow-wrap <?php echo $layout; ?> "> <div id="post-slideshow-<?php echo $post->ID; ?> " class="post-slideshow"> <div class="fit-video"> <?php echo get_post_meta($post->ID, 'video_code', true); ?> </div> </div> </div> <?php } } ?> <?php } ?> <?php if ($post_layout == 'small-alt' && ($slideshow_type == 'images' && has_post_thumbnail() || $slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true))) { ?> <div class="post-content-small"> <?php } ?> <?php if ($post_layout == 'timeline') { ?> <div class="timeline-circle"></div><div class="timeline-arrow"></div> <?php } ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-meta"> <?php if ($post_layout == 'timeline' || $post_layout == 'grid') { ?> <div class="meta-item meta-date"><div class="meta-inner"><span class="fa fa-calendar"></span> <?php the_date(); ?> <?php the_time(); ?> </div></div> <?php } ?> <div class="meta-item meta-author"><div class="meta-inner"><span class="fa fa-user"></span> <?php echo __('By', 'venedor'); ?> <?php the_author_posts_link(); ?> </div></div> <div class="meta-item meta-comments"><div class="meta-inner"><span class="fa fa-comments"></span> <?php comments_popup_link(__('0 Comments', 'venedor'), __('1 Comment', 'venedor'), '% ' . __('Comments', 'venedor')); ?> </div></div> <div class="meta-item meta-cats"><div class="meta-inner"><span class="fa fa-folder-open"></span> <?php the_category(', '); ?> </div></div> </div> <div class="entry-content"> <?php if ($venedor_settings['blog-excerpt']) { echo venedor_excerpt($venedor_settings['blog-excerpt-length']); } else { the_content(''); } ?> <?php if ($post_layout == 'small-alt' && ($slideshow_type == 'images' && has_post_thumbnail() || $slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true))) { ?> </div> <?php } ?> </div> </div> </div> </div></div> <?php $prev_post_timestamp = $post_timestamp; $prev_post_month = $post_month; $post_count++; } ?> </div> </div> <?php } ?> </div> <?php wp_reset_postdata(); $str = ob_get_contents(); ob_end_clean(); return $str; }
function shortcode_recent_posts($atts, $content = null) { global $data; wp_enqueue_script( 'jquery.flexslider' ); extract(shortcode_atts(array( 'layout' => 'default', 'columns' => 1, 'number_posts' => 4, 'exclude_cats' => '', 'excerpt_words' => '15', 'excerpt' => 'no', 'strip_html' => 'yes', 'cat_id' => '', 'cat_slug' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => '' ), $atts)); $direction_suffix = ''; $animation_class = ''; $animation_attribues = ''; if($animation_type) { $animation_class = ' animated'; if($animation_type != 'flash' && $animation_type != 'shake') { $direction_suffix = 'In'.ucfirst($animation_direction); $animation_type .= $direction_suffix; } $animation_attribues = ' animation_type="'.$animation_type.'"'; if($animation_speed) { $animation_attribues .= ' animation_duration="'.$animation_speed.'"'; } } if(!isset($atts['columns'])) { $atts['columns'] = 3; } if(!isset($atts['excerpt_words'])) { $atts['excerpt_words'] = 15; } if(!isset($atts['number_posts'])) { $atts['number_posts'] = 3; } if(!isset($atts['strip_html'])) { $atts['strip_html'] = 'true'; } if($atts['strip_html'] == 'yes') { $atts['strip_html'] = 'true'; } elseif($atts['strip_html'] == 'no') { $atts['strip_html'] = 'false'; } if(!empty($atts['cat_id']) && $atts['cat_id']){ $query_atts['category_name'] = $atts['cat_id']; } elseif(!empty($atts['cat_slug']) && $atts['cat_slug']){ $query_atts['category_name'] = $atts['cat_slug']; } $query_atts['posts_per_page'] = $atts['number_posts']; if($exclude_cats) { $cats_to_exclude = explode(',', $exclude_cats); foreach($cats_to_exclude as $cat_to_exclude) { $idObj = get_category_by_slug($cat_to_exclude); if($idObj) { $cats_id_to_exclude[] = $idObj->term_id; } } if($cats_id_to_exclude) { $query_atts['category__not_in'] = $cats_id_to_exclude; } } wp_reset_query(); $recent_posts = new WP_Query($query_atts); if($layout == 'default'): $attachment = ''; $html = '<div class="avada-container">'; $html .= '<section class="columns columns-'.$atts['columns'].'" style="width:100%">'; $html .= '<div class="holder">'; $count = 1; while($recent_posts->have_posts()): $recent_posts->the_post(); $html .= '<article class="col">'; if($atts['thumbnail'] == "yes"): if($data['legacy_posts_slideshow']): $args = array( 'post_type' => 'attachment', 'numberposts' => $data['posts_slideshow_number']-1, 'post_status' => null, 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'orderby' => 'menu_order', 'order' => 'ASC', 'exclude' => get_post_thumbnail_id() ); $attachments = get_posts($args); if($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>'; $html .= '<ul class="slides">'; if(get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<li><div class="full-video">'; $html .= get_post_meta(get_the_ID(), 'pyre_video', true); $html .= '</div></li>'; endif; if(has_post_thumbnail()): $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-posts'); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a> </li>'; endif; if($data['posts_slideshow']): foreach($attachments as $attachment): $attachment_image = wp_get_attachment_image_src($attachment->ID, 'recent-posts'); $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); $attachment_data = wp_get_attachment_metadata($attachment->ID); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'. $attachment_image[0].'" alt="'.$attachment->post_title.'" /></a> </li>'; endforeach; endif; $html .= '</ul> </div>'; endif; else: if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>'; $html .= '<ul class="slides">'; if(get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<li><div class="full-video">'; $html .= get_post_meta(get_the_ID(), 'pyre_video', true); $html .= '</div></li>'; endif; if(has_post_thumbnail()): $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-posts'); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a> </li>'; endif; if($data['posts_slideshow']): $i = 2; while($i <= $data['posts_slideshow_number']): $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'post'); if($attachment_new_id): $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'recent-posts'); $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); $attachment_data = wp_get_attachment_metadata($attachment_new_id); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'. $attachment_image[0].'" alt="" /></a> </li>'; endif; $i++; endwhile; endif; $html .= '</ul> </div>'; endif; endif; endif; if($atts['title'] == "yes"): $html .= '<h4><a href="'.get_permalink(get_the_ID()).'">'.get_the_title().'</a></h4>'; endif; if($atts['meta'] == "yes"): $html .= '<ul class="meta">'; $html .= '<li><em class="date">'.get_the_time($data['date_format'], get_the_ID()).'</em></li>'; if(get_comments_number(get_the_ID()) >= 1): $html .= '<li><a href="'.get_permalink(get_the_ID()).'">'.get_comments_number(get_the_ID()).' '.__('Comments', 'Avada').'</a></li>'; endif; $html .= '</ul>'; endif; if($atts['excerpt'] == "yes"): $stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] ); $html .= '<p>'.$stripped_content.'</p>'; endif; $html .= '</article>'; $count++; endwhile; $html .= '</div>'; $html .= '</section>'; $html .= '</div>'; elseif($layout == 'thumbnails-on-side'): $attachment = ''; $html = '<div class="avada-container layout-'.$layout.' layout-columns-'.$columns.'">'; $html .= '<section class="columns columns-'.$atts['columns'].'" style="width:100%">'; $html .= '<div class="holder">'; $count = 1; while($recent_posts->have_posts()): $recent_posts->the_post(); $html .= '<article class="col clearfix">'; if($atts['thumbnail'] == "yes"): if($data['legacy_posts_slideshow']): $args = array( 'post_type' => 'attachment', 'numberposts' => $data['posts_slideshow_number']-1, 'post_status' => null, 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'orderby' => 'menu_order', 'order' => 'ASC', 'exclude' => get_post_thumbnail_id() ); $attachments = get_posts($args); if($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>'; $html .= '<ul class="slides">'; if(get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<li><div class="full-video">'; $html .= get_post_meta(get_the_ID(), 'pyre_video', true); $html .= '</div></li>'; endif; if(has_post_thumbnail()): $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-two'); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a> </li>'; endif; if($data['posts_slideshow']): foreach($attachments as $attachment): $attachment_image = wp_get_attachment_image_src($attachment->ID, 'portfolio-two'); $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); $attachment_data = wp_get_attachment_metadata($attachment->ID); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'. $attachment_image[0].'" alt="'.$attachment->post_title.'" /></a> </li>'; endforeach; endif; $html .= '</ul> </div>'; endif; else: if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>';; $html .= '<ul class="slides">'; if(get_post_meta(get_the_ID(), 'pyre_video', true)): $html .= '<li><div class="full-video">'; $html .= get_post_meta(get_the_ID(), 'pyre_video', true); $html .= '</div></li>'; endif; if(has_post_thumbnail()): $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-two'); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a> </li>'; endif; if($data['posts_slideshow']): $i = 2; while($i <= $data['posts_slideshow_number']): $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'post'); if($attachment_new_id): $attachment_image = wp_get_attachment_image_src($attachment_new_id, 'portfolio-two'); $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); $attachment_data = wp_get_attachment_metadata($attachment_new_id); $html .= '<li> <a href="'.get_permalink(get_the_ID()).'" rel=""><img src="'. $attachment_image[0].'" alt="" /></a> </li>'; endif; $i++; endwhile; endif; $html .= '</ul> </div>'; endif; endif; endif; $html .= '<div class="recent-posts-content">'; if($atts['title'] == "yes"): $html .= '<h4><a href="'.get_permalink(get_the_ID()).'">'.get_the_title().'</a></h4>'; endif; if($atts['meta'] == "yes"): $html .= '<ul class="meta">'; $html .= '<li>'.get_the_time($data['date_format'], get_the_ID()).'</li>'; if(get_comments_number(get_the_ID()) >= 1): $html .= '<li><a href="'.get_permalink(get_the_ID()).'">'.get_comments_number(get_the_ID()).' '.__('Comments', 'Avada').'</a></li>'; endif; $html .= '</ul>'; endif; if($atts['excerpt'] == "yes"): $stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] ); $html .= $stripped_content; endif; $html .= '</div>'; $html .= '</article>'; $count++; endwhile; $html .= '</div>'; $html .= '</section>'; $html .= '</div>'; elseif($layout == 'date-on-side'): $attachment = ''; $html = '<div class="avada-container layout-'.$layout.' layout-columns-'.$columns.'">'; $html .= '<section class="columns columns-'.$atts['columns'].'" style="width:100%">'; $html .= '<div class="holder">'; $count = 1; while($recent_posts->have_posts()): $recent_posts->the_post(); $html .= '<article class="col clearfix">'; $html .= '<div class="date-and-formats"> <div class="date-box"> <span class="date">'.get_the_time('j').'</span> <span class="month-year">'.get_the_time('m, Y').'</span> </div>'; $html .= '<div class="format-box">'; switch(get_post_format()) { case 'gallery': $format_class = 'camera-retro'; break; case 'link': $format_class = 'link'; break; case 'image': $format_class = 'picture'; break; case 'quote': $format_class = 'quote-left'; break; case 'video': $format_class = 'film'; break; case 'audio': $format_class = 'headphones'; break; case 'chat': $format_class = 'comments-alt'; break; default: $format_class = 'book'; break; } $html .= '<i class="icon-'.$format_class.'"></i> </div> </div>'; $html .= '<div class="recent-posts-content">'; if($atts['title'] == "yes"): $html .= '<h4><a href="'.get_permalink(get_the_ID()).'">'.get_the_title().'</a></h4>'; endif; if($atts['meta'] == "yes"): $html .= '<ul class="meta">'; $html .= '<li>'.get_the_time($data['date_format'], get_the_ID()).'</li>'; if(get_comments_number(get_the_ID()) >= 1): $html .= '<li><a href="'.get_permalink(get_the_ID()).'">'.get_comments_number(get_the_ID()).' '.__('Comments', 'Avada').'</a></li>'; endif; $html .= '</ul>'; endif; if($atts['excerpt'] == "yes"): $stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] ); $html .= $stripped_content; endif; $html .= '</div>'; $html .= '</article>'; $count++; endwhile; $html .= '</div>'; $html .= '</section>'; $html .= '</div>'; endif; wp_reset_query(); return $html; }
function get_post_thumbnails($post_id, $count = '') { global $smof_data; $attachment_ids = array(); if (get_post_thumbnail_id($post_id)) { $attachment_ids[] = get_post_thumbnail_id($post_id); } $i = 2; while ($i <= $smof_data['posts_slideshow_number']) { if (kd_mfi_get_featured_image_id('featured-image-' . $i, 'post')) { $attachment_ids[] = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); } $i++; } if (isset($count) && $count >= 1) { $attachment_ids = array_slice($attachment_ids, 0, $count); } return $attachment_ids; }
<li class="video-container"> <?php echo do_shortcode('[vimeo id="' . get_post_meta($post->ID, 'pyre_vimeo', true) . '"]'); ?> </li> <?php } ?> <?php $extra = ''; $i = 2; while ($i <= $data['featured_images_count']) { $attachment = new StdClass(); $attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_id) { ?> <?php $attachment_image = wp_get_attachment_image_src($attachment_id, $thumbnail); ?> <?php $full_image = wp_get_attachment_image_src($attachment_id, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment_id); ?> <?php $extra .= '<li><a href="' . get_permalink() . '"><img src="' . $attachment_image[0] . '" alt="' . $attachment_data['image_meta']['title'] . '" ></a></li>'; ?>
function avada_number_of_featured_images() { global $smof_data, $post; $number_of_images = 0; if (has_post_thumbnail() && get_post_meta($post->ID, 'pyre_show_first_featured_image', true) != 'yes') { $number_of_images++; } for ($i = 2; $i <= $smof_data['posts_slideshow_number']; $i++) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, $post->post_type); if ($attachment_new_id) { $number_of_images++; } } return $number_of_images; }
<div class="main_image_wrapper"> <?php if (isset($img[0])) { ?> <div class="image_wrapper carousel"> <ul class="animals-open-carousel"> <li><img src="<?php echo $img[0]; ?> "<?php echo $img_style; ?> class="open_entry_image" alt="" /></li> <?php while ($i <= 5) { $attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'animals_places'); if ($attachment_id) { $featured_img = wp_get_attachment_image_src($attachment_id, 'large-image'); echo '<li><img src="' . $featured_img[0] . '" class="open_entry_image" alt="" /></li>'; $attachments_count = ++$attachments_count; } $i++; } ?> </ul> <?php if ($attachments_count > 1) { ?> <div class="animals-open-left"></div> <div class="animals-open-right"></div> <?php
?> <li> <a href="<?php echo $full_image[0]; ?> " rel="prettyPhoto['gallery']"><?php the_post_thumbnail('full'); ?> </a> </li> <?php } $i = 2; while ($i <= $data['featured_images_count']) { $attachment = new StdClass(); $attachment->ID = kd_mfi_get_featured_image_id('featured-image-' . $i, 'creativo_portfolio'); if ($attachment->ID) { ?> <?php $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); ?> <?php $attachment_data = wp_get_attachment_metadata($attachment->ID); ?> <li> <a href="<?php echo $full_image[0]; ?> " rel="prettyPhoto['gallery']"><img src="<?php echo $full_image[0];
function shortcode_recent_posts($atts, $content = null) { extract(shortcode_atts(array('grid_display' => 'grid', 'posts' => '4', 'columns' => '4', 'thumbnail' => 'yes', 'show_title' => 'yes', 'show_date' => 'yes', 'include' => '', 'show_excerpt' => 'yes', 'excerpt_length' => '15', 'category' => '', 'taxonomies' => '', 'style' => 'default', 'post_title_color' => '#444444', 'post_title_font_size' => '15px', 'font_weight' => '600', 'post_title_uppercase' => 'no', 'post_date_color' => '#b5b8bf', 'post_desc_font_size' => '13px', 'post_desc_text_color' => '#656565', 'post_desc_bg_color' => '#ffffff', 'offset' => '', 'el_class' => ''), $atts)); global $data, $post_counter; $current_link = $_SERVER["REQUEST_URI"]; // add an unique class to each button if (strpos($current_link, 'vc_editable=true')) { $post_counter = rand(); } else { if (!isset($post_counter)) { $post_counter = 1; } else { $post_counter++; } } $styles_render = ''; if ($style == 'custom') { $styles_render = '<style type="text/css" scoped="scoped">'; $styles_render .= '.post_scope_' . $post_counter . ' .blogpost .description {'; $styles_render .= 'background-color: ' . $post_desc_bg_color . ';'; $styles_render .= 'color:' . $post_desc_text_color . ';'; $styles_render .= 'font-size:' . $post_desc_font_size . '; line-height: 1.6;'; $styles_render .= '}'; $styles_render .= '.post_scope_' . $post_counter . ' .blogpost h3 a {'; $styles_render .= 'color:' . $post_title_color . ';'; $styles_render .= '}'; $styles_render .= '.post_scope_' . $post_counter . ' .blogpost h3 {'; $styles_render .= 'font-size:' . $post_title_font_size . ';'; $styles_render .= 'font-weight:' . $font_weight . ';'; if ($post_title_uppercase == 'yes') { $styles_render .= 'text-transform:uppercase;'; } $styles_render .= '}'; $styles_render .= '.post_scope_' . $post_counter . ' .blogpost .date {'; $styles_render .= 'color:' . $post_date_color . ';'; $styles_render .= '}'; $styles_render .= '</style>'; } $post_extra_css_class = $style == 'custom' ? 'post_scope_' . $post_counter : ''; $attachment = ''; $html = ''; if ($show_excerpt != "yes" || $thumbnail != "yes") { $height = 'style="height:auto"'; } $thumb = 'recent-posts'; if ($columns == 3) { $thumb = 'recent-posts-col-3'; } if ($columns == 2) { $thumb = 'recent-posts-col-2'; } $html .= $styles_render; $html .= '<div class="recent_posts_container ' . $post_extra_css_class . ' clearfix">'; if ($grid_display == 'masonry') { $html .= '<div class="grid-masonry js-masonry clearfix">'; $html .= '<div class="gutter-sizer"></div>'; } else { $html .= '<div class="is_grid clearfix">'; } $query = array('posts_per_page' => $posts, 'post_type' => 'post'); if ($offset) { $query['offset'] = $offset; } if ($include) { $query['post__in'] = explode(',', $include); } if ($category) { $query['cat'] = $category; } if ($taxonomies) { $query['cat'] = $taxonomies; } $recent_posts = new WP_Query($query); $count = 1; $i = 3; while ($recent_posts->have_posts()) { $recent_posts->the_post(); $html .= '<div class="blogpost grid_posts columns-' . $columns . '">'; if ($thumbnail == "yes") { $post = new StdClass(); $post->ID = get_the_ID(); if (has_post_thumbnail() || get_post_meta($post->ID, 'pyre_youtube', true) || get_post_meta($post->ID, 'pyre_vimeo', true)) { $html .= '<div class="flexslider mini posts-grid">'; $html .= '<ul class="slides">'; if (get_post_meta($post->ID, 'pyre_youtube', true)) { $html .= '<li>'; $html .= '<div class="video-container" style="height:12px;"><iframe title="YouTube video player" width="218px" height="134px" src="http://www.youtube.com/embed/' . get_post_meta($post->ID, 'pyre_youtube', true) . '" frameborder="0" allowfullscreen></iframe></div>'; $html .= '</li>'; } if (get_post_meta($post->ID, 'pyre_vimeo', true)) { $html .= '<li>'; $html .= '<div class="video-container" style="height:12px;"><iframe src="http://player.vimeo.com/video/' . get_post_meta($post->ID, 'pyre_vimeo', true) . '" width="220px" height="161px" frameborder="0"></iframe></div>'; $html .= '</li>'; } $extra = ''; $fi = 2; while ($fi <= $data['featured_images_count']) { $attachment = new StdClass(); $attachment->ID = kd_mfi_get_featured_image_id('featured-image-' . $fi, 'post'); if ($attachment->ID) { $attachment_image = wp_get_attachment_image_src($attachment->ID, $thumb); $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); $attachment_data = wp_get_attachment_metadata($attachment->ID); if ($grid_display == 'masonry') { $extra .= '<li><a href="' . get_permalink() . '"><img src="' . $full_image[0] . '" ></a></li>'; } else { $extra .= '<li><a href="' . get_permalink() . '"><img src="' . $attachment_image[0] . '" ></a></li>'; } } $fi++; } //if($extra ==''){ $hover = '<span class="gallery_zoom"><img src="'.get_bloginfo('template_directory').'/images/img-ovr-recent.png" /></span>';} else $hover =''; if (has_post_thumbnail()) { $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); if ($grid_display == 'masonry') { if ($extra == '') { $html .= '<li><div class="one-fourth-recent"><figure><a href="' . get_permalink() . '"><div class="text-overlay"><div class="info"><i class="fa fa-search"></i></div></div>' . get_the_post_thumbnail($post->ID, 'full') . '</a></figure></div></li>'; } else { $html .= '<li><a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, 'full') . '</a></li>'; } } else { if ($extra == '') { $html .= '<li><div class="one-fourth-recent"><figure><a href="' . get_permalink() . '"><div class="text-overlay"><div class="info"><i class="fa fa-search"></i></div></div>' . get_the_post_thumbnail($post->ID, 'recent-posts-col-3') . '</a></figure></div></li>'; } else { $html .= '<li><a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, $thumb) . '</a></li>'; } } } $html .= $extra; $html .= '</ul></div>'; } } $html .= '<div class="description">'; if ($show_title == "yes") { $html .= '<h3><a href="' . get_permalink($post->ID) . '">' . get_the_title() . '</a></h3>'; } if ($show_date == "yes") { $html .= '<div class="date"><i class="fa fa-clock-o"></i>' . get_the_time('F j, Y', $post->ID) . '</div>'; } if ($show_excerpt == "yes") { $html .= '' . string_limit_words(get_the_excerpt(), $excerpt_length ? $excerpt_length : 15) . '...'; } $html .= '</div>'; //$html .= '<div class="bottom"></div>'; $html .= '</div>'; $count++; } wp_reset_query(); $html .= '</div></div>'; return $html; }
/** * Render the parent shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_id' => '', 'cat_slug' => '', 'columns' => 3, 'excerpt' => 'no', 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'hover_type' => 'none', 'layout' => 'default', 'meta' => 'yes', 'number_posts' => 4, 'offset' => '', 'strip_html' => 'yes', 'title' => 'yes', 'thumbnail' => 'yes', 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => '', 'animation_offset' => Avada()->settings->get('animation_offset')), $args); if ($defaults['columns'] > 6) { $defaults['columns'] = 6; } $defaults['strip_html'] == 'yes' || $defaults['strip_html'] == 'true' ? $defaults['strip_html'] = true : ($defaults['strip_html'] = false); if ($defaults['number_posts']) { $defaults['posts_per_page'] = $defaults['number_posts']; } if ($defaults['excerpt_length'] || $defaults['excerpt_length'] === '0') { $defaults['excerpt_words'] = $defaults['excerpt_length']; } //check for cats to exclude; needs to be checked via exclude_cats param and '-' prefixed cats on cats param //exclution via exclude_cats param $cats_to_exclude = explode(',', $defaults['exclude_cats']); if ($cats_to_exclude) { foreach ($cats_to_exclude as $cat_to_exclude) { $idObj = get_category_by_slug($cat_to_exclude); if ($idObj) { $cats_id_to_exclude[] = $idObj->term_id; } } if (isset($cats_id_to_exclude) && $cats_id_to_exclude) { $defaults['category__not_in'] = $cats_id_to_exclude; } } //setting up cats to be used and exclution using '-' prefix on cats param; transform slugs to ids $cat_ids = ''; $categories = explode(',', $defaults['cat_slug']); if (isset($categories) && $categories) { foreach ($categories as $category) { if ($category) { $cat_obj = get_category_by_slug($category); if (isset($cat_obj->term_id)) { if (strpos($category, '-') === 0) { $cat_ids .= '-' . $cat_obj->cat_ID . ','; } else { $cat_ids .= $cat_obj->cat_ID . ','; } } } } } $defaults['cat'] = substr($cat_ids, 0, -1); $defaults['cat'] .= $defaults['cat_id']; $items = ''; $args = array('posts_per_page' => $defaults['number_posts'], 'ignore_sticky_posts' => 1); if ($defaults['offset']) { $args['offset'] = $defaults['offset']; } if ($defaults['cat']) { $args['cat'] = $defaults['cat']; } if (isset($defaults['category__not_in']) && is_array($defaults['category__not_in'])) { $args['category__not_in'] = $defaults['category__not_in']; } extract($defaults); self::$args = $defaults; $recent_posts = new WP_Query($args); $count = 1; while ($recent_posts->have_posts()) { $recent_posts->the_post(); $attachment = $date_box = $slideshow = $slides = $content = ''; if ($layout == 'date-on-side') { switch (get_post_format()) { case 'gallery': $format_class = 'images'; break; case 'link': $format_class = 'link'; break; case 'image': $format_class = 'image'; break; case 'quote': $format_class = 'quotes-left'; break; case 'video': $format_class = 'film'; break; case 'audio': $format_class = 'headphones'; break; case 'chat': $format_class = 'bubbles'; break; default: $format_class = 'pen'; break; } $date_box = sprintf('<div %s><div %s><span %s>%s</span><span %s>%s</span></div><div %s><i %s></i></div></div>', FusionCore_Plugin::attributes('fusion-date-and-formats'), FusionCore_Plugin::attributes('fusion-date-box updated'), FusionCore_Plugin::attributes('fusion-date'), get_the_time($smof_data['alternate_date_format_day']), FusionCore_Plugin::attributes('fusion-month-year'), get_the_time($smof_data['alternate_date_format_month_year']), FusionCore_Plugin::attributes('fusion-format-box'), FusionCore_Plugin::attributes('fusion-icon-' . $format_class)); } if ($thumbnail == 'yes' && $layout != 'date-on-side' && !post_password_required(get_the_ID())) { if ($layout == 'default') { $image_size = 'recent-posts'; } elseif ($layout == 'thumbnails-on-side') { $image_size = 'portfolio-five'; } if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) { if (get_post_meta(get_the_ID(), 'pyre_video', true)) { $slides .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true)); } if (has_post_thumbnail()) { $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size); $attachment_img_tag = wp_get_attachment_image(get_post_thumbnail_id(), $image_size); $attachment_img_tag_custom = sprintf('<img src="%s" alt="%s" />', $attachment_image[0], get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $attachment = get_post(get_post_thumbnail_id()); $slides .= sprintf('<li><a href="%s" %s>%s</a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img-link'), $attachment_img_tag_custom); } $i = 2; while ($i <= $smof_data['posts_slideshow_number']) { $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_new_id) { $attachment_image = wp_get_attachment_image_src($attachment_new_id, $image_size); $attachment_img_tag = wp_get_attachment_image($attachment_new_id, $image_size); $attachment_img_tag_custom = sprintf('<img src="%s" alt="%s" />', $attachment_image[0], get_post_meta($attachment_new_id, '_wp_attachment_image_alt', true)); $full_image = wp_get_attachment_image_src($attachment_new_id, 'full'); $attachment_data = wp_get_attachment_metadata($attachment_new_id); $slides .= sprintf('<li><a href="%s" %s>%s</a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img-link'), $attachment_img_tag_custom); } $i++; } $slideshow = sprintf('<div %s><ul %s>%s</ul></div>', FusionCore_Plugin::attributes('recentposts-shortcode-slideshow'), FusionCore_Plugin::attributes('slides'), $slides); } } if ($title == 'yes') { $content .= avada_render_rich_snippets_for_pages(false); $entry_title = ''; if (!$smof_data['disable_date_rich_snippet_pages']) { $entry_title = 'entry-title'; } $content .= sprintf('<h4 class="%s"><a href="%s">%s</a></h4>', $entry_title, get_permalink(get_the_ID()), get_the_title()); } else { $content .= avada_render_rich_snippets_for_pages(); } if ($meta == 'yes') { $comments = $comments_link = ''; ob_start(); comments_popup_link(__('0 Comments', 'fusion-core'), __('1 Comment', 'fusion-core'), '% ' . __('Comments', 'fusion-core')); $comments_link = ob_get_contents(); ob_get_clean(); $comments = sprintf('<span %s>|</span><span>%s</span>', FusionCore_Plugin::attributes('meta-separator'), $comments_link); $content .= sprintf('<p %s><span><span %s>%s</span></span>%s</p>', FusionCore_Plugin::attributes('meta'), FusionCore_Plugin::attributes('date'), get_the_time($smof_data['date_format'], get_the_ID()), $comments); } if ($excerpt == 'yes') { $content .= fusion_get_post_content('', 'yes', $excerpt_words, $strip_html); } if ($count == self::$args['columns']) { $count = 0; $items .= sprintf('<div %s>%s%s<div %s>%s</div></div><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content); } else { $items .= sprintf('<div %s>%s%s<div %s>%s</div></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content); } $count++; } $html = sprintf('<div %s><section %s>%s</section></div>', FusionCore_Plugin::attributes('recentposts-shortcode'), FusionCore_Plugin::attributes('recentposts-shortcode-section'), $items); wp_reset_query(); return $html; }
function vh_load_movies_list() { $cat_id = sanitize_text_field($_POST['cat']); $theatre = sanitize_text_field($_POST['theatres']); $post_date = sanitize_text_field($_POST['date']); $sorting = sanitize_text_field($_POST['sorting']); $show_all = sanitize_text_field($_POST['list_all_events']); global $post; $output = '<script type="text/javascript"> var $container = jQuery("#movies_list_content .event_container").isotope({ layoutMode: "fitRows", transformsEnabled: true, getSortData: { popularity : function ( $elem ) { return parseInt($elem.find(".event_list_rating").text()); }, release : function ( $elem ) { var release_val = $elem.find(".info.event_release").text(); if ( release_val == "" ) { release_val = "January 1, 1970"; } return Date.parse(release_val); }, comments : function ( $elem ) { return parseInt( $elem.find(".comments").text()); } }, sortBy: "' . $sorting . '", sortAscending: false, animationOptions: { duration: 250, easing: "swing", queue: true }, animationEngine : "jquery" }); jQuery(".wrapper-dropdown-6 .dropdown li").click(function(e) { var sortValue = jQuery(this).find("input[type=hidden]").attr("data-sort-value"); $container.isotope({ sortBy: sortValue, sortAscending: false }); }); jQuery( ".event_list.isotope-item .movie_list_image" ).mouseenter(function() { jQuery(this).find(".bottom_line").show().animate({ width: "100%", left: "0%", }, 300, function() { // Animation complete. }); }); jQuery( ".event_list.isotope-item .movie_list_image" ).mouseleave(function() { jQuery(this).find(".bottom_line").show().animate({ width: "0%", left: "50%", }, 300, function() { // Animation complete. }); }); jQuery(document).ajaxComplete(function() { var main = 0; var sidebar_height = 0; var sidebar = ""; if ( jQuery(".page-wrapper").hasClass("page-sidebar-right") ) { sidebar_height = jQuery(".sidebar-right").height(); sidebar = jQuery(".sidebar-right"); main = jQuery(".sidebar-right-pull").height(); } else { sidebar_height = jQuery(".sidebar-left").height(); sidebar = jQuery(".sidebar-left"); main = jQuery(".sidebar-left-pull").height(); }; if ( jQuery(window).width() > 750 && main > sidebar.height() ) { sidebar.height(main); } else { sidebar.height("auto"); } }); </script>'; if ($post_date == '' || $post_date == 'NaN.NaN.NaN') { $post_date = date('m.d.Y'); } $current_date = explode(".", $post_date); if ($show_all == '1') { $args = array('numberposts' => -1, 'post_type' => 'movies', 'event_categories' => $cat_id, 'posts_per_page' => -1); } else { $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => 'movies', 'event_categories' => $cat_id, 'meta_query' => array(array('key' => 'movie_time_values', 'value' => $post_date, 'compare' => 'LIKE'))); } $the_query = new WP_Query($args); if ($the_query->have_posts()) { $output .= '<ul class="event_container">'; while ($the_query->have_posts()) { $the_query->the_post(); try { $dt = new DateTime('', new DateTimeZone(get_option('timezone_string'))); } catch (Exception $e) { if (strlen($e->getMessage()) > 1) { $dt = new DateTime('', new DateTimeZone('UTC')); } } $now = strtotime($dt->format('H:00')); $now = date('H:00', $now); $values = trim(get_post_meta(get_post()->ID, 'movie_time_values', true), ','); $values_arr = json_decode('{"events":[' . $values . ']}', true); foreach ($values_arr as $value) { foreach ($value as $info) { $movie_date = explode(".", $info['date']); if ($post_date != '' && (strtotime($movie_date["2"] . "-" . $movie_date["0"] . "-" . $movie_date["1"]) == strtotime($current_date["2"] . "-" . $current_date["0"] . "-" . $current_date["1"]) && $show_all != '1' || strtotime($movie_date["2"] . "-" . $movie_date["0"] . "-" . $movie_date["1"]) >= strtotime($current_date["2"] . "-" . $current_date["0"] . "-" . $current_date["1"]) && $show_all == '1')) { if ($theatre == '') { $output .= '<li class="event_list vc_span12" id="post-' . get_the_ID() . '">'; $output .= '<div class="movie_list_image shadows">'; $output .= '<div class="bottom_line"></div>'; if (kd_mfi_get_featured_image_id('event-poster', 'movies') != '') { $attachment_id = kd_mfi_get_featured_image_id('event-poster', 'movies'); $image = wp_get_attachment_image_src($attachment_id, 'movie_list'); $output .= '<a href="' . get_permalink(get_the_ID()) . '"><img src="' . $image[0] . '"></a>'; } elseif (has_post_thumbnail(get_post()->ID)) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_post()->ID), 'movie_list'); $output .= '<a href="' . get_permalink(get_the_ID()) . '"><img src="' . $image[0] . '"></a>'; } $output .= '</div>'; $output .= '<div class="movie_list_container">'; $output .= '<div class="movie_title"><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></div>'; if (function_exists('the_ratings')) { $rating_images = substr_replace(the_ratings_results($post->ID), '', strlen(the_ratings_results($post->ID)) - 5); $rating_value = number_format(floatval(substr(the_ratings_results(get_the_ID()), strlen(the_ratings_results(get_the_ID())) - 5)), 1); if ($rating_value < 10) { $rating_value = ' ' . $rating_value; } $output .= '<div class="event_list_rating">' . $rating_images . $rating_value . '</div>'; } $tc = wp_count_comments(get_the_ID()); $output .= '<span class="comments icon-comment">' . $tc->total_comments . '</span>'; $output .= '<div class="overview-container"> <div class="main_side_left">'; $categories = wp_get_post_terms(get_the_ID(), 'event_categories', array("fields" => "names")); $categories_count = count($categories); $categories_val = 1; $categories_string = ''; foreach ($categories as $value) { if ($categories_val == $categories_count) { $categories_string = $categories_string . $value; } else { $categories_string = $categories_string . $value . ', '; } $categories_val++; } if ($categories_string != '') { $output .= '<div class="event_list_item icon-tags"><div class="title left">' . __('Category:', 'vh') . '</div><div class="info event_category">' . $categories_string . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'event_release', true) != '') { $output .= '<div class="event_list_item icon-calendar"><div class="title left">' . __('Release date:', 'vh') . '</div><div class="info event_release">' . get_post_meta(get_the_ID(), 'event_release', true) . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'movies_length', true) != '') { $output .= '<div class="event_list_item icon-clock"><div class="title left">' . __('Duration:', 'vh') . '</div><div class="info movies_length">' . vh_convertToHoursMins(get_post_meta(get_the_ID(), 'movies_length', true), __('%2d hours %2d minutes', "vh")) . '</div><div class="clearfix"></div></div>'; } $output .= '</div> <div class="main_side_right">'; if (get_post_meta(get_the_ID(), 'event_director', true) != '') { $output .= '<div class="event_list_item icon-user"><div class="title right">' . __('Director:', 'vh') . '</div><div class="info event_director">' . get_post_meta(get_the_ID(), 'event_director', true) . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'event_actors', true) != '') { $output .= '<div class="event_list_item icon-users"><div class="title right">' . __('Actors:', 'vh') . '</div><div class="info event_actors">' . get_post_meta(get_the_ID(), 'event_actors', true) . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'event_box_office', true) != '') { $output .= '<div class="event_list_item icon-dollar"><div class="title right">' . __('Box Office:', 'vh') . '</div><div class="info event_box_office">' . get_post_meta(get_the_ID(), 'event_box_office', true) . '</div><div class="clearfix"></div></div>'; } $output .= '</div> <div class="clearfix"></div> </div><!--end of overview-container-->'; $output .= '<div class="event_buttons">'; $output .= '<div class="button_red"><a href="' . get_permalink(get_the_ID()) . '#tickets' . '" class="vh_button red icon-ticket hover_right">' . __('Buy tickets', 'vh') . '</a></div>'; $youtube = explode('=', get_post_meta(get_the_ID(), 'event_trailer', true)); if ($youtube[0] != '') { if ($youtube[0] != '') { $youtube_url = $youtube['1']; } else { $youtube_url = ''; } $output .= '<div class="button_yellow"><a href="#" class="vh_button yellow icon-play-1 hover_right">' . __('Watch trailer', 'vh') . '</a><input type="hidden" value="' . $youtube_url . '"></input></div>'; } $output .= '</div>'; $output .= '</div>'; $output .= '</li>'; break; } elseif ($info['theatre'] == $theatre) { $output .= '<li class="vc_span12" id="post-' . get_the_ID() . '">'; $output .= '<div class="movie_list_image shadows">'; $output .= '<div class="bottom_line"></div>'; if (kd_mfi_get_featured_image_id('event-poster', 'movies') != '') { $attachment_id = kd_mfi_get_featured_image_id('event-poster', 'movies'); $image = wp_get_attachment_image_src($attachment_id, 'movie_list'); $output .= '<a href="' . get_permalink(get_the_ID()) . '"><img src="' . $image[0] . '"></a>'; } elseif (has_post_thumbnail(get_post()->ID)) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_post()->ID), 'movie_list'); $output .= '<a href="' . get_permalink(get_the_ID()) . '"><img src="' . $image[0] . '"></a>'; } $output .= '</div>'; $output .= '<div class="movie_list_container">'; $output .= '<div class="movie_title"><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></div>'; if (function_exists('the_ratings')) { $rating_images = substr_replace(the_ratings_results($post->ID), '', strlen(the_ratings_results($post->ID)) - 5); $rating_value = number_format(floatval(substr(the_ratings_results(get_the_ID()), strlen(the_ratings_results(get_the_ID())) - 5)), 1); if ($rating_value < 10) { $rating_value = ' ' . $rating_value; } $output .= '<div class="event_list_rating">' . $rating_images . $rating_value . '</div>'; } $tc = wp_count_comments(get_the_ID()); $output .= '<span class="comments icon-comment">' . $tc->total_comments . '</span>'; $output .= '<div class="overview-container"> <div class="main_side_left">'; $categories = wp_get_post_terms(get_the_ID(), 'event_categories', array("fields" => "names")); $categories_count = count($categories); $categories_val = 1; $categories_string = ''; foreach ($categories as $value) { if ($categories_val == $categories_count) { $categories_string = $categories_string . $value; } else { $categories_string = $categories_string . $value . ', '; } $categories_val++; } if ($categories_string != '') { $output .= '<div class="event_list_item icon-tags"><div class="title left">' . __('Category:', 'vh') . '</div><div class="info event_category">' . $categories_string . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'event_release', true) != '') { $output .= '<div class="event_list_item icon-calendar"><div class="title left">' . __('Release date:', 'vh') . '</div><div class="info event_release">' . get_post_meta(get_the_ID(), 'event_release', true) . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'movies_length', true) != '') { $output .= '<div class="event_list_item icon-clock"><div class="title left">' . __('Duration:', 'vh') . '</div><div class="info movies_length">' . vh_convertToHoursMins(get_post_meta(get_the_ID(), 'movies_length', true), __('%2d hours %2d minutes', "vh")) . '</div><div class="clearfix"></div></div>'; } $output .= '</div> <div class="main_side_right">'; if (get_post_meta(get_the_ID(), 'event_director', true) != '') { $output .= '<div class="event_list_item icon-user"><div class="title right">' . __('Director:', 'vh') . '</div><div class="info event_director">' . get_post_meta(get_the_ID(), 'event_director', true) . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'event_actors', true) != '') { $output .= '<div class="event_list_item icon-users"><div class="title right">' . __('Actors:', 'vh') . '</div><div class="info event_actors">' . get_post_meta(get_the_ID(), 'event_actors', true) . '</div><div class="clearfix"></div></div>'; } if (get_post_meta(get_the_ID(), 'event_box_office', true) != '') { $output .= '<div class="event_list_item icon-dollar"><div class="title right">' . __('Box Office:', 'vh') . '</div><div class="info event_box_office">' . get_post_meta(get_the_ID(), 'event_box_office', true) . '</div><div class="clearfix"></div></div>'; } $output .= '</div> <div class="clearfix"></div> </div><!--end of overview-container-->'; $output .= '<div class="event_buttons">'; $output .= '<div class="button_red"><a href="' . get_permalink(get_the_ID()) . '#tickets' . '" class="vh_button red icon-ticket hover_right">' . __('Buy tickets', 'vh') . '</a></div>'; $youtube = explode('=', get_post_meta(get_the_ID(), 'event_trailer', true)); if ($youtube[0] != '') { if ($youtube[0] != '') { $youtube_url = $youtube['1']; } else { $youtube_url = ''; } $output .= '<div class="button_yellow"><a href="#" class="vh_button yellow icon-play-1 hover_right">' . __('Watch trailer', 'vh') . '</a><input type="hidden" value="' . $youtube_url . '"></input></div>'; } $output .= '</div>'; $output .= '</div>'; $output .= '</li>'; break; } } } } } $output .= '</ul>'; } echo $output; wp_reset_query(); die(1); }
$i = 2; $attachments_count = 1; if (isset($img[0])) { ?> <div class="image_wrapper carousel"> <ul class="donation-open-carousel"> <li><img src="<?php echo $img[0]; ?> "<?php echo $img_style; ?> class="open_entry_image" alt="" /></li> <?php while ($i <= 5) { $attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'donations'); if ($attachment_id) { $featured_img = wp_get_attachment_image_src($attachment_id, 'large-image'); echo '<li><img src="' . $featured_img[0] . '" class="open_entry_image" alt="" /></li>'; $attachments_count = ++$attachments_count; } $i++; } ?> </ul> <?php if ($attachments_count > 1) { ?> <div class="donation-open-left"></div> <div class="donation-open-right"></div> <?php
</div> <?php } elseif ($attachments_count > 1) { ?> <div class="open-post-image-carousel"> <div class="open-post-carousel-container"> <?php if (isset($img[0])) { ?> <img src="<?php echo esc_url($img[0]); ?> " class="open-post-carousel-image" alt="Carousel image" /> <?php } foreach ($images_arr as $image_value) { $attachment_id = kd_mfi_get_featured_image_id($image_value, 'post'); $attachment_image = wp_get_attachment_image_src($attachment_id, 'blogpost-post-wide'); ?> <img src="<?php echo esc_url($attachment_image[0]); ?> " class="open-post-carousel-image" alt="Carousel image" /> <?php } ?> </div> </div> <?php if (isset($img[0])) { $attachments_count++; } echo blogpost_get_carousel_bullets($attachments_count);
function blog_shortcode($atts) { global $data; wp_enqueue_script('jquery.flexslider'); if (is_front_page() || is_home()) { $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // if a number of posts should be displayed using their id; got to build array if (isset($atts['post__in'])) { $atts['post__in'] = array_map('trim', explode(',', $atts['post__in'])); } // only get the specified number of posts if (isset($atts['get_latest'])) { $get_latest = $atts['get_latest']; $atts = shortcode_atts(array('author' => '', 'author_name' => '', 'category_name' => '', 'category' => '', 'id' => false, 'p' => false, 'post__in' => false, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'post_type' => 'post', 'posts_per_page' => $atts['get_latest'], 'nopaging' => "false", 'paged' => $paged, 'tag' => '', 'tax_operator' => 'IN', 'tax_term' => false, 'taxonomy' => 'category', 'title_meta' => '', 'include_shortcodes' => false, 'blog_layout' => 'large'), $atts); // get specified number of posts per page } else { if (isset($atts['posts_per_page'])) { $atts = shortcode_atts(array('author' => '', 'author_name' => '', 'category_name' => '', 'category' => '', 'id' => false, 'p' => false, 'post__in' => false, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'post_type' => 'post', 'posts_per_page' => $atts['posts_per_page'], 'nopaging' => "true", 'paged' => $paged, 'tag' => '', 'tax_operator' => 'IN', 'tax_term' => false, 'taxonomy' => 'category', 'title_meta' => '', 'include_shortcodes' => false, 'blog_layout' => 'large'), $atts); } else { // get all posts, i.e. default $atts = shortcode_atts(array('author' => '', 'author_name' => '', 'category_name' => '', 'category' => '', 'id' => false, 'p' => false, 'post__in' => false, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'post_type' => 'post', 'nopaging' => "false", 'paged' => $paged, 'tag' => '', 'tax_operator' => 'IN', 'tax_term' => false, 'taxonomy' => 'category', 'title_meta' => false, 'include_shortcodes' => false, 'blog_layout' => 'large'), $atts); } } if ($atts['nopaging'] == 'true') { $atts['nopaging'] = true; } elseif ($atts['nopaging'] == 'false') { $atts['nopaging'] = false; } $ml_query = new WP_Query($atts); $html = '</div></div>'; while ($ml_query->have_posts()) { $ml_query->the_post(); // get the css styling classes out of the get_post_class() array $post_classes_values = 'class="'; $post_classes = get_post_class(); foreach ($post_classes as $key => $value) { if (strlen($post_classes_values) == 7) { $post_classes_values .= $value; } else { $post_classes_values .= ' ' . $value; } } $post_classes_values .= '"'; $html .= '<div id="post-' . get_the_ID() . '"' . $post_classes_values . '>'; if (!isset($atts['title_meta']) || $atts['title_meta'] == false) { if ($data['featured_images']) { $html .= '<style type="text/css">'; if (get_post_meta(get_the_ID(), 'pyre_fimg_width', true)) { $html .= '#post-' . get_the_ID() . ' .post-slideshow, #post-' . get_the_ID() . ' .floated-post-slideshow, #post-' . get_the_ID() . ' .post-slideshow .image > img, #post-' . get_the_ID() . ' .floated-post-slideshow .image > img {width:' . get_post_meta(get_the_ID(), 'pyre_fimg_width', true) . ' !important;} '; } if (get_post_meta(get_the_ID(), 'pyre_fimg_height', true)) { $html .= '#post-' . get_the_ID() . ' .post-slideshow, #post-' . get_the_ID() . ' .floated-post-slideshow, #post-' . get_the_ID() . ' .post-slideshow .image > img, #post-' . get_the_ID() . ' .floated-post-slideshow .image > img {height:' . get_post_meta(get_the_ID(), 'pyre_fimg_height', true) . ' !important;} '; } $html .= '</style>'; if (get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'link') { $link_icon_css = ''; $zoom_icon_css = 'display:none;'; } elseif (get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'zoom') { $link_icon_css = 'display:none;'; $zoom_icon_css = ''; } elseif (get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'no') { $link_icon_css = 'display:none;'; $zoom_icon_css = 'display:none;'; } else { $link_icon_css = ''; $zoom_icon_css = ''; } $icon_url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true); if (!empty($icon_url_check)) { $icon_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true); } else { $icon_permalink = get_permalink(get_the_ID()); } if ($data['blog_full_width']) { $size = 'full'; } else { $size = 'blog-large'; } if ($atts['blog_layout'] == 'large') { if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) { $html .= '<div class="flexslider post-slideshow"> <ul class="slides">'; if (get_post_meta(get_the_ID(), 'pyre_video', true)) { $html .= '<li class="full-video">' . get_post_meta(get_the_ID(), 'pyre_video', true) . '</li>'; } if (has_post_thumbnail(get_the_ID())) { $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); $html .= '<li> <div class="image">'; if ($data['image_rollover']) { $html .= get_the_post_thumbnail(get_the_ID(), $size); } else { $html .= '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), $size) . '</a>'; } $html .= '<div class="image-extras"> <div class="image-extras-content">'; $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); $html .= '<a style="' . $link_icon_css . '" class="icon link-icon" href="' . $icon_permalink . '">Permalink</a>'; if (get_post_meta(get_the_ID(), 'pyre_video_url', true)) { $full_image[0] = get_post_meta(get_the_ID(), 'pyre_video_url', true); } $html .= '<a style="' . $zoom_icon_css . '" class="icon gallery-icon" href="' . $full_image[0] . '" rel="prettyPhoto[gallery' . get_the_ID() . ']" title="' . get_post_field('post_content', get_post_thumbnail_id()) . '"><img style="display:none;" alt="' . get_post_field('post_excerpt', get_post_thumbnail_id()) . '" />Gallery</a> <h3>' . get_the_title() . '</h3> </div> </div> </div> </li>'; } if ($data['posts_slideshow']) { $i = 2; while ($i <= $data["posts_slideshow_number"]) { $attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_id) { $attachment_image = wp_get_attachment_image_src($attachment_id, $size); $full_image = wp_get_attachment_image_src($attachment_id, 'full'); $attachment_data = wp_get_attachment_metadata($attachment_id); $html .= '<li> <div class="image"> <a href="' . get_permalink() . '"><img src="' . $attachment_image[0] . '" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" /></a> <a style="display:none;" href="' . $full_image[0] . '" rel="prettyPhoto[gallery' . get_the_ID() . ']" alt="' . get_post_field('post_excerpt', $attachment_id) . '" title="' . get_post_field('post_content', $attachment_id) . '"><img style="display:none;" alt="' . get_post_field('post_excerpt', $attachment_id) . '" /></a> </div> </li>'; } $i++; } } $html .= '</ul> </div>'; } } if ($atts['blog_layout'] == 'medium') { if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) { $html .= '<div class="flexslider blog-medium-image floated-post-slideshow"> <ul class="slides">'; if (get_post_meta(get_the_ID(), 'pyre_video', true)) { $html .= '<li class="full-video">' . get_post_meta(get_the_ID(), 'pyre_video', true) . '</li>'; } if (has_post_thumbnail(get_the_ID())) { $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id(get_the_ID())); $html .= '<li> <div class="image"> <a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), "blog-medium") . '</a> <div class="image-extras"> <div class="image-extras-content">'; $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); $html .= '<a style="' . $link_icon_css . '" class="icon link-icon" href="' . $icon_permalink . '">Permalink</a>'; if (get_post_meta(get_the_ID(), 'pyre_video_url', true)) { $full_image[0] = get_post_meta(get_the_ID(), 'pyre_video_url', true); } $html .= '<a style="' . $zoom_icon_css . '" class="icon gallery-icon" href="' . $full_image[0] . '" rel="prettyPhoto[gallery' . get_the_ID() . ']">Gallery</a> <h3>' . get_the_title() . '</h3> </div> </div> </div> </li>'; } if ($data['posts_slideshow']) { $i = 2; while ($i <= $data['posts_slideshow_number']) { $new_attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post', get_the_ID()); if ($new_attachment_id) { $attachment_image = wp_get_attachment_image_src($new_attachment_id, 'blog-medium'); $full_image = wp_get_attachment_image_src($new_attachment_id, 'full'); $attachment_data = wp_get_attachment_metadata($new_attachment_id); $html .= '<li> <div class="image"> <a href="' . get_permalink() . '"><img src="' . $attachment_image[0] . '" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" /></a> <a style="display:none;" href="' . $full_image[0] . '" rel="prettyPhoto[gallery' . get_the_ID() . ']" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" title="' . get_post_field('post_content', $new_attachment_id) . '"><img style="display:none;" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" /></a> </div> </li>'; } $i++; } } $html .= '</ul> </div>'; } } } $html .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2> <div class="post-content"> '; if ($data['content_length'] == 'Excerpt') { // content of shortcodes should be displayed if (isset($atts['include_shortcodes']) && $atts['include_shortcodes'] == true) { $html .= custom_excerpt(); } else { // content of shortcodes will be cut out, i.e. standard $stripped_content = tf_content($data['excerpt_length_blog'], $data['strip_html_excerpt']); $html .= $stripped_content; } } else { $html .= get_the_content(''); } $html .= '</div><div class="clearboth"></div>'; } else { $html .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; } if ($data['post_meta']) { $html .= '<div class="meta-info"> <div class="alignleft">' . __('By', 'Avada') . ' '; ob_start(); the_author_posts_link(); $html .= ob_get_clean() . '<span class="sep">|</span>' . get_the_time($data['date_format']) . '<span class="sep">|</span>'; ob_start(); the_category(', '); $html .= ob_get_clean(); $html .= '<span class="sep">|</span>'; ob_start(); comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% ' . __('Comments', 'Avada')); $html .= ob_get_clean() . '</div> <div class="alignright"> <a href="' . get_permalink() . '" class="read-more">' . __('Read More', 'Avada') . '</a> </div> </div>'; } $html .= '</div>'; } $html .= '<div><div>'; //no paging if only the latest posts are shown if (isset($get_latest) && $get_latest > 0) { wp_reset_query(); return $html; } else { $html .= ml_blog_pagination($ml_query, $pages = '', $range = 2); wp_reset_query(); return $html; } }
$i = 2; $posts_slideshow = get_option('vh_posts_slideshow_number') ? get_option('vh_posts_slideshow_number') : 5; $attachments_count = 1; while ($i <= $posts_slideshow) { $attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post'); if ($attachment_id) { $attachments_count = ++$attachments_count; } $i++; } ?> <div class="main_top"> <div class="image_wrapper event shadows"> <?php if (kd_mfi_get_featured_image_id('event-poster', 'movies') != '') { $attachment_id = kd_mfi_get_featured_image_id('event-poster', 'movies'); $image = wp_get_attachment_image_src($attachment_id, 'movie_list'); ?> <img src="<?php echo $image[0]; ?> "<?php echo $img_style; ?> class="open_entry_image" alt="" /> <?php } elseif (has_post_thumbnail(get_post()->ID)) { ?> <img src="<?php echo $img[0]; ?>
<div class="messagebox_text"><p><?php _e('You have successfully purchased ', 'vh'); echo $seat_count; _e(' tickets to a movie ', 'vh'); echo $results[0]->show_name . ', ' . date('j.m.Y', strtotime($results[0]->show_date)) . ', ' . date('h:i a', strtotime($movie_time)) . '.'; ?> </p> <?php } ?> </div> </div> <div class="thank_you_container"> <?php if (kd_mfi_get_featured_image_id('event-poster', 'movies', esc_attr($_GET['movie'])) != '') { $attachment_id = kd_mfi_get_featured_image_id('event-poster', 'movies', esc_attr($_GET['movie'])); $image = wp_get_attachment_image_src($attachment_id, 'thank-you-image'); ?> <div class="thank_you_movie shadows"> <img src=" <?php echo $image[0]; ?> "> </div> <?php } elseif (has_post_thumbnail(esc_attr($_GET['movie']))) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(esc_attr($_GET['movie'])), 'thank-you-image'); ?> <div class="thank_you_movie shadows"> <img src="<?php echo $image[0];