?> <div class="content-sep"></div> <?php } ?> <div class="post-content"> <?php if (get_post_meta($current_page_id, 'pyre_portfolio_excerpt', true)) { $excerpt_length = get_post_meta($current_page_id, 'pyre_portfolio_excerpt', true); } else { $excerpt_length = $smof_data['excerpt_length_portfolio']; } ?> <?php if ($smof_data['portfolio_content_length'] == 'Excerpt' && get_post_meta($current_page_id, 'pyre_portfolio_content_length', true) != 'full_content' || get_post_meta($current_page_id, 'pyre_portfolio_content_length', true) == 'excerpt') { $stripped_content = strip_shortcodes(tf_content($excerpt_length, $smof_data['strip_html_excerpt'])); echo $stripped_content; } else { the_content(); } ?> </div> </div> </div> </div> <?php } } ?> </div> <?php
?> <div class="portfolio-content clearfix"> <h2 class="entry-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <h4><?php echo get_the_term_list($post->ID, 'portfolio_category', '', ', ', ''); ?> </h4> <?php if ($data['portfolio_content_length'] == 'Excerpt') { $stripped_content = strip_shortcodes(tf_content($data['excerpt_length_portfolio'], $data['strip_html_excerpt'])); echo $stripped_content; } else { the_content(); } ?> </div> <?php } ?> <?php if ($data['portfolio_archive_layout'] == 'Portfolio One Column Text' || $data['portfolio_archive_layout'] == 'Portfolio One Column') { ?> <div class="buttons"> <a href="<?php the_permalink();
/** * 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; }
<?php endif; ?> <div class="post-content"> <?php if($data['blog_layout'] == 'Large Alternate' || $data['blog_layout'] == 'Medium Alternate' || $data['blog_layout'] == 'Grid' || $data['blog_layout'] == 'Timeline'): ?> <h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php if($data['post_meta']): ?> <?php if($data['blog_layout'] == 'Grid' || $data['blog_layout'] == 'Timeline'): ?> <p class="single-line-meta"><?php if(!$data['post_meta_author']): ?><?php echo __('By', 'Avada'); ?> <?php the_author_posts_link(); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_date']): ?><?php the_time($data['date_format']); ?><?php endif; ?></p> <?php else: ?> <p class="single-line-meta"><?php if(!$data['post_meta_author']): ?><?php echo __('By', 'Avada'); ?> <?php the_author_posts_link(); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_date']): ?><?php the_time($data['date_format']); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_cats']): ?><?php the_category(', '); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_comments']): ?><?php comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% '.__('Comments', 'Avada')); ?><?php endif; ?></p> <?php endif; ?> <?php endif; ?> <?php endif; ?> <div class="content-sep"></div> <?php if($data['content_length'] == 'Excerpt') { $stripped_content = tf_content( $data['excerpt_length_blog'], $data['strip_html_excerpt'] ); echo $stripped_content; } else { the_content(''); } ?> </div> <div style="clear:both;"></div> <?php if($data['post_meta']): ?> <div class="meta-info"> <?php if($data['blog_layout'] == 'Grid' || $data['blog_layout'] == 'Timeline'): ?> <?php if($data['blog_layout'] != 'Large Alternate' && $data['blog_layout'] != 'Medium Alternate'): ?> <div class="alignleft"> <?php if(!$data['post_meta_read']): ?><a href="<?php the_permalink(); ?>" class="read-more"><?php echo __('Read More', 'Avada'); ?></a><?php endif; ?> </div> <?php endif; ?>
function blog_shortcode($atts) { global $data; global $post; wp_enqueue_script( '/js/jquery.flexslider-min' ); 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; } // get specified number of posts per page if (isset($atts['number_posts']) && $atts['number_posts']) { $atts['number_posts'] = (int) $atts['number_posts']; $atts = shortcode_atts( array( 'author' => '', 'author_name' => '', 'category_name' => '', 'cat' => '', 'id' => false, 'p' => false, 'post__in' => false, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'post_type' => 'post', 'posts_per_page' => (int) $atts['number_posts'], 'nopaging' => false, 'paged' => $paged, 'tag' => '', 'tax_operator' => 'IN', 'tax_term' => false, 'taxonomy' => 'category', 'title_meta' => '', 'include_shortcodes' => false, 'layout' => 'large', 'cat_slug' => '', 'title' => true, 'meta_all' => true, 'meta_author' => true, 'meta_date' => true, 'meta_categories' => true, 'meta_comments' => true, 'meta_link' => true, 'thumbnail' => true, 'excerpt' => true, 'excerpt_words' => '50', 'strip_html' => true, 'paging' => true, 'scrolling' => 'infinite', 'blog_grid_columns' => '3' ), $atts ); } else { // get all posts, i.e. default $atts = shortcode_atts( array( 'author' => '', 'author_name' => '', 'category_name' => '', 'cat' => '', '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, 'layout' => 'large', 'cat_slug' => '', 'title' => true, 'meta_all' => true, 'meta_author' => true, 'meta_date' => true, 'meta_categories' => true, 'meta_comments' => true, 'meta_link' => true, 'thumbnail' => true, 'excerpt' => true, 'excerpt_words' => '50', 'strip_html' => true, 'paging' => true, 'scrolling' => 'infinite', 'blog_grid_columns' => '3' ), $atts ); } if(isset($atts['posts_per_page']) && $atts['posts_per_page'] == -1) { $atts['nopaging'] = true; } // setting attributes right for the php script ($atts['title'] == "yes") ? ($atts['title'] = true) : ($atts['title'] = false); ($atts['meta_all'] == "yes") ? ($atts['meta_all'] = true) : ($atts['meta_all'] = false); ($atts['meta_author'] == "yes") ? ($atts['meta_author'] = true) : ($atts['meta_author'] = false); ($atts['meta_date'] == "yes") ? ($atts['meta_date'] = true) : ($atts['meta_date'] = false); ($atts['meta_categories'] == "yes") ? ($atts['meta_categories'] = true) : ($atts['meta_categories'] = false); ($atts['meta_comments'] == "yes") ? ($atts['meta_comments'] = true) : ($atts['meta_comments'] = false); ($atts['meta_link'] == "yes") ? ($atts['meta_link'] = true) : ($atts['meta_link'] = false); //checking if there are categories that are excluded using "-"; transform slugs to ids $cat_ids =''; $categories = explode(',', $atts['cat_slug']); if ( isset($categories) && $categories) { foreach ($categories as $category) { if(strpos($category, '-') === 0) { $cat_ids .= '-' .get_category_by_slug( $category )->cat_ID .','; } else { $cat_ids .= get_category_by_slug( $category )->cat_ID .','; } } } $atts['cat'] = substr($cat_ids, 0, -1); ($atts['thumbnail'] == "yes") ? ($atts['thumbnail'] = true) : ($atts['thumbnail'] = false); ($atts['thumbnail'] == "yes") ? ($atts['thumbnail'] = true) : ($atts['thumbnail'] = false); ($atts['excerpt'] == "yes") ? ($atts['excerpt'] = true) : ($atts['excerpt'] = false); ($atts['strip_html'] == "yes") ? ($atts['strip_html'] = 1) : ($atts['strip_html'] = 0); ($atts['paging'] == "yes") ? ($atts['paging'] = true) : ($atts['paging'] = false); ($atts['scrolling'] == "infinite") ? ($atts['paging'] = true) : ($atts['paging'] = $atts['paging']); $container_class = ''; $post_class = ''; if($atts['layout'] == 'large alternate') { $post_class = 'large-alternate'; } elseif($atts['layout'] == 'medium alternate') { $post_class = 'medium-alternate'; } elseif($atts['layout'] == 'grid') { $post_class = 'grid-post'; $container_class = 'grid-layout'; if(get_post_meta($post->ID, 'pyre_full_width', true) == 'yes' || basename( get_page_template() ) == "full-width.php" || basename( get_page_template() ) == "100-width.php") { if($atts['blog_grid_columns'] == '3') { $container_class = 'grid-layout grid-full-layout-3'; } else { $container_class = 'grid-layout grid-full-layout-4'; } } } elseif($atts['layout'] == 'timeline') { $post_class = 'timeline-post'; $container_class = 'timeline-layout'; if(get_post_meta($post->ID, 'pyre_full_width', true) == 'no' && basename( get_page_template() ) != "full-width.php" || basename( get_page_template() ) == "100-width.php") { $container_class = 'timeline-layout timeline-sidebar-layout'; } } $ml_query = new WP_Query($atts); $html = ''; if ($atts['scrolling'] == "infinite") { $html .= '<div id="blog-infinite" class="blog-shortcode">'; $posts_container_id = 'posts-container-infinite'; } else { $html .= '<div id="blog" class="blog-shortcode">'; $posts_container_id = 'posts-container-pagination'; } if($atts['layout'] == 'timeline') { $html .= '<div class="timeline-icon"><i class="icon-comments-alt"></i></div>'; } $html .= '<div id="'.$posts_container_id.'" class="' .$container_class .' clearfix">'; $post_count = 1; $prev_post_timestamp = null; $prev_post_month = null; $first_timeline_loop = false; while( $ml_query->have_posts() ) : $ml_query->the_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'); if($atts['layout'] == 'timeline') { if($prev_post_month != $post_month) { $html.= '<div class="timeline-date"><h3 class="timeline-title">' . get_the_date($data['timeline_date_format']) .'</h3></div>'; } } $html .= '<div id="post-' .get_the_ID().'"'; ob_start(); post_class($post_class.getClassAlign($post_count).' clearfix'); $html .= ob_get_clean() .'>'; if($atts['layout'] == 'medium alternate') { $html.= '<div class="date-and-formats"> <div class="date-box updated"> <span class="date">' . get_the_time($data['alternate_date_format_day']) .'</span> <span class="month-year">' .get_the_time($data['alternate_date_format_month_year']) .'</span> </div> <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>'; } if($atts['thumbnail']) { if($data['legacy_posts_slideshow']) { ob_start(); include(locate_template('legacy-slideshow-blog-shortcode.php', false)); //get_template_part('legacy-slideshow'); $html .= ob_get_clean(); } else { ob_start(); include(locate_template('new-slideshow-blog-shortcode.php', false)); //get_template_part('new-slideshow-blog-shortcode'); $html .= ob_get_clean(); } } $html.= '<div class="post-content-container">'; if($atts['layout'] == 'timeline') { $html.= '<div class="timeline-circle"></div> <div class="timeline-arrow"></div>'; } if($atts['layout'] != 'large alternate' && $atts['layout'] != 'medium alternate' && $atts['layout'] != 'grid' && $atts['layout'] != 'timeline') { if($atts['title']) { $html.= '<h2 class="entry-title"><a href="' . get_permalink() .'">' .get_the_title() .'</a></h2>'; } } if($atts['layout'] == 'large alternate') { $html.= '<div class="date-and-formats"> <div class="date-box updated"> <span class="date">' .get_the_time($data['alternate_date_format_day']) .'</span> <span class="month-year">' .get_the_time($data['alternate_date_format_month_year']) .'</span> </div> <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="post-content">'; if($atts['layout'] == 'large alternate' || $atts['layout'] == 'medium alternate' || $atts['layout'] == 'grid' || $atts['layout'] == 'timeline') { if($atts['title']) { $html.= '<h2 class="post-title entry-title"><a href="' . get_permalink() .'">' . get_the_title() .'</a></h2>'; } if($atts['meta_all']) { if($atts['layout'] == 'grid' || $atts['layout'] == 'timeline') { $html.= '<p class="single-line-meta vcard">'; if($atts['meta_author']) { $html .= __('By', 'Avada') .' '; ob_start(); the_author_posts_link(); $html .= '<span class="fn">'.ob_get_clean().'</span><span class="sep">|</span>'; } if($atts['meta_date']) { $html .= '<span class="updated">'.get_the_time($data["date_format"]).'</span><span class="sep">|</span>'; } $html.= '</p>'; } else { $html.= '<p class="single-line-meta vcard">'; if($atts['meta_author']) { $html .= __('By', 'Avada') .' '; ob_start(); the_author_posts_link(); $html .= '<span class="fn">'.ob_get_clean().'</span><span class="sep">|</span>'; } if($atts['meta_date']) { $html .= '<span class="updated">'.get_the_time($data["date_format"]).'</span><span class="sep">|</span>'; } if($atts['meta_categories']) { ob_start(); the_category(', '); $html .= ob_get_clean().'<span class="sep">|</span>'; } if($atts['meta_comments']) { ob_start(); comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% '.__('Comments', 'Avada')); $html .= ob_get_clean().'<span class="sep">|</span>'; } $html .= '</p>'; } } } $html .= '<div class="content-sep"></div>'; // get the post content according to the chosen kind of delivery if($atts['excerpt']) { // content of shortcodes should be displayed if (isset($atts['include_shortcodes']) && $atts['include_shortcodes'] == true) { $html .= avada_custom_excerpt(); } else { // content of shortcodes will be cut out, i.e. standard $stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] ); $html .= $stripped_content; } } else { global $more; $more = 0; $content = get_the_content(''); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $html .= $content; } $html .= '</div> <div style="clear:both;"></div>'; if($atts['meta_all']) { $html .= '<div class="meta-info">'; if($atts['layout'] == 'grid' || $atts['layout'] == 'timeline') { if($atts['layout'] != 'large alternate' && $atts['layout'] != 'medium alternate') { $html .= '<div class="alignleft">'; if($atts['meta_link']) { $html .= '<a href="' .get_permalink() .'" class="read-more">' .__("Read More", "Avada") .'</a>'; } $html .= '</div>'; } $html .= '<div class="alignright">'; if($atts['meta_comments']) { ob_start(); comments_popup_link('<i class="icon-comments"></i> '.__('0', 'Avada'), '<i class="icon-comments"></i> '.__('1', 'Avada'), '<i class="icon-comments"></i> '.'%'); $html .= ob_get_clean(); } $html .= '</div>'; } else { if($atts['layout'] != 'large alternate' && $atts['layout'] != 'medium alternate') { $html .= '<div class="alignleft vcard">'; if($atts['meta_author']) { $html .= __('By', 'Avada') .' '; ob_start(); the_author_posts_link(); $html .= '<span class="fn">'.ob_get_clean().'</span><span class="sep">|</span>'; } if($atts['meta_date']) { $html .= '<span class="updated">'.get_the_time($data["date_format"]).'</span><span class="sep">|</span>'; } if($atts['meta_categories']) { ob_start(); the_category(', '); $html .= ob_get_clean().'<span class="sep">|</span>'; } if($atts['meta_comments']) { ob_start(); comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% '.__('Comments', 'Avada')); $html .= ob_get_clean().'<span class="sep">|</span>'; } $html .= '</div>'; } $html .= '<div class="alignright">'; if($atts['meta_link']) { $html .= '<a href="' .get_permalink() .'" class="read-more">' .__("Read More", "Avada") .'</a>'; } $html .= '</div>'; } $html .= '</div>'; } $html .= '</div> </div>'; $prev_post_timestamp = $post_timestamp; $prev_post_month = $post_month; $post_count++; endwhile; $html .= '</div></div>'; //no paging if only the latest posts are shown if ($atts['paging']) { $html .= avada_blog_shortcode_pagination($ml_query, $pages = '', $range = 2, $atts['scrolling']); } wp_reset_query(); 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_slug' => '', 'columns' => 3, 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'filters' => 'yes', 'layout' => 'carousel', 'number_posts' => 8, 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => '', 'picture_size' => 'fixed'), $args); $defaults['filters'] == 'yes' || $defaults['filters'] == 'true' ? $defaults['filters'] = true : ($defaults['filters'] = false); extract($defaults); self::$args = $defaults; // set the image size for the slideshow $this->set_image_size(); if ($excerpt_length || $excerpt_length === '0') { $excerpt_words = $excerpt_length; } $args = array('post_type' => 'avada_portfolio', 'paged' => 1, 'posts_per_page' => $number_posts, 'has_password' => false); if (self::$args['exclude_cats']) { $cats_to_exclude = explode(',', self::$args['exclude_cats']); } else { $cats_to_exclude = ''; } if (self::$args['cat_slug']) { $cat_slugs = explode(',', self::$args['cat_slug']); } else { $cat_slugs = ''; } if (isset($cats_to_exclude) && $cats_to_exclude) { $args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cats_to_exclude, 'operator' => 'NOT IN')); if ($cat_slugs) { $args['tax_query']['relation'] = 'AND'; $args['tax_query'][] = array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat_slugs, 'operator' => 'IN'); } } else { if ($cat_slugs) { $args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat_slugs)); } } wp_reset_query(); $recent_works = new WP_Query($args); $works = ''; while ($recent_works->have_posts()) { $recent_works->the_post(); $item_classes = $terms = $image_wrapper = $item_content = $buttons = $url = ''; // set classes, link and target for the image extras content $this->set_image_extras(get_the_ID()); if ($layout == 'carousel') { if (has_post_thumbnail()) { if ($smof_data['image_rollover']) { $image = get_the_post_thumbnail(get_the_ID(), $this->image_size); $image .= $this->get_image_extras(get_the_ID()); } else { $image = sprintf('<a href="%s">%s</a>', get_permalink(get_the_ID()), get_the_post_thumbnail(get_the_ID(), $this->image_size)); } $works .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('recentworks-shortcode-img-div'), $image); } } else { if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) { $item_cats = get_the_terms(get_the_ID(), 'portfolio_category'); if ($item_cats) { foreach ($item_cats as $item_cat) { $item_classes .= $item_cat->slug . ' '; } } $permalink = get_permalink(); if (has_post_thumbnail()) { $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $this->image_size); $src = $thumbnail[0]; $alt = get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())); if ($smof_data['image_rollover']) { $image = sprintf('<img %s />', FusionCore_Plugin::attributes('recentworks-shortcode-img', array('src' => $src, 'alt' => $alt))); $image .= $this->get_image_extras(get_the_ID()); } else { $image = sprintf('<a href="%s"><img %s /></a>', $permalink, FusionCore_Plugin::attributes('recentworks-shortcode-img', array('src' => $src, 'alt' => $alt))); } $image_wrapper = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('recentworks-shortcode-img-div'), $image); } if ($layout == 'grid-with-excerpts') { $stripped_content = strip_shortcodes(tf_content($excerpt_words, $smof_data['strip_html_excerpt'])); if ($columns == 1) { if (get_post_meta(get_the_ID(), 'pyre_project_url', true)) { $url = sprintf('<a href="%s" %s>%s</a>', get_post_meta(get_the_ID(), 'pyre_project_url', true), FusionCore_Plugin::attributes('fusion-button medium default'), __('View Project', 'Avada')); } $buttons = sprintf('<div %s><a href="%s" %s>%s</a>%s</div>', FusionCore_Plugin::attributes('buttons'), $permalink, FusionCore_Plugin::attributes('fusion-button medium default'), __('Learn More', 'Avada'), $url); } $item_content = sprintf('<div %s><h2><a href="%s">%s</a></h2><h4>%s</h4>%s</div>', FusionCore_Plugin::attributes('portfolio-content'), $permalink, get_the_title(), get_the_term_list(get_the_ID(), 'portfolio_category', '', ', ', ''), $stripped_content); } $works .= sprintf('<div %s>%s%s</div>', FusionCore_Plugin::attributes('portfolio-item ' . $item_classes), $image_wrapper, $item_content); } } } wp_reset_query(); if ($layout == 'carousel') { $html = sprintf('<div %s><div %s><div %s><ul>%s</ul></div><div %s><span %s></span><span %s></span></div></div></div>', FusionCore_Plugin::attributes('recentworks-shortcode'), FusionCore_Plugin::attributes('es-carousel-wrapper fusion-carousel-large'), FusionCore_Plugin::attributes('es-carousel'), $works, FusionCore_Plugin::attributes('es-nav'), FusionCore_Plugin::attributes('es-nav-prev'), FusionCore_Plugin::attributes('es-nav-next')); } else { $portfolio_category = get_terms('portfolio_category'); $filter = ''; $filter_wrapper = ''; if ($portfolio_category && $filters == true) { $filter = sprintf('<li %s><a %s>%s</a></li>', FusionCore_Plugin::attributes('active'), FusionCore_Plugin::attributes('recentworks-shortcode-filter-link', array('data-filter' => '*')), __('All', 'Avada')); foreach ($portfolio_category as $portfolio_cat) { if (isset(self::$args['cat_slug']) && self::$args['cat_slug']) { $cat_slug = preg_replace('/\\s+/', '', self::$args['cat_slug']); $cat_slug = explode(',', $cat_slug); if (in_array($portfolio_cat->slug, $cat_slug)) { $filter .= sprintf('<li><a %s>%s</a></li>', FusionCore_Plugin::attributes('recentworks-shortcode-filter-link', array('data-filter' => '.' . $portfolio_cat->slug)), $portfolio_cat->name); } } else { $filter .= sprintf('<li><a %s>%s</a></li>', FusionCore_Plugin::attributes('recentworks-shortcode-filter-link', array('data-filter' => '.' . $portfolio_cat->slug)), $portfolio_cat->name); } } $filter_wrapper = sprintf('<ul %s>%s</ul>', FusionCore_Plugin::attributes('portfolio-tabs'), $filter); } $html = sprintf('<div %s>%s<div %s>%s</div></div>', FusionCore_Plugin::attributes('recentworks-shortcode'), $filter_wrapper, FusionCore_Plugin::attributes('portfolio-wrapper'), $works); } $this->recent_works_counter++; return $html; }
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; } }
function loop_content() { // get the post content according to the chosen kind of delivery if (self::$args['excerpt']) { $content = tf_content(self::$args['excerpt_words'], self::$args['strip_html']); } else { $content = get_the_content(); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); } echo $content; }
function posts_excerpt() { $html = ''; $args = array('posts_per_page' => self::$args['limit'], 'meta_query' => array(array('key' => '_thumbnail_id'))); if (self::$args['post_id']) { $post_ids = explode(',', self::$args['post_id']); $args['post__in'] = $post_ids; } if (self::$args['category']) { $args['category_name'] = self::$args['category']; } $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $image = wp_get_attachment_url(get_post_thumbnail_id()); $title = get_post_field('post_excerpt', get_post_thumbnail_id()); $alt = get_the_title(); $image_output = sprintf('<img src="%s" alt="%s" />', $image, get_the_title()); $link_output = sprintf('<a href="%s">%s</a>', get_permalink(), $image_output); $title = sprintf('<h2><a href="%s">%s</a></h2>', get_permalink(), get_the_title()); $excerpt = sprintf('%s', tf_content(self::$args['excerpt'], true)); $container = sprintf('<div %s><div %s>%s</div></div>', FusionCore_Plugin::attributes('flexslider-shortcode-title-container'), FusionCore_Plugin::attributes('excerpt-container'), $title . $excerpt); $html .= sprintf('<li>%s</li>', $link_output . $container); } } else { } wp_reset_query(); return $html; }
/** * Get the slides for the "posts" slideshow type. * @since 1.0.0 * @param array $args Array of arguments to determine which slides to return. * @return array An array of slides to render for the slideshow. */ private function slideshow_type_posts($args = array(), $settings = array()) { global $post; $slides = array(); $defaults = array('limit' => '5', 'category' => '', 'tag' => '', 'layout' => 'text-left', 'size' => 'large', 'link_title' => '', 'overlay' => 'none', 'display_excerpt' => 'true'); $args = wp_parse_args($args, $defaults); // Determine and validate the layout type. $supported_layouts = WooSlider_Utils::get_posts_layout_types(); if (!in_array($args['layout'], array_keys($supported_layouts))) { $args['layout'] = $defaults['layout']; } // Determine and validate the overlay setting. if (!in_array($args['overlay'], array('none', 'full', 'natural'))) { $args['overlay'] = $defaults['overlay']; } $query_args = array('post_type' => 'post', 'numberposts' => intval($args['limit'])); if ($args['category'] != '') { $query_args['category_name'] = esc_attr($args['category']); } if ($args['tag'] != '') { $query_args['tag'] = esc_attr(str_replace(',', '+', $args['tag'])); } $posts = get_posts($query_args); if (!is_wp_error($posts) && count($posts) > 0) { // Setup the CSS class. $class = 'layout-' . esc_attr($args['layout']) . ' overlay-' . esc_attr($args['overlay']); foreach ($posts as $k => $post) { setup_postdata($post); $image = get_the_post_thumbnail(get_the_ID(), $args['size']); // Allow plugins/themes to filter here. $excerpt = ''; if ($args['display_excerpt'] == 'true' || $args['display_excerpt'] == 1) { $excerpt = wpautop(tf_content($args['excerpt'], "true")); } $title = get_the_title(get_the_ID()); if ($args['link_title'] == 'true' || $args['link_title'] == 1) { $title = '<a href="' . get_permalink($post) . '">' . $title . '</a>'; $image = '<a href="' . get_permalink($post) . '">' . $image . '</a>'; } $content = $image . '<div class="slide-excerpt"><h2 class="slide-title">' . $title . '</h2>' . $excerpt . '</div>'; if ($args['layout'] == 'text-top') { $content = '<div class="slide-excerpt"><h2 class="slide-title">' . $title . '</h2>' . $excerpt . '</div>' . $image; } $layed_out_content = apply_filters('wooslider_posts_layout_html', $content, $args, $post); $content = '<div class="' . esc_attr($class) . '">' . $layed_out_content . '</div>'; $data = array('content' => $content); if (isset($args['thumbnails']) && ('true' == $args['thumbnails'] || 1 == $args['thumbnails'])) { $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium'); if (!is_bool($thumb_url) && isset($thumb_url[0])) { $data['attributes'] = array('data-thumb' => esc_url($thumb_url[0])); } else { $data['attributes'] = array('data-thumb' => esc_url(WooSlider_Utils::get_placeholder_image())); } } $slides[] = $data; } wp_reset_postdata(); } return $slides; }
} else { ?> <div class="content-sep"></div> <?php } ?> <?php if (!$smof_data['search_excerpt']) { ?> <?php if (get_post_type(get_the_ID()) != 'page') { $stripped_content = tf_content($smof_data['excerpt_length_blog'], $smof_data['strip_html_excerpt']); echo $stripped_content; } else { $stripped_content = tf_content(55, $smof_data['strip_html_excerpt']); echo $stripped_content; } ?> <?php } ?> <?php if ($smof_data['post_meta'] && !$smof_data['post_meta_tags'] && ($smof_data['search_layout'] == 'Large' || $smof_data['search_layout'] == 'Medium' || $smof_data['search_layout'] == 'Grid' || $smof_data['search_layout'] == 'Timeline')) { ?> <div class="meta-tags bottom"><?php the_tags(); ?> </div> <?php }