function widget($args, $instance) { $cache = wp_cache_get('widget_random_work_item', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); echo $before_widget; $title = apply_filters('widget_title', empty($instance['title']) ? __('Random Work', "framework") : $instance['title'], $instance, $this->id_base); global $wpdb; global $query_string; $args = array('numberposts' => 1, 'posts_per_page' => 3, 'meta_query' => array(array('key' => '_thumbnail_id')), 'offset' => 0, 'cat' => '', 'orderby' => 'rand', 'order' => '', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'portfolio', 'post_mime_type' => '', 'post_parent' => '', 'paged' => 1, 'post_status' => 'publish'); $the_query = new WP_Query($args); if ($the_query->have_posts()) { ?> <?php echo $before_title . $title . $after_title; ?> <?php while ($the_query->have_posts()) { ?> <?php $the_query->the_post(); ?> <?php if (has_post_thumbnail()) { ?> <div class='widget-random-work'> <a href="<?php the_permalink(); ?> " title="<?php esc_attr_e(get_the_title()); ?> "><?php ts_the_resized_post_thumbnail('sidebar-work'); ?> </a> </div> <?php break; ?> <?php } ?> <?php } ?> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } //have_posts() echo $after_widget; $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_random_work_item', $cache, 'widget'); }
<span></span> <span class='tran03slinear'></span> <span></span> </a> <a class='next' href="#" id="portfolio-gallery-next"> <span></span> <span class='tran03slinear'></span> <span></span> </a> </div> </div> <?php } else { ?> <?php ts_the_resized_post_thumbnail('portfolio-single', get_the_title()); ?> <div class='facilities visible-on-hover'> <a class='image-link' rel="prettyPhoto" title="<?php esc_attr_e(get_the_title()); ?> " href="<?php echo $image_src; ?> "><span class='zoom'></span></a> </div> <?php } ?> </div> </div>
?> '> <div class='container-t1'> <div class='container-t1-margin'> <header class='visible-on-hover'> <h2><?php the_title(); ?> </h2> <h3><?php echo implode(' ', $term_names); ?> </h3> </header> <?php ts_the_resized_post_thumbnail($template_portfolio_columns_size, get_the_title()); ?> <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', true); ?> <div class='facilities visible-on-hover'> <div class='bg-black-045'></div> <div class='image-links'> <a rel="<?php echo $rel; ?> " title="<?php esc_attr_e($title); ?> " href="<?php echo $prettyPhotoContent;