function woocommerce_output_related_products() { echo '<div id="related-products">'; echo '<h3>', apply_filters('yiw_related_products_text', __('Related Products', 'yiw')), '</h3>'; $cols = $prod = yiw_layout_page() == 'sidebar-no' ? 5 : 4; if (yiw_get_option('shop_show_related_single_product')) { $prod = yiw_get_option('shop_number_related_single_product'); $cols = yiw_get_option('shop_columns_related_single_product'); } woocommerce_related_products(apply_filters('related_products_posts_per_page', $prod), apply_filters('related_products_columns', $cols)); echo '</div>'; }
<?php wp_reset_query(); ?> <?php if (yiw_layout_page() != 'sidebar-no') { ?> <div id="sidebar" class="group one-fourth<?php if (yiw_layout_page() == 'sidebar-right') { echo ' last'; } ?> "> <?php do_action('yiw_before_sidebar'); ?> <?php do_action('yiw_before_sidebar_' . yiw_get_current_pagename()); ?> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Blog Sidebar')) { get_sidebar('default'); } ?>
if (!empty($cats)) { $cats = array_map('trim', explode(',', $cats)); foreach ($cats as $cat) { if ($cat < 0) { $cat_not_in[] = $cat; } else { $cat_in[] = $cat; } } } get_header(); ?> <div id="primary" class="layout-<?php echo yiw_layout_page(); ?> "> <div class="inner group"> <?php get_template_part('slogan'); ?> <?php get_template_part('accordion-slider'); ?> <!-- START CONTENT --> <div id="content" class="group">
<div id="portfolio-gallery" class="internal_page_items internal_page_gallery"> <ul class="gallery-wrap image-grid group"> <?php global $yiw_portfolio; $post_type = yiw_get_portfolio_post_type(); $args = array('post_type' => $post_type, 'posts_per_page' => $yiw_portfolio[$post_type]['items']); if (is_tax()) { $args = wp_parse_args($args, $wp_query->query); } $gallery = new WP_Query($args); $postsPerRow = yiw_layout_page() != 'sidebar-no' ? 3 : 4; $i = 0; while ($gallery->have_posts()) { $gallery->the_post(); ?> <?php $classes = ""; $terms = get_the_terms(get_the_ID(), sanitize_title($yiw_portfolio[$post_type]['tax'])); if (!empty($terms)) { foreach ($terms as $index => $term) { $classes .= " segment-" . $index; } } ?> <?php $isFirstInRow = ++$i == 1 | $i % $postsPerRow == 1 ? 1 : 0; ?> <?php $isLastInRow = $i % $postsPerRow == 0 ? 1 : 0;
function jigoshop_output_related_products() { if (get_option('jigoshop_enable_related_products') != 'no') { // 2 Related Products in 2 columns $cols = yiw_layout_page() == 'sidebar-no' ? 5 : 4; } if (yiw_get_option('shop_show_related_single_product')) { jigoshop_related_products(apply_filters('related_products_posts_per_page', yiw_get_option('shop_number_related_single_product')), apply_filters('related_products_columns', yiw_get_option('shop_columns_related_single_product'))); } else { jigoshop_related_products(apply_filters('related_products_posts_per_page', $cols), apply_filters('related_products_columns', $cols)); } }
get_template_part('blog'); die; } if ((is_home() || is_front_page()) && get_option('show_on_front') == 'posts' || is_home() && get_option('page_for_posts') != '0') { $blog_type = yiw_get_option('blog_type'); get_template_part('blog'); die; } get_header(); ?> <div id="primary" class="layout-<?php echo $layout_page_type = yiw_layout_page(); ?> "> <div class="inner group"> <?php get_template_part('slogan'); ?> <!-- START CONTENT --> <div id="content" class="group">
* @since Impero 1.0 */ /* Template Name: Portfolio */ global $yiw_portfolio; $yiw_portfolio = yiw_portfolios(); $post_type = yiw_get_portfolio_post_type(); $portfolio_type = !get_post_meta(get_the_ID(), 'portfolio_type', true) ? isset($yiw_portfolio[$post_type]['layout']) ? $yiw_portfolio[$post_type]['layout'] : '' : get_post_meta(get_the_ID(), 'portfolio_type', true); $portfolio_types = array('no_sidebar' => array('3cols', 'slider', 'big_image'), 'sidebar' => array('full_desc', 'filterable')); // enqueue necessary scripts if ($portfolio_type == 'filterable') { wp_enqueue_script('jquery-quicksand', get_template_directory_uri() . "/js/jquery.quicksand.js", array('jquery')); } get_header(); $layout_type = in_array($portfolio_type, $portfolio_types['no_sidebar']) ? 'sidebar-no' : yiw_layout_page(); if ($portfolio_type == 'full_desc') { get_template_part('single', 'portfolio'); die; } $cat_params = array('hide_empty' => FALSE, 'title_li' => ''); $cats = get_terms($yiw_portfolio[$post_type]['tax'], $cat_params); $_active_title = get_post_meta($post->ID, '_show_title_page', true); ?> <div id="primary" class="layout-<?php echo $layout_type; ?> "> <div class="inner group">
/** * FEATURES TAB * * @description * Show all features tab posts in a tabbed div. * * @example * [features_tab name="" open=""] * * @params * name - Features tab name * open - Open this tab at startup **/ function yiw_sc_features_tab($atts, $content = null) { extract(shortcode_atts(array('name' => '', 'open' => 1), $atts)); $name = sanitize_title($name); $open = abs((int) $open); if (empty($name)) { return false; } $args = array('post_type' => $name, 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC'); //$ft = new WP_Query( $args ); $ft_posts = get_posts($args); $features_label = ''; $features_content = ''; $i = 0; foreach ($ft_posts as $ft) { $current = $open == $i + 1 ? 'current-feature' : ''; $the_label = '<li class="features-tab-' . $i . ' ' . $current . '">'; if (has_post_thumbnail($ft->ID)) { $the_label .= get_the_post_thumbnail($ft->ID, 'features_tab_icon'); } $the_label .= $ft->post_title; $the_label .= '</li>'; $the_content = '<div class="features-tab-content features-tab-' . $i . ' ' . $current . '">' . do_shortcode($ft->post_content) . '</div>'; $features_label .= $the_label; $features_content .= $the_content; $i++; } $without_sidebar = yiw_layout_page() == 'sidebar-no' ? 'without-sidebar' : ''; $html = '<div id="features-tab-' . $name . '" class="features-tab-container ' . $without_sidebar . ' group">'; $html .= '<ul class="features-tab-labels">' . $features_label . '</ul>'; $html .= '<div class="features-tab-wrapper">' . yiw_addp($features_content) . '</div>'; $html .= '</div>'; return $html; }
<?php wp_reset_query(); ?> <?php if (yiw_layout_page() != 'sidebar-no') { ?> <div id="sidebar" class="shop group"> <?php do_action('yiw_before_sidebar'); ?> <?php do_action('yiw_before_sidebar_' . yiw_get_current_pagename()); ?> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Shop Sidebar')) { get_sidebar('default'); } ?> <?php do_action('yiw_after_sidebar'); ?>
/** * SITEMAP * * @description * Print a sitemap of the site * * @example * [sitemap title=""] * * @attr * title - the title of sitemap **/ function yiw_sc_sitemap($atts, $content = null) { extract(shortcode_atts(array('title' => null), $atts)); $html = ''; // this is the var to use for the html output of shortcode if ($title) { ?> <h1><?php echo $title; ?> </h1> <?php } ?> <div class="sitemap row"> <?php $order = array(); //$order = array('include' => array('pages' => 'Pages', 'posts' => 'Posts', 'archives' => 'Archives'), 'exclude' => ''); $order = json_decode(stripslashes(yiw_get_option('sitemap-order')), true); if (!empty($order)) { $order = array_keys($order['include']); } $sitemap = array(); //get pages if (in_array('pages', $order)) { //retrieve pages with metabox _exclude-sitemap setted to On $args = array('fields' => 'ids', 'post_type' => 'page', 'meta_query' => array(array('key' => '_exclude-sitemap', 'value' => '1', 'compare' => '='))); $query = new WP_Query($args); $exclude = implode(',', $query->posts) . ',' . yiw_get_option('sitemap-page-exclude'); $sitemap['pages'] = '<h3>' . yiw_get_option('sitemap-page-title') . '</h3>'; $sitemap['pages'] .= '<ul>' . wp_list_pages(array('depth' => yiw_get_option('sitemap-page-depth'), 'exclude' => $exclude, 'echo' => 0, 'title_li' => '', 'sort_column' => yiw_get_option('sitemap-page-sort_column'), 'sort_order' => yiw_get_option('sitemap-page-sort_order'), 'post_type' => 'page', 'post_status' => 'publish')) . '</ul>'; wp_reset_query(); } //get posts if (in_array('posts', $order)) { //get categories $exclude_cat = yiw_get_option('sitemap-posts-cats_exclude'); $categories = get_categories(array('type' => 'post', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'exclude' => $exclude_cat, 'hierarchical' => 1, 'taxonomy' => 'category')); //retrieve pages with metabox _exclude-sitemap setted to On $args = array('fields' => 'ids', 'post_type' => 'post', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'meta_query' => array(array('key' => '_exclude-sitemap', 'value' => '1', 'compare' => '='))); $query = new WP_Query($args); $exclude = implode(',', $query->posts) . ',' . yiw_get_option('sitemap-posts-exclude'); $sitemap['posts'] = '<h3>' . yiw_get_option('sitemap-posts-title') . '</h3>'; foreach ($categories as $category) { //get posts in category $sitemap['posts'] .= '<h4>' . $category->name . '</h4>'; $posts = get_posts(array('numberposts' => yiw_get_option('sitemap-posts-number'), 'category' => $category->cat_ID, 'orderby' => yiw_get_option('sitemap-posts-orderby'), 'order' => yiw_get_option('sitemap-posts-order'), 'exclude' => $exclude, 'post_type' => 'post')); if (count($posts) > 0) { $sitemap['posts'] .= '<ul class="cat_' . $category->cat_ID . ' cat">'; foreach ($posts as $post) { $extra = ''; if (yiw_get_option('sitemap-posts-show_date')) { $extra = ' <span>' . get_the_date() . '</span>'; } $sitemap['posts'] .= '<li><a href="' . get_permalink($post->ID) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'yit'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title($post->ID) . '</a>' . $extra . '</li>'; } $sitemap['posts'] .= '</ul>'; } } wp_reset_query(); } //get archives if (in_array('archives', $order)) { $sitemap['archives'] = '<h3>' . yiw_get_option('sitemap-archive-title') . '</h3>'; $sitemap['archives'] .= '<ul>'; $sitemap['archives'] .= wp_get_archives(array('type' => yiw_get_option('sitemap-archive-type'), 'limit' => yiw_get_option('sitemap-archive-limit') == -1 ? '' : yiw_get_option('sitemap-archive-limit'), 'show_post_count' => yiw_get_option('sitemap-archive-show_post_count'), 'echo' => 0)); $sitemap['archives'] .= '</ul>'; } //get products global $woocommerce; if (in_array('products', $order) && isset($woocommerce)) { $categories = get_terms('product_cat', array('hide_empty' => 0)); $sitemap['products'] = '<h3>' . yiw_get_option('sitemap-products-title') . '</h3>'; foreach ($categories as $category) { //get posts in category $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => yiw_get_option('sitemap-products-number'), 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_cat', 'terms' => array(esc_attr($category->slug)), 'field' => 'slug', 'operator' => 'IN'))); $products = new WP_Query($args); if (count($products->posts) > 0) { $sitemap['products'] .= '<h4>' . $category->name . '</h4>'; $sitemap['products'] .= '<ul class="cat_' . $category->term_id . ' cat">'; foreach ($products->posts as $post) { $sitemap['products'] .= '<li><a href="' . get_permalink($post->ID) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'yit'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title($post->ID) . '</a></li>'; } $sitemap['products'] .= '</ul>'; } } } //print the sitemap $i = 0; foreach ($order as $k => $item) { $i++; $div = yiw_layout_page() == 'sidebar-no' ? 4 : 3; $columns = yiw_layout_page() == 'sidebar-no' ? 'one-fourth' : 'one-third'; $class = $i % $div == 0 ? ' last' : ''; echo '<div class="sitemap-' . $k . '-container ' . $columns . ' ' . $class . '">'; echo $sitemap[$item]; echo '</div>'; if ($i % $div == 0) { echo '<div class="clear"></div>'; } } ?> </div> <?php return apply_filters('yiw_sc_sitemap', $html); // this must be written for each shortcode }