// Breadcrumbs display ishyoboy_show_breadcrumbs(); if (have_posts()) { while (have_posts()) { the_post(); $format = get_post_format(); if (false === $format) { $format = 'standard'; } get_template_part('content-post', $format); } echo '<div class="space"></div>'; if (empty($paged) || 0 == $paged) { $paged = 1; } $pg = ishyoboy_get_pagination('', 3, $wp_query->max_num_pages, $paged); if ('' != $pg) { echo $pg, '<div class="space"></div>'; } } else { ?> <div id="post-0" <?php post_class(); ?> > <h2 class="entry-title"><?php _e('Error 404 - Page Not Found', 'ishyoboy'); ?> </h2>
function ishyoboy_shortcode_portfolio($atts, $content = null) { global $sc_count, $sc_paginated_count, $ish_options; $sc_atts = shortcode_atts(array('id' => '', 'css_class' => '', 'style' => '', 'tooltip' => '', 'tooltip_color' => '', 'align' => '', 'category' => '', 'height' => isset($ish_options['portfolio_height']) ? $ish_options['portfolio_height'] : '', 'per_page' => isset($ish_options['portfolio_posts_per_page']) && is_numeric($ish_options['portfolio_posts_per_page']) ? $ish_options['portfolio_posts_per_page'] : '-1', 'order' => 'DESC', 'navigation' => 'yes', 'pagination' => 'yes', 'view_all' => 'no', 'columns' => isset($ish_options['portfolio_columns']) ? $ish_options['portfolio_columns'] : '4', 'masonry' => isset($ish_options['portfolio_masonry']) ? $ish_options['portfolio_masonry'] : '0', 'fluid_layout' => isset($ish_options['portfolio_fluid_layout']) ? '1' == $ish_options['portfolio_fluid_layout'] ? 'yes' : 'no' : 'no', 'layout_style' => isset($ish_options['portfolio_layout_style']) ? $ish_options['portfolio_layout_style'] : '1', 'show_title' => isset($ish_options['portfolio_show_title']) ? '1' == $ish_options['portfolio_show_title'] ? 'yes' : 'no' : 'yes', 'show_categories' => isset($ish_options['portfolio_show_categories']) ? '1' == $ish_options['portfolio_show_categories'] ? 'yes' : 'no' : 'yes', 'show_link_button' => isset($ish_options['portfolio_show_link_button']) ? '1' == $ish_options['portfolio_show_link_button'] ? 'yes' : 'no' : 'yes', 'show_popup_button' => isset($ish_options['portfolio_show_popup_button']) ? '1' == $ish_options['portfolio_show_popup_button'] ? 'yes' : 'no' : 'yes', 'animate_filter' => isset($ish_options['portfolio_animate_filter']) ? '1' == $ish_options['portfolio_animate_filter'] ? 'yes' : 'no' : 'no'), $atts); $sc_count++; wp_enqueue_script('imagesloaded'); wp_enqueue_script('isotope'); $p_return = '<div>'; // Default type of connecting multiple taxonomy "filters". Do not change this! $tax_query = array('relation' => 'AND'); if (isset($sc_atts['category']) && '' != $sc_atts['category']) { // Display items from a chosen category $cats = explode(',', $sc_atts['category']); $cat_ids = array(); $neg_cat_ids = array(); foreach ($cats as $cat_slug) { $cat_slug = trim($cat_slug); if ('-' == $cat_slug[0]) { // Negative categories = exclude those $cat = get_term_by('slug', $cat_slug, 'portfolio-category'); if ($cat) { $neg_cat_ids[] = $cat->term_id; } } else { // Positive categories $cat = get_term_by('slug', $cat_slug, 'portfolio-category'); if ($cat) { $cat_ids[] = $cat->term_id; } } } if (count($cat_ids) > 0 || count($neg_cat_ids) > 0) { if (count($cat_ids) > 0) { $tax_query[] = array('taxonomy' => 'portfolio-category', 'field' => 'id', 'terms' => $cat_ids); } if (count($neg_cat_ids) > 0) { $tax_query[] = array('taxonomy' => 'portfolio-category', 'field' => 'id', 'terms' => $neg_cat_ids, 'operator' => 'NOT IN'); } } else { $tax_query[] = array('taxonomy' => 'portfolio-category', 'field' => 'slug', 'terms' => $cats); } } else { // Display items from all categories // $tax_query = array(); } if ('yes' == $sc_atts['navigation']) { $terms = array(); if (isset($sc_atts['category']) && '' != $sc_atts['category']) { $cats = explode(',', $sc_atts['category']); $parent_ids = array(); $neg_parent_ids = array(); foreach ($cats as $cat_slug) { $cat_slug = trim($cat_slug); if ('-' == $cat_slug[0]) { // Negative categories = exclude those $parent = get_term_by('slug', $cat_slug, 'portfolio-category'); if ($parent) { $neg_parent_ids[] = $parent->term_id; } } else { // Positive categories $parent = get_term_by('slug', $cat_slug, 'portfolio-category'); if ($parent) { $parent_ids[] = $parent->term_id; } } } if (count($parent_ids) <= 0) { $t = array(); $t = get_terms('portfolio-category', array('parent' => 0, 'hide_empty' => 1, 'hierarchical' => 0, 'exclude' => $neg_parent_ids, 'exclude_tree' => $neg_parent_ids, 'taxonomy' => 'portfolio-category')); $terms = array_merge($terms, $t); } else { foreach ($parent_ids as $pid) { $t = array(); $t = get_terms('portfolio-category', array('parent' => $pid, 'hide_empty' => 1, 'hierarchical' => 0, 'exclude' => $neg_parent_ids, 'exclude_tree' => $neg_parent_ids, 'taxonomy' => 'portfolio-category')); $terms = array_merge($terms, $t); } } } else { $terms = get_terms('portfolio-category', array('parent' => 0, 'hide_empty' => 0, 'hierarchical' => 1, 'taxonomy' => 'portfolio-category')); } $count = count($terms); $i = 0; if ($count > 0) { if ('yes' == $sc_atts['animate_filter']) { $p_return .= '<ul class="list-button portfolio-filters">'; $p_return .= '<li><a href="#" data-filter="*">' . __('All', 'ishyoboy') . '</a></li>'; } else { $p_return .= '<ul class="list-button">'; } $term_list = ''; foreach ($terms as $term) { $i++; if ('yes' == $sc_atts['animate_filter']) { $term_list .= '<li><a href="' . get_term_link($term->slug, 'portfolio-category') . '" data-filter=".pfilt-' . $term->slug . '">' . $term->name . '</a></li>'; } else { $term_list .= '<li><a href="' . get_term_link($term->slug, 'portfolio-category') . '">' . $term->name . '</a></li>'; } } $p_return .= $term_list; $p_return .= '</ul>'; } } $thumb_size = 'theme-large'; $grid = 'grid3'; if (is_numeric($sc_atts['columns'])) { switch ($sc_atts['columns']) { case '4': $grid = 'grid3'; $thumb_size = 'theme-half'; break; case '3': $grid = 'grid4'; $thumb_size = 'theme-half'; break; case '2': $grid = 'grid6'; $thumb_size = 'theme-large'; break; case '1': $grid = 'grid12'; $thumb_size = 'theme-large'; break; case '5': $grid = 'grid2'; $thumb_size = 'theme-fourth'; break; case '6': $grid = 'grid2'; $thumb_size = 'theme-fourth'; break; default: $grid = 'grid3'; $thumb_size = 'theme-half'; } } $paged = 1; $pagin_type = 'pagination'; if ('yes' == $sc_atts['view_all'] && '' != $sc_atts['category']) { $pagin_type = 'view_all'; } if ('yes' == $sc_atts['pagination'] && '' == $sc_atts['category']) { $pagin_type = 'pagination'; } if ('pagination' == $pagin_type && 'yes' != $sc_atts['pagination']) { $pagin_type = ''; } if ('pagination' == $pagin_type && is_numeric($sc_atts['per_page']) && (int) $sc_atts['per_page'] > 0) { $sc_paginated_count++; if ($sc_paginated_count < 2) { if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } } } $order = 'ASC' == strtoupper($sc_atts['order']) ? 'ASC' : 'DESC'; // ASC OR DESC // Get all Portfolio posts $wpbp = new WP_Query(array('post_type' => 'portfolio-post', 'posts_per_page' => $sc_atts['per_page'], 'paged' => $paged, 'order' => $order, 'post_status' => 'publish', 'tax_query' => $tax_query)); if ($wpbp->have_posts()) { $portfolio_classes = ''; if ('yes' == $sc_atts['fluid_layout']) { $portfolio_classes .= ' portfolio-fluid'; } else { $portfolio_classes .= ' portfolio-fixed'; } if ('yes' == $sc_atts['animate_filter']) { $portfolio_classes .= ' anim-filter'; } else { $portfolio_classes .= ' noanim-filter'; } switch ($sc_atts['layout_style']) { case '2': $portfolio_classes .= ' portfolio-style-2'; break; case '3': $portfolio_classes .= ' portfolio-style-3'; break; case '4': $portfolio_classes .= ' portfolio-style-4'; break; default: $portfolio_classes .= ' portfolio-style-1'; break; } if ('1' == $sc_atts['masonry'] || 'yes' == $sc_atts['masonry']) { $p_return .= '<div class="row portfoliog masonry' . $portfolio_classes . '"><div class="mass_content">'; } else { $p_return .= '<div class="row portfoliog nomasonry' . $portfolio_classes . '">'; } while ($wpbp->have_posts()) { $wpbp->the_post(); $terms = get_the_terms(get_the_ID(), 'portfolio-category'); $p_return .= '<div class="portfolio-item ' . $grid; $p_return .= '' != $sc_atts['css_class'] ? ' ' . esc_attr($sc_atts['css_class']) : ''; if ('yes' == $sc_atts['animate_filter']) { if (isset($terms) && '' != $terms) { foreach ($terms as $term) { $p_return .= ' pfilt-' . esc_attr($term->slug); } } } $p_return .= 'center' == $sc_atts['align'] ? ' acenter' : ''; $p_return .= 'right' == $sc_atts['align'] ? ' aright' : ''; $p_return .= 'left' == $sc_atts['align'] ? ' aleft' : ''; $p_return .= '' != $sc_atts['tooltip'] && '' != $sc_atts['tooltip_color'] ? ' tooltip-' . esc_attr($sc_atts['tooltip_color']) : ''; $p_return .= '"'; $p_return .= '' != $sc_atts['id'] ? ' id="' . esc_attr($sc_atts['id']) . '"' : ''; $p_return .= '' != $sc_atts['style'] ? ' style="' . esc_attr($sc_atts['style']) . '"' : ''; $p_return .= '' != $sc_atts['tooltip'] ? ' data-type="tooltip" title="' . esc_attr($sc_atts['tooltip']) . '"' : ''; $p_return .= '>'; if ('3' == $sc_atts['layout_style']) { // TITLE if ('yes' == $sc_atts['show_title']) { $p_return .= '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; } // CATEGORIES if ('yes' == $sc_atts['show_categories']) { if (isset($terms) && '' != $terms) { $p_return .= '<ul class="icon-folder">'; foreach ($terms as $term) { $p_return .= '<li><a href="' . esc_attr(get_term_link($term)) . '">' . $term->name . '</a></li>' . "\n"; } $p_return .= '</ul>'; } } } if ('4' == $sc_atts['layout_style']) { // TITLE if ('yes' == $sc_atts['show_title']) { $p_return .= '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; } } if ('' != $sc_atts['height']) { $p_return .= ' <div class="hover-cont" style="max-height: ' . esc_attr($sc_atts['height']) . 'px;">'; } else { $p_return .= ' <div class="hover-cont">'; } if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { $p_return .= get_the_post_thumbnail(get_the_ID(), $thumb_size); } if ('1' != $sc_atts['layout_style'] && 'no' == $sc_atts['show_link_button'] && 'no' == $sc_atts['show_popup_button']) { $p_return .= '<div class="hover-overlay hover-empty">'; $p_return .= '<a href="' . get_permalink() . '" class="hover-full"><span><span class="icon-link"></span></span></a>'; } else { $p_return .= '<div class="hover-overlay">'; } if ('1' == $sc_atts['layout_style']) { // TITLE if ('yes' == $sc_atts['show_title']) { $p_return .= '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; } // CATEGORIES if ('yes' == $sc_atts['show_categories']) { if (isset($terms) && '' != $terms) { $p_return .= '<ul class="icon-folder">'; foreach ($terms as $term) { $p_return .= '<li><a href="' . esc_attr(get_term_link($term)) . '">' . $term->name . '</a></li>' . "\n"; } $p_return .= '</ul>'; } } } // BUTTONS if ('yes' == $sc_atts['show_link_button'] || 'yes' == $sc_atts['show_popup_button']) { $p_return .= '<div class="hover-links">'; // LINK BUTTON if ('yes' == $sc_atts['show_link_button']) { $p_return .= ' <a href="' . get_permalink() . '" class="ish-button-small icon-link"></a>'; } // POPUP BUTTON if ('yes' == $sc_atts['show_popup_button']) { $img_details = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); $p_return .= '<a href="' . esc_attr($img_details[0]) . '" rel="portfolio-sc-' . $sc_count . '" class="openfancybox-image ish-button-small icon-search-4"></a>'; } $p_return .= '</div>'; } $p_return .= '</div></div>'; if ('2' == $sc_atts['layout_style']) { // TITLE if ('yes' == $sc_atts['show_title']) { $p_return .= '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; } // CATEGORIES if ('yes' == $sc_atts['show_categories']) { if (isset($terms) && '' != $terms) { $p_return .= '<ul class="icon-folder">'; foreach ($terms as $term) { $p_return .= '<li><a href="' . esc_attr(get_term_link($term)) . '">' . $term->name . '</a></li>' . "\n"; } $p_return .= '</ul>'; } } } if ('4' == $sc_atts['layout_style']) { // CATEGORIES if ('yes' == $sc_atts['show_categories']) { if (isset($terms) && '' != $terms) { $p_return .= '<ul class="icon-folder">'; foreach ($terms as $term) { $p_return .= '<li><a href="' . esc_attr(get_term_link($term)) . '">' . $term->name . '</a></li>' . "\n"; } $p_return .= '</ul>'; } } } $p_return .= '</div>'; } if ('1' == $sc_atts['masonry'] || 'yes' == $sc_atts['masonry']) { // Close .mass_content $p_return .= '</div>'; } $p_return .= '</div>'; if ('view_all' == $pagin_type || $sc_paginated_count > 1) { // VIEW ALL PAGINATION if (isset($sc_atts['category']) && '' != $sc_atts['category']) { $all_cats = explode(',', $sc_atts['category']); $cats = array(); $neg_cas = array(); foreach ($all_cats as $cat_slug) { $cat_slug = trim($cat_slug); if ('-' != $cat_slug[0]) { // Positive categories $cat = get_term_by('slug', $cat_slug, 'portfolio-category'); if ($cat) { $cats[] = $cat; } } } if (count($cats) > 0) { $p_return .= '<div class="grid12 acenter"><a href="' . get_term_link($cats[0]) . '" class="ish-button-small color2">' . __('View all items', 'ishyoboy') . '</a></div>'; } } } elseif ('' == $pagin_type) { // NO PAGINATION } else { // NUMERIC PAGINATION if (isset($sc_atts['pagination']) && 'yes' == $sc_atts['pagination']) { $p_return .= ishyoboy_get_pagination('', 3, $wpbp->max_num_pages, $wpbp->query['paged']); } } } else { $p_return .= '<div class="box error close"><a href="#alert-close" class="icon-cancel-1"></a>'; $p_return .= ' <p>' . __("Sorry, there's nothing to display in here.", 'ishyoboy') . '</p>'; $p_return .= '</div>'; } $p_return .= '</div>'; wp_reset_query(); return $p_return; }