$category = implode(",", $category); if (isset($args["cat"])) { $args["cat"] .= "," . $category; } else { $args["cat"] = $category; } } } /*****************\ Techinical Category *****************/ if (!empty($tag)) { $args["tag"] = $tag; } $r = new WP_Query($args); $total_post_count = $r->found_posts; $max_paged = $total_post_count % $posts_per_page ? ceil($total_post_count / $posts_per_page) : $total_post_count / $posts_per_page; $sb = cws_GetSbClasses(); $sb_block = $sb['sidebar_pos']; /****************************\ VARIABLES *********************************/ get_header(); $class_container = 'page-content' . (cws_has_sidebar_pos($sb_block) ? 'both' == $sb_block ? ' double-sidebar' : ' single-sidebar' : ''); ?> <div class="<?php echo $class_container; ?> "> <div class="container"> <?php if (cws_has_sidebar_pos($sb_block)) { if ('both' == $sb_block) { echo '<aside class="sbleft">'; dynamic_sidebar($sb['sidebar1']);
function render_portfolio($cols = 2, $cats, $UseFilter = true, $posts_per_page = '-1', $paged = 1, $filter = '', $bAjax = false, $blogtype = 'pinterest', $title = '', $pid = null) { $content = ''; if (!empty($cats) && '*' !== $cats) { $categories = array(); $cats_array = explode(',', $cats); foreach ($cats_array as $cat) { $parent_term = get_term_by('slug', $cat, 'cws-portfolio-type'); $child_terms = get_terms('cws-portfolio-type', array('hide_empty' => true, 'child_of' => $parent_term->term_id)); for ($i = 0; $i < count($child_terms); $i++) { if (in_array($child_terms[$i]->slug, $cats_array)) { array_splice($child_terms, $i, 1); } } array_push($categories, $parent_term); $categories = array_merge($categories, $child_terms); } } else { $categories = get_terms('cws-portfolio-type', array('hide_empty' => true)); } $content .= $bAjax ? "" : "<div class='photo_tour_section_header clearfix'>"; if ($UseFilter) { $all = '*'; if (!empty($cats)) { $all = $cats; } if (!$bAjax) { $content .= "<select class='filter'>"; $content .= "<option value='{$all}'"; $content .= !empty($filter) && $filter == $cats ? ' selected>' : '>'; $content .= __('All', THEME_SLUG); $content .= "</option>"; foreach ($categories as $cat) { $selected = $cat->slug == $filter ? ' selected' : ''; $content .= '<option value="' . $cat->slug . '"' . $selected . '>' . $cat->name . "</option>\n"; } $content .= "</select>"; } } $content .= $bAjax && empty($title) ? "" : "<div class='widget-title'>{$title}</div>"; $content .= $bAjax ? "" : "</div>"; $UseFilter = intval($UseFilter); $ajaxurl = THEME_URI . '/core/portfolio-cols.php'; $tax_query_arr = array(); if (!empty($filter)) { $tax_query_arr = array('taxonomy' => 'cws-portfolio-type', 'field' => 'slug', 'terms' => explode(',', $filter)); } else { $terms = array(); foreach ($categories as $category) { array_push($terms, $category->slug); } $tax_query_arr = array('taxonomy' => 'cws-portfolio-type', 'field' => 'slug', 'terms' => $terms); } $arr = array('posts_per_page' => $posts_per_page, 'post_type' => 'portfolio', 'paged' => $paged, 'ignore_sticky_posts' => true, 'tax_query' => array($tax_query_arr)); if ($posts_per_page == '-1') { unset($arr['paged']); } $p = new WP_Query($arr); $sb_block = ''; if ($pid) { $sb = cws_GetSbClasses($pid); $sb_block = $sb['sidebar_pos']; } if (!$bAjax) { $content .= "<div class='photo_tour news-" . $blogtype . ($blogtype == "pinterest" ? " news-" . $cols : "") . "' >"; $content .= '<div class="grid isotope" data-filter="' . $filter . '" data-cols="' . $cols . '" data-aurl="' . $ajaxurl . '" data-use-filter="' . $UseFilter . '" data-ppp="' . $posts_per_page . '" data-blogtype="' . $blogtype . '" data-sb-block="' . $sb_block . '" >'; } if ($p->have_posts()) { if (!$pid) { $pid = get_post(); if ($pid) { $pid = $pid->ID; } } $thumbnail_dims = cws_get_post_tmumbnail_dims($blogtype, $cols, $sb_block); $chars_count = cws_get_content_chars_count($blogtype, $cols); if ($bAjax) { $content .= "<div class='ajax_content'>"; } while ($p->have_posts()) { $p->the_post(); $content .= build_portfolio_item(get_the_ID(), $cols, false, $thumbnail_dims, $chars_count); } } ?> <?php $content .= $bAjax ? '' : '</div></div>'; // class=grid ?> <?php if ($posts_per_page != '-1') { $content .= ppagenavi($p, '<div class="pagination">', '</div>', $paged); } if ($bAjax) { $content .= "</div>"; } if ($bAjax) { $content .= "</div>"; } return $content; }
} } if (count($category) > 0) { $category = implode(",", $category); if (isset($args["cat"])) { $args["cat"] .= "," . $category; } else { $args["cat"] = $category; } } } /*****************\ Techinical Category *****************/ $r = new WP_Query($args); $total_post_count = $r->found_posts; $max_paged = $total_post_count % $posts_per_page ? ceil($total_post_count / $posts_per_page) : $total_post_count / $posts_per_page; $sb = cws_GetSbClasses($post_id); $sb_block = $sb['sidebar_pos']; /****************************\ VARIABLES *********************************/ /**************************** IF NOT AJAX *********************************/ if (empty($_POST['ajax'])) { get_header(); $class_container = 'page-content' . (cws_has_sidebar_pos($sb_block) ? 'both' == $sb_block ? ' double-sidebar' : ' single-sidebar' : ''); ?> <div class="<?php echo $class_container; ?> "> <div class="container"> <?php if (cws_has_sidebar_pos($sb_block)) { if ('both' == $sb_block) {
<?php if (isset($_GET['asearch'])) { get_template_part('search-staff'); return; } $cws_stored_meta = get_post_meta($post->ID, 'cws-mb'); if (isset($cws_stored_meta[0]['cws-mb-sb_override'])) { get_template_part('blog'); return; } get_header(); $pid = get_query_var("page_id"); $pid = !empty($pid) ? $pid : get_queried_object_id(); $sb = cws_GetSbClasses($pid); $sb_block = $sb['sidebar_pos']; $class_container = 'page-content' . (cws_has_sidebar_pos($sb_block) ? 'both' == $sb_block ? ' double-sidebar' : ' single-sidebar' : ''); ?> <div class="<?php echo $class_container; ?> "> <div class="container"> <?php if (cws_has_sidebar_pos($sb_block)) { if ('both' == $sb_block) { echo '<aside class="sbleft">'; dynamic_sidebar($sb['sidebar1']); echo '</aside>'; echo '<aside class="sbright">'; dynamic_sidebar($sb['sidebar2']);
<?php $sb = cws_GetSbClasses($post->ID); $sb_block = $sb['sidebar_pos']; get_header(); $class_container = 'page-content' . (cws_has_sidebar_pos($sb_block) ? 'both' == $sb_block ? ' double-sidebar' : ' single-sidebar' : ''); ?> <div class="<?php echo $class_container; ?> "> <div class="container"> <?php if (cws_has_sidebar_pos($sb_block)) { if ('both' == $sb_block) { echo '<aside class="sbleft">'; dynamic_sidebar($sb['sidebar1']); echo '</aside>'; echo '<aside class="sbright">'; dynamic_sidebar($sb['sidebar2']); echo '</aside>'; } else { echo '<aside class="sb' . $sb_block . '">'; dynamic_sidebar($sb['sidebar1']); echo '</aside>'; } } ?> <main> <div class="grid-row"> <section class="news blog-post staff">