function render_portfolio($paged, $bAjax = false, $filter, $ppp, $pid) { $gen_sets = theme_get_option('general', 'gen_sets'); $gen_but_hide = isset($gen_sets['_port_butt_hide']) ? $gen_sets['_port_butt_hide'] : ''; $gen_button_show = isset($gen_sets['_gen_port_butt_show']) ? $gen_sets['_gen_port_butt_show'] : ''; $gen_button_txt = isset($gen_sets['_gen_port_butt_txt']) ? $gen_sets['_gen_port_butt_txt'] : ''; $gen_ipp = isset($gen_sets['_gen_port_ipp']) ? $gen_sets['_gen_port_ipp'] : ''; if ($ppp) { $ipp = $ppp; $post_port = explode(',', $filter); $page_custom = theme_get_post_custom($pid); if (!empty($page_custom['_port_cat'])) { // this goes to filter list $categories = explode(',', $page_custom['_port_cat']); if ('*' === $filter) { $post_port = $categories; } } } else { $page_custom = theme_get_post_custom(); $post_port = !empty($page_custom['_port_cat']) ? $page_custom['_port_cat'] : '*'; $post_port = empty($filter) ? explode(',', $post_port) : $filter; $custom_ipp = isset($page_custom['_port_ipp']) ? $page_custom['_port_ipp'] : ''; $ipp = $custom_ipp ? $custom_ipp : $gen_ipp; global $post; $pid = $post->ID; } $bUseFilter = isset($page_custom['_port_cat_filter']) ? $page_custom['_port_cat_filter'] : ''; $cols = isset($page_custom['_port_templ']) ? $page_custom['_port_templ'] : 'four'; $gen_side_r = isset($gen_sets['_sidebar_portf_r']) ? $gen_sets['_sidebar_portf_r'] : false; $gen_side_l = isset($gen_sets['_sidebar_portf_l']) ? $gen_sets['_sidebar_portf_l'] : false; $default_page_template = isset($gen_sets['_gen_portf_select']) ? $gen_sets['_gen_portf_select'] : 'sb_none'; $custom_sidebar_l = empty($page_custom['_sidebar_left']) || $page_custom['_sidebar_left'] == "empty" ? $gen_side_l : $page_custom['_sidebar_left']; $custom_sidebar_r = empty($page_custom['_sidebar_right']) || $page_custom['_sidebar_right'] == "empty" ? $gen_side_r : $page_custom['_sidebar_right']; $page_template = isset($page_custom['_portf_templ']) ? $page_custom['_portf_templ'] == "sb_default" ? $default_page_template : $page_custom['_portf_templ'] : $default_page_template; switch ($cols) { case 'one': $img_width = 1150; $text_length = 310; if ($page_template == "sb_right" || $page_template == "sb_left") { $img_width = $img_width - 300; } else { if ($page_template == "sb_double") { $img_width = $img_width - 600; } } break; case 'two': $img_width = 550; $text_length = 150; if ($page_template == "sb_right" || $page_template == "sb_left") { $img_width = $img_width - 150; } else { if ($page_template == "sb_double") { $img_width = $img_width - 300; } } break; case 'three': $img_width = 350; $text_length = 105; if ($page_template == "sb_right" || $page_template == "sb_left" || $page_template == "sb_double") { $img_width = $img_width - 100; } break; case 'four': $img_width = 250; $text_length = 80; break; default: $img_width = 250; $text_length = 100; break; } switch ($page_template) { case 'sb_right': case 'sb_left': $page_style = "single-sidebar"; break; case 'sb_double': $page_style = "double-sidebar"; break; default: $page_style = ""; break; } $f_portf_img_settings = array('width' => $img_width, 'crop' => true); if (!empty($post_port) && $post_port[0] !== '*') { $categories = empty($categories) ? $post_port : $categories; $query_array = array('post_type' => 'portfolio', 'posts_per_page' => $ipp, 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $post_port))); } else { $query_array = array('posts_per_page' => $ipp, 'paged' => $paged, 'post_type' => 'portfolio'); } if (!$bAjax) { ?> <div class="entry-container <?php echo $page_style; ?> "> <?php if (($page_template == 'sb_double' || $page_template == 'sb_left') && function_exists('dynamic_sidebar') && $custom_sidebar_l) { echo '<aside id="sidebar-left">'; dynamic_sidebar($custom_sidebar_l); echo "</aside>"; } ?> <main> <div class="portfolio iso-column iso-<?php echo $cols; ?> -column"> <?php if ('on' === $bUseFilter) { ?> <div class="filter-wrapper"> <select class="filter"> <?php echo '<option value="*" selected>' . __('All', 'happykids') . '</option>'; if (empty($categories)) { $categories = get_terms('portfolio_category', array('hide_empty' => false)); foreach ($categories as $cat) { $selected = $cat->slug == $filter ? ' selected' : ''; echo '<option value="' . $cat->slug . '"' . $selected . '>' . $cat->name . "</option>\n"; } } else { foreach ($categories as $cat) { $selected = $cat == $filter ? ' selected' : ''; $gtb = get_term_by('slug', $cat, 'portfolio_category', ARRAY_A); echo '<option value="' . $cat . '"' . $selected . '>' . $gtb['name'] . "</option>\n"; } } ?> </select> </div> <?php } // $bAjax ?> <div class="grid isotope" <?php echo 'data-ajax="' . THEME_URI . '/portfolio.php"'; ?> <?php echo 'data-ppp="' . $ipp . '"'; ?> <?php echo 'data-cols="' . $pid . '"'; ?> > <?php } $query_port = new WP_Query($query_array); while ($query_port->have_posts()) { $query_port->the_post(); $f_image_id = get_post_thumbnail_id(get_the_id()); $image = wp_get_attachment_image_src($f_image_id, 'full', true); $the_cat = get_the_terms(get_the_ID(), 'portfolio_category'); $categories = ''; if (is_array($the_cat)) { foreach ($the_cat as $cur_term) { $categories .= $cur_term->slug . ' '; } } $page_custom = theme_get_post_custom(); $button_show = isset($page_custom['_port_butt_show']) ? $page_custom['_port_butt_show'] : ''; $button_link = isset($page_custom['_port_butt_link']) ? $page_custom['_port_butt_link'] : ''; $button_txt = isset($page_custom['_port_butt_txt']) ? $page_custom['_port_butt_txt'] : ''; $enable_popup_link = isset($page_custom['_img_port_butt_link']) ? $page_custom['_img_port_butt_link'] : ''; $custom_popup = isset($page_custom['_port_popup_link']) ? $page_custom['_port_popup_link'] : ''; $disable_lightbox = isset($page_custom['_disable_portf_item_lightbox']) ? $page_custom['_disable_portf_item_lightbox'] : ''; if (!$button_txt) { $button_txt = $gen_button_txt; } if ($button_show == 'empty') { $button_show = $gen_button_show; } ?> <div data-categories="<?php echo $categories; ?> " class="iso-item"> <div class="content-wrapper"> <figure> <?php $img_url = empty($f_image_id) ? $image[0] : bfi_thumb($image[0], $f_portf_img_settings); $img_tag = "<img src='{$img_url}' width='278' height='182' alt='' />"; $lightbox_wrapper = $enable_popup_link ? 'class="kids_link"' : 'class="prettyPhoto kids_picture" data-rel="prettyPhoto[portfolio]"'; $lightbox_url = $custom_popup ? esc_url($custom_popup) : ($enable_popup_link ? get_the_permalink() : esc_url($image[0])); if ($disable_lightbox) { echo $img_tag; } else { echo '<a title="' . get_the_title() . '"' . $lightbox_wrapper . ' href="' . $lightbox_url . '">' . $img_tag; if ($enable_popup_link) { echo '<span class="kids_curtain"> </span>'; } echo '</a>'; } ?> </figure> </div><!--/ content-wrapper--> <div class="gallery-text"> <div class="title"><a class="link" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></div> <p><?php the_excerpt_max_charlength($text_length); ?> </p> </div> <div class="post-footer"> <?php if ($button_show == 'show') { $button_text = $button_txt; if (empty($button_link)) { $link = get_the_permalink(); $target = ''; } else { $link = $button_link; $target = '" target="_blank'; } ?> <a href="<?php echo $link . $target; ?> " class="cws_button"><?php echo $button_text; ?> </a> <?php } ?> </div><!--/ post-footer--> <div class="kids_clear"></div> </div> <?php } wp_reset_postdata(); if (!$bAjax) { ?> </div><!-- grid isotope --> <?php } ?> <?php cws_portfolio_pagination('pagenavi gl', $query_port); if (!$bAjax) { ?> </div><!-- .gl_col_ --> <?php comments_template(); ?> </main> <?php } if (($page_template == 'sb_double' || $page_template == 'sb_right') && function_exists('dynamic_sidebar') && $custom_sidebar_r) { echo '<aside id="sidebar-right">'; dynamic_sidebar($custom_sidebar_r); echo "</aside>"; } ?> </div> <!-- .entry-container --> <?php }
* @package WooCommerce/Templates * @version 2.0.0 */ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly get_header(); $gen_sets = theme_get_option('general', 'gen_sets'); $woo_template = isset($gen_sets['_gen_woo_template_select']) ? $gen_sets['_gen_woo_template_select'] : ''; $gen_side_r = isset($gen_sets['_sidebar_main_woo_r']) ? $gen_sets['_sidebar_main_woo_r'] : false; $gen_side_l = isset($gen_sets['_sidebar_main_woo_l']) ? $gen_sets['_sidebar_main_woo_l'] : false; $show_slider = isset($gen_sets['_gen_slider_select']) ? $gen_sets['_gen_slider_select'] : ''; $slogan_sidebar = isset($gen_sets['slogan-area']) ? $gen_sets['slogan-area'] : ''; $benefits_sidebar = isset($gen_sets['benefits-area']) ? $gen_sets['benefits-area'] : ''; $page_custom = theme_get_post_custom(); $page_crumbs = isset($gen_sets['_gen_breadcrumbs']) ? $gen_sets['_gen_breadcrumbs'] : 'show'; switch ($woo_template) { case 'sb_right': case 'sb_left': $woo_style = "single-sidebar"; break; case 'sb_double': $woo_style = "double-sidebar"; break; default: $woo_style = ""; break; } ?> <?php
function shortcode_cws_portfolio($atts = array()) { extract(shortcode_atts(array('title' => '', 'cols' => '4', 'cats' => '', 'postspp' => '-1', 'usecarousel' => 0, 'img_popup' => 1, 'img_width' => '', 'img_height' => '', 'hide_text' => 0, 'txt_length' => '', 'button' => '', 'more' => 0), $atts)); switch ($cols) { case '1': $t_cols = "one"; $default_img_width = 1150; break; case '2': $t_cols = "two"; $default_img_width = 550; break; case '3': $t_cols = "three"; $default_img_width = 350; break; case '4': $t_cols = "four"; $default_img_width = 250; break; default: $t_cols = "four"; $default_img_width = 250; break; } $img_width = empty($img_width) ? $default_img_width : $img_width; $iso_column = 'iso-' . $t_cols . '-column iso-column'; $coef_text = 16 / $cols; $chars_to_display = empty($txt_length) ? 20 * $coef_text : $txt_length; empty($img_height) ? $f_img_settings = array('width' => $img_width, 'crop' => true) : ($f_img_settings = array('width' => $img_width, 'height' => $img_height, 'crop' => true)); $carousel_wrapper = $usecarousel ? "" : $iso_column; $wrapper = '<div class="recent_projects ' . $carousel_wrapper . '">'; $wrapper .= empty($title) ? "" : '<h3 class="section-title">' . $title . '</h3>'; $wrapper .= $usecarousel ? '<div class="projects_carousel clearfix" data-carousel-column="' . $cols . '">' : '<div class="grid isotope">'; $wrapEnd = '</div><!--/ .projects-carousel --></div><!--/ .work-carousel-->'; $cats_array = explode(',', $cats); $query_array_tax = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cats_array, 'operator' => 'IN')); $query_array = array('posts_per_page' => $postspp, 'post_type' => 'portfolio', 'tax_query' => $query_array_tax); if ($cats == '' || $cats == 'all') { $query_port = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => $postspp)); } else { $query_port = new WP_Query($query_array); } $data_id = 1; $slideOutput = ''; while ($query_port->have_posts()) { $query_port->the_post(); $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_id()), 'full', true); $prettyPhotoLink = $image[0]; $image = has_post_thumbnail() ? '<img src="' . bfi_thumb($image[0], $f_img_settings) . '" alt="" />' : ''; $page_custom = theme_get_post_custom(); $video = isset($page_custom['_port_popup_link']) ? $page_custom['_port_popup_link'] : ''; $the_cat = get_the_terms(get_the_ID(), 'portfolio_category'); $categories = ''; if (is_array($the_cat)) { foreach ($the_cat as $cur_term) { $categories .= $cur_term->slug . ' '; } } $_button_out = ''; $gen_sets = theme_get_option('general', 'gen_sets'); $gen_button_default_txt = isset($gen_sets['_gen_port_butt_txt']) ? $gen_sets['_gen_port_butt_txt'] : ''; $button = empty($button) ? $gen_button_default_txt : $button; $_show_button = isset($page_custom['_port_butt_show']) ? $page_custom['_port_butt_show'] : ''; $_button_text = empty($page_custom['_port_butt_txt']) ? $button : $page_custom['_port_butt_txt']; $is_direct_link = isset($page_custom['_img_port_butt_link']) ? $page_custom['_img_port_butt_link'] : ''; if ($is_direct_link) { $emb_code = 'class="kids_link"'; $emb_code_span = '<span class="kids_curtain"> </span>'; } else { $emb_code = 'data-rel="prettyPhoto[rs_projects]" class="prettyPhoto kids_picture"'; $emb_code_span = ''; } $projPermalink = get_permalink(); $_link = isset($page_custom['_port_butt_link']) ? $page_custom['_port_butt_link'] : ''; if (!$_link) { $_link = $projPermalink; } if ($more && ($_show_button == 'empty' || $_show_button == 'show')) { $_button_out = '<div><a href="' . $_link . '" class="cws_button">' . $_button_text . '</a></div>'; } $img_url = $video ? $video : $prettyPhotoLink; $img_wrapper = $image ? $img_popup ? '<div class="content-wrapper"><figure><a ' . $emb_code . ' href="' . $img_url . '" title="' . get_the_title() . '">' . $image . ' ' . $emb_code_span . '</a></figure></div>' : '<div class="content-wrapper"><figure>' . $image . '</figure></div>' : ''; $slideOutput .= $hide_text ? '<div class="iso-item">' . $img_wrapper . '</div>' : '<div class="iso-item">' . $img_wrapper . '<div class="gallery-text"><div class="title">' . get_the_title() . '</div><p>' . the_excerpt_max_charlength($chars_to_display, false) . '</p></div>' . $_button_out . '</div>'; $data_id++; } // end while wp_reset_postdata(); $to_return = $wrapper . $slideOutput . $wrapEnd; return $to_return; }