<div class="alignright"> <?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; ?> </div> <?php endif; ?> </div> </div> <?php $prev_post_timestamp = $post_timestamp; $prev_post_month = $post_month; $post_count++; endwhile; ?> </div> <?php themefusion_pagination($pages = '', $range = 2); ?> </div> <?php wp_reset_query(); ?> <div id="sidebar" style="<?php echo $sidebar_css; ?>"> <?php if(is_home()) { $name = get_post_meta(get_option('page_for_posts'), 'sbg_selected_sidebar_replacement', true); if($name) { generated_dynamic_sidebar($name[0]); } } if(is_front_page()) { if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Blog Sidebar')): endif; } ?>
} ?> <?php if ($portfolio_sep == true) { ?> <div class="demo-sep sep-double" style="margin-top:50px;"></div> <?php } ?> </div> <?php } } ?> </div> <?php themefusion_pagination($gallery->max_num_pages, $range = 2); ?> </div> <div id="sidebar" style="<?php echo $sidebar_css; ?> "> <?php if ($data['portfolio_archive_sidebar'] != 'None' && function_exists('dynamic_sidebar')) { generated_dynamic_sidebar($data['portfolio_archive_sidebar']); } ?> </div> <?php get_footer();
/** * Render the 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' => '', 'blog_grid_column_spacing' => '40', 'blog_grid_columns' => '3', 'cat_slug' => '', 'excerpt' => 'yes', 'excerpt_length' => '', 'excerpt_words' => '50', 'exclude_cats' => '', 'layout' => 'large', 'meta_all' => 'yes', 'meta_author' => 'yes', 'meta_categories' => 'yes', 'meta_comments' => 'yes', 'meta_date' => 'yes', 'meta_link' => 'yes', 'meta_read' => 'yes', 'meta_tags' => 'no', 'number_posts' => '', 'order' => 'DESC', 'paging' => 'yes', 'scrolling' => 'infinite', 'strip_html' => 'yes', 'thumbnail' => 'yes', 'title' => 'yes', 'title_link' => 'yes', 'nopaging' => false, 'posts_per_page' => '-1', 'taxonomy' => 'category'), $args); extract($defaults); 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; } $defaults['paged'] = $paged; // covert all attributes to correct values for WP query if ($defaults['number_posts']) { $defaults['posts_per_page'] = $defaults['number_posts']; } if ($defaults['posts_per_page'] == -1) { $defaults['nopaging'] = true; } $defaults['excerpt'] == "yes" ? $defaults['excerpt'] = true : ($defaults['excerpt'] = false); $defaults['meta_all'] == "yes" ? $defaults['meta_all'] = true : ($defaults['meta_all'] = false); $defaults['meta_author'] == "yes" ? $defaults['meta_author'] = true : ($defaults['meta_author'] = false); $defaults['meta_categories'] == "yes" ? $defaults['meta_categories'] = true : ($defaults['meta_categories'] = false); $defaults['meta_comments'] == "yes" ? $defaults['meta_comments'] = true : ($defaults['meta_comments'] = false); $defaults['meta_date'] == "yes" ? $defaults['meta_date'] = true : ($defaults['meta_date'] = false); $defaults['meta_link'] == "yes" ? $defaults['meta_link'] = true : ($defaults['meta_link'] = false); $defaults['meta_tags'] == "yes" ? $defaults['meta_tags'] = true : ($defaults['meta_tags'] = false); $defaults['paging'] == "yes" ? $defaults['paging'] = true : ($defaults['paging'] = false); $defaults['scrolling'] == "infinite" ? $defaults['paging'] = true : ($defaults['paging'] = $defaults['paging']); $defaults['strip_html'] == "yes" ? $defaults['strip_html'] = true : ($defaults['strip_html'] = false); $defaults['thumbnail'] == "yes" ? $defaults['thumbnail'] = true : ($defaults['thumbnail'] = false); $defaults['title'] == "yes" ? $defaults['title'] = true : ($defaults['title'] = false); $defaults['title_link'] == "yes" ? $defaults['title_link'] = true : ($defaults['title_link'] = false); 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']); $cats_id_to_exclude = array(); if ($cats_to_exclude) { foreach ($cats_to_exclude as $cat_to_exclude) { $id_obj = get_category_by_slug($cat_to_exclude); if ($id_obj) { $cats_id_to_exclude[] = $id_obj->term_id; } } if ($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) { $id_obj = get_category_by_slug($category); if ($id_obj) { if (strpos($category, '-') === 0) { $cat_ids .= '-' . $id_obj->cat_ID . ','; } else { $cat_ids .= $id_obj->cat_ID . ','; } } } } $defaults['cat'] = substr($cat_ids, 0, -1); if ($defaults['blog_grid_column_spacing'] === '0') { $defaults['blog_grid_column_spacing'] = '0.0'; } self::$args = $defaults; $fusion_query = new WP_Query($defaults); $this->query = $fusion_query; //prepare needed wrapping containers $html = ''; $html .= sprintf('<div %s>', FusionCore_Plugin::attributes('blog-shortcode')); if (self::$args['layout'] == 'grid' && self::$args['blog_grid_column_spacing']) { $html .= sprintf('<style type="text/css">.fusion-blog-shortcode-%s .grid-layout .post{padding:%spx;}</style>', $this->blog_sc_counter, $defaults['blog_grid_column_spacing'] / 2); } $html .= sprintf('<div %s>', FusionCore_Plugin::attributes('blog-shortcode-posts-container')); ob_start(); do_action('fusion_blog_shortcode_wrap_loop_open'); $wrap_loop_open = ob_get_contents(); ob_get_clean(); $html .= $wrap_loop_open; if (self::$args['layout'] == 'timeline') { $this->post_count = 1; $prev_post_timestamp = null; $prev_post_month = null; $prev_post_year = null; $first_timeline_loop = false; } //do the loop if ($fusion_query->have_posts()) { while ($fusion_query->have_posts()) { $fusion_query->the_post(); $this->post_id = get_the_ID(); if (self::$args['layout'] == 'timeline') { $post_timestamp = strtotime(get_the_date()); $this->post_month = date('n', $post_timestamp); $this->post_year = get_the_date('o'); $current_date = get_the_date('o-n'); $date_params['prev_post_month'] = $prev_post_month; $date_params['post_month'] = $this->post_month; $date_params['prev_post_year'] = $prev_post_year; $date_params['post_year'] = $this->post_year; ob_start(); do_action('fusion_blog_shortcode_timeline_date', $date_params); do_action('fusion_blog_shortcode_before_loop_timeline'); $before_loop_timeline_action = ob_get_contents(); ob_get_clean(); $html .= $before_loop_timeline_action; } else { ob_start(); do_action('fusion_blog_shortcode_before_loop'); $before_loop_action = ob_get_contents(); ob_get_clean(); $html .= $before_loop_action; } if (self::$args['layout'] == 'grid' || self::$args['layout'] == 'timeline') { $html .= sprintf('<div %s>', FusionCore_Plugin::attributes('post-wrapper')); } $this->header = array('title_link' => true); ob_start(); do_action('fusion_blog_shortcode_loop_header'); do_action('fusion_blog_shortcode_loop_content'); do_action('fusion_blog_shortcode_loop_footer'); do_action('fusion_blog_shortcode_after_loop'); $loop_actions = ob_get_contents(); ob_get_clean(); $html .= $loop_actions; if (self::$args['layout'] == 'grid' || self::$args['layout'] == 'timeline') { $html .= '</div>'; } if (self::$args['layout'] == 'timeline') { $prev_post_timestamp = $post_timestamp; $prev_post_month = $this->post_month; $prev_post_year = $this->post_year; $this->post_count++; } } } else { } ob_start(); do_action('fusion_blog_shortcode_wrap_loop_close'); $wrap_loop_close_action = ob_get_contents(); ob_get_clean(); $html .= $wrap_loop_close_action; $html .= '</div>'; if (self::$args['paging']) { ob_start(); themefusion_pagination($this->query->max_num_pages, $range = 2, $this->query); $pagination = ob_get_contents(); ob_get_clean(); $html .= $pagination; } $html .= '</div>'; $this->blog_sc_counter++; return $html; }