<div class="grid-row"> <section class="news <?php echo $blogtype ? 'news-' . $blogtype : ''; ?> <?php echo !empty($pinterest_layout) ? 'news-' . $pinterest_layout : ''; ?> "> <div class="grid isotope"> <?php } /****************************\ IF NOT AJAX *********************************/ if (!empty($_POST['ajax'])) { echo "<div>"; } cws_blog_output($r, $total_post_count, $posts_per_page, $blogtype, $pinterest_layout, $sb_block, $paged); if (!empty($_POST['ajax'])) { echo "</div>"; } /**************************** IF NOT AJAX *********************************/ if (empty($_POST['ajax'])) { ?> </div> <?php if ($max_paged > 1) { if ($blogtype == 'pinterest') { cws_load_more(".news .grid", strval($paged), $max_paged, $post_id); } else { cws_pagination($paged, $max_paged); } }
echo '</aside>'; } else { echo '<aside class="sb' . $sb_block . '">'; dynamic_sidebar($sb['sidebar1']); echo '</aside>'; } } ?> <main> <div class="grid-row"> <section class="news <?php echo $blogtype ? 'news-' . $blogtype : ''; ?> "> <div class="grid isotope"> <?php cws_blog_output($r, $total_post_count, $posts_per_page, $blogtype, "", $sb_block, $paged); ?> </div> <?php if ($max_paged > 1) { cws_pagination($paged, $max_paged); } ?> </section> </div> </main> </div> </div> <?php get_footer();
function cws_shortcode_blog($attr, $content) { extract(shortcode_atts(array('title' => '', 'post_count' => '9', 'columns' => '3', 'cats' => ''), $attr)); $args = array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => false, 'posts_per_page' => $post_count); $tech_cat = cws_get_option('tech-category'); $tech_cat = isset($tech_cat) ? $tech_cat : array(); $tech_cat_array = $tech_cat; // copy if (count($tech_cat) > 0) { for ($i = 0; $i < count($tech_cat); $i++) { $tech_cat[$i] = '-' . $tech_cat[$i]; } $tech_cat = implode(',', $tech_cat); $args["cat"] = $tech_cat; } if (!empty($cats)) { $cats = explode(",", $cats); for ($i = 0; $i < count($cats); $i++) { $cats[$i] = get_category_by_slug($cats[$i])->term_id; } for ($i = 0; $i < count($cats); $i++) { if (in_array($cats[$i], $tech_cat_array)) { array_splice($cats, $i, 1); } } if (count($cats) > 0) { $cats = implode(",", $cats); if (isset($args["cat"])) { $args["cat"] .= "," . $cats; } else { $args["cat"] = $cats; } } } $r = new WP_Query($args); ob_start(); ?> <div class="cws_widget"> <div class="cws_widget_content blog"> <?php echo !empty($title) ? "<div class='widget-title'>{$title}</div>" : ""; ?> <section class="news news-pinterest <?php echo 'news-' . $columns; ?> "> <div class="grid isotope"> <?php cws_blog_output($r, $post_count, $post_count, 'pinterest', $columns, 'none', 1); ?> </div> </section> </div> </div> <?php return ob_get_clean(); }