function _print_column_portfolio_lists($count, $catID) { $content = ""; $args = array('post_type' => 'portfolio-item', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'paged' => false); if ($catID && $catID != "" && $catID !== 0) { $args['tax_query'] = array(array('taxonomy' => 'portfolio-category', 'field' => 'id', 'terms' => intval($catID), 'operator' => 'IN')); } $pQuery = new WP_Query($args); if ($pQuery->have_posts()) { $content .= '<div class="col_wraper no_margin">' . "\n"; $intloop = 0; while ($pQuery->have_posts()) { $pQuery->the_post(); $intloop++; global $post; $specialStyle = ""; if ($intloop == 1 || $intloop % 3 == 1) { $specialStyle = " no_margin_left"; } if ($intloop % 3 == 0) { $specialStyle = " no_margin_right"; } $imgArray = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 220, 168, true) : ''; $colImage = is_array($imgArray) ? $imgArray['url'] : get_template_directory_uri() . '/images/no-preview.jpg'; $colImageGrayscale = is_array($imgArray) && isset($imgArray['path']) ? wip_print_grayscale_autoresize($imgArray['path'], $imgArray['url']) : ''; $content .= '<div class="col_four float_left' . $specialStyle . '">' . "\n"; $content .= '<div class="portfolio-thumbnail">' . "\n"; $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . "\n"; $content .= '<img class="portfolio-grayscale" src="' . $colImageGrayscale . '" alt="' . the_title_attribute('echo=0') . '"/>'; $content .= '<img class="portfolio-original" src="' . $colImage . '" alt="' . the_title_attribute('echo=0') . '"/>'; $content .= '</a>' . "\n"; $content .= '</div>' . "\n"; $content .= '<h3 class="portfolio-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . get_the_title() . '</a></h3>' . "\n"; if ($post->post_excerpt) { $content .= wpautop(wptexturize($post->post_excerpt)); } $content .= '</div>' . "\n"; if ($intloop % 3 == 0) { $content .= '<div class="clear"></div>' . "\n"; } } if ($intloop % 3 != 0) { $content .= '<div class="clear"></div>' . "\n"; } $content .= '</div><!-- end .col_wraper -->' . "\n"; } else { $content .= __('No Posts Found!', 'wip'); } wp_reset_postdata(); return $content; }
/** * Show latest portfolio thumbnail! */ function wipfr_latest_portfolio_thumbnail($count, $catID = 0) { $return = '<ul class="latest_portfolio_thumbnail">' . "\n"; $args = array('post_type' => 'portfolio-item', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'paged' => false); if ($catID && $catID != "" && $catID !== 0) { $args['tax_query'] = array(array('taxonomy' => 'portfolio-category', 'field' => 'id', 'terms' => intval($catID), 'operator' => 'IN')); } $pQuery = new WP_Query($args); if ($pQuery->have_posts()) { while ($pQuery->have_posts()) { $pQuery->the_post(); global $post; $imgArray = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 85, 85, true) : ''; $colImage = is_array($imgArray) ? $imgArray['url'] : get_template_directory_uri() . '/images/default-portfolio-85x85.jpg'; $colImageGrayscale = is_array($imgArray) && isset($imgArray['path']) ? wip_print_grayscale_autoresize($imgArray['path'], $imgArray['url']) : ''; $return .= '<li class="portfolio_widget_item">' . "\n"; $return .= '<a class="portfolio_widget_thumbnail" href="' . get_permalink($post->ID) . '" title="' . the_title_attribute('echo=0') . '">' . "\n"; $return .= '<img class="portfolio_widget_thumbnail_gray" src="' . $colImageGrayscale . '" alt="' . the_title_attribute('echo=0') . '" />'; $return .= '<img class="portfolio_widget_thumbnail_default" src="' . $colImage . '" alt="' . the_title_attribute('echo=0') . '" />'; $return .= '</a>' . "\n"; $return .= '</li>' . "\n"; } } else { } wp_reset_postdata(); $return .= '</ul>' . "\n"; $return .= '<div class="clear"></div>' . "\n"; return $return; }
<div id="portfolio-related"> <h2><span><?php _e('Related Projects', 'wip'); ?> </span></h2> <div class="col_wraper no_margin"> <?php $intloop = 0; while (have_posts()) { the_post(); $intloop++; global $post; $imgArray = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 220, 168, true) : ''; $colImage = is_array($imgArray) ? $imgArray['url'] : get_template_directory_uri() . '/images/no-preview.jpg'; $colImageGrayscale = is_array($imgArray) && isset($imgArray['path']) ? wip_print_grayscale_autoresize($imgArray['path'], $imgArray['url']) : ''; $specialStyle = ""; if ($intloop == 1 || $intloop % 4 == 1) { $specialStyle = " no_margin_left"; } if ($intloop % 4 == 0) { $specialStyle = " no_margin_right"; } ?> <div class="col_four float_left<?php echo $specialStyle; ?> "> <div class="portfolio-thumbnail"> <a href="<?php