function widget($args, $instance) { extract($args); $yit_portfolio = yit_portfolios(); /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title']); $project_fx = isset($instance['project_fx']) ? $instance['project_fx'] : false; $project_easing_fx = isset($instance['project_easing_fx']) ? $instance['project_easing_fx'] : false; $project_speed_fx = isset($instance['project_speed_fx']) ? $instance['project_speed_fx'] : false; $project_timeout_fx = isset($instance['project_timeout_fx']) ? $instance['project_timeout_fx'] : false; $project_n_items = isset($instance['project_n_items']) ? $instance['project_n_items'] : 5; $project_post_types = isset($instance['project_post_type']) ? $instance['project_post_type'] : 'portfolio'; global $more; $more = 0; $post_type = $project_post_types; if ($project_post_types) { foreach ($yit_portfolio as $portfolio) { if ($portfolio->ID == $project_post_types) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<div class="featured-projects-widget flexslider">'; echo '<ul class="slides">'; yit_set_portfolio_loop($portfolio->ID); $i = 0; $categories = yit_portfolio_get_setting('categories', $portfolio->ID); $portfolios = yit_portfolio_get_setting('items', $portfolio->ID); foreach ($portfolios as $item_id => $item) { $post_permalink = yit_work_permalink($item_id); echo '<li>'; echo '<div class="thumb-project">'; echo "<a href='" . $post_permalink . "'>"; yit_image("id={$item_id}&size=featured_project_thumb"); //echo wp_get_attachment_image( $item_id, 'featured_project_thumb' ); echo '</a></div>'; echo '<h4>' . $item['title'] . '</h4>'; echo '<p class="categories">'; $str_categories = ''; $terms = isset($item['terms']) ? $item['terms'] : array(); foreach ($terms as $name) { $str_categories .= "<a href='" . yit_term_link($name) . "'>{$categories[$name]}</a>, "; } echo substr($str_categories, 0, strlen($str_categories) - 2); echo '</p>'; echo '</li>'; if (++$i == $project_n_items) { break; } } echo '</ul>'; echo '</div>'; $script = "<script type=\"text/javascript\">\n\t\t jQuery(document).ready(function(\$){\n\t\t \tvar animation = \$.browser.msie || \$.browser.opera ? 'fade' : '{$project_fx}';\n\t\t \$('.featured-projects-widget').flexslider({\n\t\t animation: animation,\n\t\t slideshowSpeed: {$project_timeout_fx},\n\t\t animationSpeed: {$project_speed_fx},\n\t\t selectors: 'ul > li',\n\t\t directionNav: true,\n\t\t slideshow: true,\n\n\t\t\t\t\t\t pauseOnAction: false,\n\t\t\t\t\t\t controlNav: false,\n\t\t\t\t\t\t touch: true\n\t\t });\n\t\t });\n\t\t </script>"; echo $script; echo $after_widget; } } } }
} ?> <?php } ?> <div class="portfolio-projects row"> <?php /*$var['posts_per_page'] = $items; yit_get_model( 'portfolio' )->shortcode_atts = $var; yit_debug($var); yit_set_portfolio_loop( $portfolio );*/ ?> <?php yit_set_portfolio_loop($portfolio); ?> <?php while (yit_have_works()) { if (yit_work_get('item_id') != $item_selected) { ?> <?php $image_id = yit_work_get('item_id'); $video_url = yit_work_get('video_url'); $show_categories = $show_categories == 1 || $show_categories == "yes"; $terms = yit_work_get('terms'); $categories = yit_work_get('categories'); $str_categories = ''; if (!empty($terms)) { foreach ($terms as $name) { $str_categories .= "<a href='" . yit_term_link($name) . "'>{$categories[$name]}</a>, ";
function widget($args, $instance) { $yit_portfolio = yit_portfolios(); extract($args); $project_speed_fx = isset($instance['project_speed_fx']) ? $instance['project_speed_fx'] : false; $project_n_items = isset($instance['project_n_items']) ? $instance['project_n_items'] : 5; $project_post_types = isset($instance['project_post_type']) ? $instance['project_post_type'] : false; /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title']); //if ( ! $project_post_types || empty( $project_post_types ) ) // $post_type = get_post_meta( get_the_ID(), '_portfolio_post_type', true ); //else $post_type = $project_post_types; //if ( empty( $post_type ) ) // $post_type = get_post_type(); //$portfolio_tax = sanitize_title( $yit_portfolio[$post_type]['tax'] ); global $more; $more = 0; if ($project_post_types) { foreach ($yit_portfolio as $portfolio) { if ($portfolio->ID == $project_post_types) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $categories = yit_portfolio_get_setting('categories', $portfolio->ID); $portfolios = yit_portfolio_get_setting('items', $portfolio->ID); $is_slider = count($portfolios) > 1 ? true : false; echo '<div class="more-projects-widget">'; if ($is_slider) { echo '<div class="top">'; echo '<a class="prev" href="#">Prev</a>'; echo '</div>'; } echo '<div class="sliderWrap">'; echo '<ul>'; //loop yit_set_portfolio_loop($portfolio->ID); foreach ($portfolios as $item_id => $item) { $post_permalink = yit_work_permalink($item_id); list($thumbnail_url, $thumbnail_width, $thumbnail_height) = wp_get_attachment_image_src($item_id, 'blog_thumb'); echo '<li class="work-item group">'; echo '<a class="work-thumb" href="' . $post_permalink . '">'; echo wp_get_attachment_image($item_id, 'blog_thumb'); echo '</a>'; echo '<a class="meta work-title" href="' . $post_permalink . '">' . $item['title'] . '</a>'; echo '<p class="meta categories">'; $str_categories = ''; $terms = isset($item['terms']) ? $item['terms'] : array(); foreach ($terms as $name) { $str_categories .= "<a href='" . yit_term_link($name) . "'>{$categories[$name]}</a>, "; } echo substr($str_categories, 0, strlen($str_categories) - 2); echo '</p>'; echo '</li>'; } echo '</ul>'; echo '</div>'; if ($is_slider) { echo '<div class="controls">'; echo '<a class="next" href="#">Next</a>'; echo '</div>'; } echo '</div>'; if ($is_slider) { $script = "<script type=\"text/javascript\">\n \t\t jQuery(document).ready(function(\$){\n \t\t var slider_wrap = \$('.more-projects-widget');\n \t\t var height_item = \$('li', slider_wrap).outerHeight();\n \t\t var height_ul = \$('ul', slider_wrap).height();\n \t\t var height_wrap = \$('.sliderWrap', slider_wrap).height();\n \t\t var n_items = \$('li', slider_wrap).length;\n \t\t var visible = {$project_n_items};\n \t\t\n \t\t \$('.controls, .top', slider_wrap).show();\n \t\t\n \t\t // adjust height, according to visible item\n \t\t \$('.sliderWrap', slider_wrap).css('height', height_item * visible - 6);\n \t\t\n \t\t function check_position() { \n \t\t var margin_top_ul = \$('ul', slider_wrap).css('margin-top');\n \t\t var max_offset = ( n_items - visible ) * height_item * -1;\n \t\t\n \t\t if ( margin_top_ul == '0px' ) {\n \t\t \$('.prev', slider_wrap).addClass('disabled');\n \t\t }\n \t\t\n \t\t if ( margin_top_ul == max_offset+'px' ) {\n \t\t \$('.next', slider_wrap).addClass('disabled');\n \t\t }\n \t\t }\n \t\t\n \t\t check_position();\n \t\t\n \t\t \$('.next:not(.disabled)', slider_wrap).live('click',function(){\n \t\t \$('ul', slider_wrap).animate( {marginTop:'-='+height_item}, {$project_speed_fx}, function(){ check_position(); } );\n \t\t \$('.prev', slider_wrap).removeClass('disabled');\n \t\t return false;\n \t\t });\n \t\t\n \t\t \$('.prev:not(.disabled)', slider_wrap).live('click',function(){\n \t\t \$('ul', slider_wrap).animate( {marginTop:'+='+height_item}, {$project_speed_fx}, function(){ check_position(); } );\n \t\t \$('.next', slider_wrap).removeClass('disabled');\n \t\t return false;\n \t\t });\n \t\t\n \t\t \$('.disabled', slider_wrap).live('click', function(){\n \t\t return false;\n \t\t });\n \t\t });\n \t\t </script>"; echo $script; } echo $after_widget; break; } } } }
function widget( $args, $instance ) { extract( $args ); $yit_portfolio = yit_portfolios(); /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title'] ); $project_fx = isset( $instance['project_fx']) ? $instance['project_fx'] : false; $project_easing_fx = isset( $instance['project_easing_fx']) ? $instance['project_easing_fx'] : false; $project_speed_fx = isset( $instance['project_speed_fx']) ? $instance['project_speed_fx'] : false; $project_timeout_fx = isset( $instance['project_timeout_fx']) ? $instance['project_timeout_fx'] : false; $project_n_items = isset( $instance['project_n_items']) ? $instance['project_n_items'] : 5; $project_post_types = isset( $instance['project_post_type']) ? $instance['project_post_type'] : 'portfolio'; global $more; $more = 0; $post_type = $project_post_types; if( $project_post_types ) { foreach( $yit_portfolio as $portfolio ) { if($portfolio->ID == $project_post_types) { echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; echo '<div class="featured-projects-widget flexslider">'; echo '<ul class="slides">'; yit_set_portfolio_loop( $portfolio->ID ); $i = 0; $categories = yit_portfolio_get_setting( 'categories', $portfolio->ID ); $portfolios = yit_portfolio_get_setting( 'items', $portfolio->ID ); foreach( $portfolios as $item_id => $item ) { $post_permalink = yit_work_permalink( $item_id ); list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $item_id, 'featured_project_thumb' ); echo '<li>'; echo '<div class="thumb-project">'; echo "<a href='". $post_permalink ."'>"; echo wp_get_attachment_image( $item_id, 'featured_project_thumb' ); echo '</a></div>'; echo '<h4>' . $item['title'] . '</h4>'; echo '</li>'; if( ++$i == $project_n_items ) break; } echo '</ul>'; echo '</div>'; $script = "<script type=\"text/javascript\"> jQuery(document).ready(function($){ var animation = $.browser.msie || $.browser.opera ? 'fade' : '$project_fx'; $('.featured-projects-widget').flexslider({ animation: animation, slideshowSpeed: $project_timeout_fx, animationSpeed: $project_speed_fx, selectors: 'ul > li', directionNav: true, slideshow: true, pauseOnAction: false, controlNav: false, touch: true }); }); </script>"; echo $script; echo $after_widget; } } } }
$i = 0; ?> <h3><?php yit_work_the('other_projects_label'); ?> </h3> <div class="portfolio-<?php echo $portfolio_type; ?> -related-projects"> <?php $vars = yit_portfolio_query_vars(); $var['posts_per_page'] = yit_work_get('detail_nitems') ? yit_work_get('detail_nitems') : -1; yit_get_model('portfolio')->shortcode_atts = $var; yit_set_portfolio_loop($vars->post_id * 1); ?> <?php while (yit_have_works()) { ?> <?php list($thumbnail_url, $thumbnail_width, $thumbnail_height) = wp_get_attachment_image_src(yit_work_get('item_id'), 'thumb_portfolio_fulldesc_related'); ?> <?php $post_permalink = yit_work_permalink(yit_work_get('item_id')); ?> <?php $title = yit_work_get('title'); ?> <div class="<?php
function widget($args, $instance) { $yit_portfolio = yit_portfolios(); extract($args); $project_n_items = isset($instance['items']) ? $instance['items'] : 6; $project_post_types = isset($instance['project_post_type']) ? $instance['project_post_type'] : false; /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title']); global $more; $more = 0; if ($project_post_types) { foreach ($yit_portfolio as $portfolio) { if ($portfolio->ID == $project_post_types) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $portfolios = yit_portfolio_get_setting('items', $portfolio->ID); echo '<div class="portfolio-gallery-widget group">'; echo '<ul>'; //loop yit_set_portfolio_loop($portfolio->ID); $i = 0; foreach ($portfolios as $item_id => $item) { $post_permalink = yit_work_permalink($item_id); echo '<li class="work-item group">'; echo '<a class="work-thumb" href="' . $post_permalink . '">'; yit_image("id={$item_id}&size=portfolio_gallery_thumb"); echo '</a>'; echo '</li>'; if (++$i == $project_n_items) { break; } } echo '</ul>'; echo '</div>'; echo $after_widget; break; } } } }