public function widget($args, $instance) { extract($args); // Before Widget echo PHP_EOL . $before_widget; // Display Title $title = apply_filters('widget_title', empty($instance['title']) ? 'Tweets' : $instance['title'], $instance, $this->id_base); if ($title) { echo PHP_EOL . $before_title . $title . $after_title . PHP_EOL; } # Cache Timeout $cache_timeout = 600; # 10 minutes # Items Count $items_count = $instance['items_count']; # Items array (cached) $portfolio_items = get_transient('laborator_portfolio_latest_items'); # Ordering $order_by = $instance['order_by']; $order_type = $instance['order_type'] == 'ASC' ? 'ASC' : 'DESC'; if (!$portfolio_items) { $items_count = $items_count > 0 ? $items_count : 24; $portfolio_items = get_posts(array('post_type' => 'portfolio', 'posts_per_page' => $items_count, 'orderby' => 'date', 'order' => $order_type)); foreach ($portfolio_items as $portfolio_item) { $portfolio_item->views = get_portfolio_item_views($portfolio_item->ID, TRUE); $portfolio_item->likes = get_portfolio_item_likes($portfolio_item->ID, TRUE); } define('LABORATOR_PL_ORDER_TYPE', $order_type); if ($order_by == 'views') { uasort($portfolio_items, array(&$this, 'order_by_views')); } elseif ($order_by == 'likes') { uasort($portfolio_items, array(&$this, 'order_by_likes')); } set_transient('laborator_portfolio_latest_items', $portfolio_items, $cache_timeout); } ?> <div class="portfolio_sneakpeak"> <?php foreach ($portfolio_items as $portfolio_item) { ?> <a href="<?php echo get_permalink($portfolio_item->ID); ?> " class="portfolio_small_item"><?php echo laborator_show_img($portfolio_item->ID, 'min-thumb'); ?> </a> <?php } ?> </div> <?php // After Widget echo $after_widget . PHP_EOL; }
</div> <!-- end: album details --> </div> <!-- end: showing image & album info --> <!-- gallery items --> <div class="gallery_items" id="an_gallery"> <?php # Browse Images foreach ($gallery_images as $gallery_image) { $attachment_id = $gallery_image->ID; $large_image = $gallery_image->guid; $small_image = laborator_show_img($large_image, 'gallery-list-thumb'); $medium_image = laborator_img($large_image, 'gallery-big-img'); ?> <!-- image entry --> <a href="<?php echo $medium_image; ?> " data-large="<?php echo $large_image; ?> " class="gallery_item"> <?php echo $small_image; ?> </a> <!-- end: image entry -->
<div <?php post_class('blog_post'); ?> > <?php if (has_post_thumbnail($post_id) && $show_post_thumbnails) { $has_thumb = TRUE; ?> <!-- post image --> <a href="<?php the_permalink(); ?> " class="image hover"> <?php echo laborator_show_img($post_id, 'post-thumb-middle'); ?> </a> <?php } else { ?> <div class="no_post_image_2"></div> <?php } ?> <!-- post date (do not remove .ribbon) --> <div class="date<?php echo !$has_thumb ? ' no_thumbnail_2' : ''; ?> ">
post_class('blog_post'); ?> > <?php if (has_post_thumbnail($post_id) && $show_post_thumbnails) { $has_thumb = TRUE; ?> <!-- post image --> <a href="<?php the_permalink(); ?> " class="image hover"> <?php if ($show_post_thumbnails) { echo laborator_show_img($post_id, 'post-thumb-big'); } ?> </a> <?php } else { ?> <div class="no_post_image"></div> <?php } ?> <!-- post date (do not remove .ribbon) --> <div class="date<?php echo !$has_thumb ? ' no_thumbnail' : ''; ?>
$rel .= ';width=700;height=450'; } ?> <!-- post image --> <a href="<?php echo $href; ?> " class="image hover" rel="<?php echo $rel; ?> " title="<?php echo esc_attr(get_the_title()); ?> "> <?php echo laborator_show_img($post_id, 'post-thumb-single'); ?> </a> <?php } else { ?> <div class="no_post_image"></div> <?php } ?> <!-- post date (do not remove .ribbon) --> <div class="date<?php echo !$has_thumb ? ' no_thumbnail' : ''; ?> ">