if ($show_content == 1) { ?> <div class="entry-content<?php if ($show_title == 0) { echo ' margin-15t'; } ?> " itemprop="articleBody"> <?php if ($excerpt_function == 'Content') { the_content(__('Continue reading <span class="meta-nav">→</span>', 'color-theme-framework')); } elseif ($excerpt_function == 'Excerpt') { if ($mb_excerpt_length != '0') { ct_excerpt_max_charlength($mb_excerpt_length); } else { ct_excerpt_max_charlength($excerpt_length); } ?> <?php } ?> </div> <!-- /entry-content --> <?php } ?> <?php if ($show_categories == 1 or $show_author == 1) { ?> <div class="entry-meta clearfix<?php
function widget($args, $instance) { extract($args); global $ct_options, $post; $title = $instance['title']; $categories = $instance['categories']; $posts = $instance['posts']; $show_likes = isset($instance['show_likes']) ? 'true' : 'false'; $show_comments = isset($instance['show_comments']) ? 'true' : 'false'; $show_views = isset($instance['show_views']) ? 'true' : 'false'; $show_date = isset($instance['show_date']) ? 'true' : 'false'; $show_related = isset($instance['show_related']) ? 'true' : 'false'; $show_random = isset($instance['show_random']) ? 'true' : 'false'; $animation_speed = $instance['animation_speed']; $slideshow_speed = $instance['slideshow_speed']; $slideshow = isset($instance['slideshow']) ? 'true' : 'false'; $animation_type = $instance['animation_type']; ?> <?php /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo "\n<!-- START SMALL SLIDER WIDGET -->\n"; echo $before_title . $title . $after_title; } else { echo "\n<!-- START SMALL SLIDER WIDGET -->\n"; } ?> <?php $time_id = rand(); $orderby = 'date'; if ($show_random == 'true') { $orderby = 'rand'; } if ($show_related == 'true') { //show related category $related_category = get_the_category($post->ID); $related_category_id = get_cat_ID($related_category[0]->cat_name); $slider_posts = new WP_Query(array('orderby' => $orderby, 'showposts' => $posts, 'post_type' => 'post', 'cat' => $related_category_id, 'post__not_in' => array($post->ID), 'ignore_sticky_posts' => 1)); } else { $slider_posts = new WP_Query(array('orderby' => $orderby, 'showposts' => $posts, 'post_type' => 'post', 'cat' => $categories, 'ignore_sticky_posts' => 1)); } if (!is_admin()) { /* Flex Slider */ wp_register_script('flex-min-jquery', get_template_directory_uri() . '/js/jquery.flexslider-min.js', false, null, true); wp_enqueue_script('flex-min-jquery', array('jquery')); } if ($slider_posts->have_posts()) { ?> <script type="text/javascript"> /* <![CDATA[ */ jQuery.noConflict()(function($){ "use strict"; $(window).load(function() { $(".slider-preloader").css("display","none"); $('#slider-<?php echo $time_id; ?> ').flexslider({ animation:"<?php echo $animation_type; ?> ", controlNav:false, animationLoop:true, slideshow:<?php echo $slideshow; ?> , smoothHeight:true, slideshowSpeed:<?php echo $slideshow_speed; ?> , animationSpeed:<?php echo $animation_speed; ?> , }); }); }); /* ]]> */ </script> <div id="slider-<?php echo $time_id; ?> " class="small-slider flex-main flexslider"> <ul class="slides"> <?php while ($slider_posts->have_posts()) { $slider_posts->the_post(); ?> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'single-post-thumb-crop'); ?> <li> <a href="<?php the_permalink(); ?> "><img src="<?php echo $image[0]; ?> " alt="" /></a> <!-- title --> <div class="post-title"> <h5><a href='<?php the_permalink(); ?> ' title='<?php _e('Permalink to ', 'color-theme-framework'); the_title(); ?> '><?php the_title(); ?> </a></h5> </div><!-- post-title --> <?php if ($show_date == 'true') { ?> <div class="entry-date"><?php echo esc_attr(get_the_date('M j, Y')); ?> </div> <?php } ?> <?php ct_excerpt_max_charlength(100); ?> <div class="clear"></div> <div class="divider-1px-meta"></div> <footer class="entry-extra clearfix"> <?php global $post; if ($show_comments == 'true') { $show_comments = 1; } if ($show_views == 'true') { $show_views = 1; } if ($show_likes == 'true') { $show_likes = 1; } ?> <?php ct_get_post_meta($post->ID, $show_comments, $show_views, $show_likes); ?> </footer><!-- .meta --> </li> <?php } ?> <?php } ?> </ul><!-- slides --> </div><!-- slider --> <?php } else { echo __('No related posts were found', 'color-theme-framework'); } // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); /* After widget (defined by themes). */ echo $after_widget; echo "\n<!-- END SMALL SLIDER WIDGET -->\n"; }