function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base); if (!($number = absint($instance['number']))) { $number = 4; } if (!($cats = $instance["cats"])) { $cats = ''; } // array to call recent posts. $themeloy_args = array('showposts' => $number, 'category__in' => $cats); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); echo $before_widget; // Widget title echo $before_title; echo $instance["title"]; echo $after_title; // Post list in widget $i = 0; ?> <div class="widget_container"> <?php while ($themeloy_widget->have_posts()) { $themeloy_widget->the_post(); $post_id = get_the_ID(); $i++; $thumb = themeloy_get_thumbnail(get_the_ID()); if ($i == 1) { ?> <div class="main_post"> <div class="image_post feature-item"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'main-square'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/main-square.jpg' . '">'; } ?> </a> <span class="caption"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider">'; echo the_category(', ') . '</p>'; } ?> <a href="<?php the_permalink(); ?> "> <span><?php the_title(); ?> </span></a> </span> <?php echo themeloy_post_type(); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> <?php echo themeloy_post_meta(get_the_ID()); ?> <p> <?php echo themeloy_short_title(300, get_the_excerpt('')); ?> </p> </div> <div class="list_post_vertical"> <ul> <?php } else { ?> <li> <?php $post_date = get_post_custom_values('date_themeloy_select', get_the_ID()); $post_date = $post_date[0] != '' ? $post_date[0] : of_get_option('blog_date_post'); if ($post_date == '1') { ?> <div class="feature_post_style"> <span class="post_date"><span class="date_number"><?php echo get_the_date('d'); ?> </span> <?php echo get_the_date('M'); ?> <i class="icon-caret-right feature-icon-right"></i> </span> <span class="post_time"><i class="icon-time"></i> <?php echo get_the_time('H:i'); ?> </span> </div> <?php } ?> <div class="feature-link feature-item"> <a href="<?php the_permalink(); ?> " class="feature-link"> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'medium-feature'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/medium-feature.jpg' . '">'; } ?> </a> <?php echo themeloy_post_type(); ?> </div> <div class="list_desc"> <h4 class="list_title"><a class="post-title" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "> <?php the_title(); ?> </a></h4> <?php echo themeloy_feature_post_meta(get_the_ID()); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> <div class="clear"></div> </li> <?php } } ?> </ul> </div> </div> <?php wp_reset_query(); echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); if (!($number = absint($instance['number']))) { $number = 5; } if (!($cats = $instance["cats"])) { $cats = ''; } $themeloy_args = array('showposts' => $number, 'category__in' => $cats); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); echo $before_widget; // Widget title if ($title == "") { } else { echo $before_title; echo $title; echo $after_title; } // Post list in widget echo '<div class="widget_container"> <ul>'; while ($themeloy_widget->have_posts()) { $themeloy_widget->the_post(); $post_id = get_the_ID(); ?> <li class="feature-postslider-item ajax_block_post"> <div class="entry-thumb"> <?php echo ' <a class="feature-link" href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">'; ?> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'feature-large'); ?> <img class="cat-feature-large-img" src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img class="cat-feature-large-img" src="' . get_template_directory_uri() . '/images/demo/feature-large.jpg' . '">'; } ?> <?php echo '</a>'; ?> <div class="cat-feature-large"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider feature">'; echo the_category(', ') . '</p>'; } ?> </div> </div> <div class="ulpost_title"> <a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent link to <?php the_title_attribute(); ?> "> <?php the_title(); ?> </a> <div class="carousel-bottom"> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> <div class="clear"></div> </div> </div> <div class="post-info"> <h5 class="title_block"><a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent link to <?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h5> <div class="post_desc"> <p><?php echo themeloy_short_title(220, get_the_excerpt('')); ?> </p> </div> <?php echo themeloy_post_type(); ?> </div> </li> <?php } wp_reset_query(); echo "</ul></div>"; echo $after_widget; }
<h3><a class="title" href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " /><?php the_title(); ?> </a></h3> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php echo themeloy_short_title(200, get_the_excerpt('')); ?> <div class="clear"></div> </div> <?php } ?> <div class="clear"></div> <?php themeloy_pagination_template('', 2, $query); ?>
function block($instance) { extract($instance); $titles = apply_filters('widget_title', empty($instance['titles']) ? 'Recent Posts' : $instance['titles'], $instance, $this->id_base); $title1 = apply_filters('widget_title', empty($instance['title1']) ? 'Recent Posts' : $instance['title1'], $instance, $this->id_base); if (!($number_show = absint($instance['number_show']))) { $number_show = 5; } if (!isset($instance["cats"])) { $cats = ''; } if (!isset($instance["cats1"])) { $cats1 = ''; } // array to call recent posts. $themeloy_args = array('showposts' => $number_show, 'category__in' => $cats); $themeloy_args1 = array('showposts' => $number_show, 'category__in' => $cats1); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); echo '<div class="widget two_columns_post">'; $i = 0; while ($themeloy_widget->have_posts()) { $themeloy_widget->the_post(); $i++; $post_id = get_the_ID(); if ($i == 1) { ?> <div class="main-post-col1"> <?php if (!empty($instance['titles'])) { ?> <h3 class="widget-title"><span><?php echo $instance["titles"]; ?> </span></h3><?php } ?> <div class="two-content-wrapper"> <div class="image_review_wrapper"> <div class="entry-thumb feature-item"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'feature-large'); ?> <img class="cat-feature-large-img" src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img class="cat-feature-large-img" src="' . get_template_directory_uri() . '/images/demo/feature-large.jpg' . '">'; } ?> </a> <div class="cat-feature-large"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider">'; echo the_category(', ') . '</p>'; } ?> </div> <?php echo themeloy_post_type(); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> </div> <div class="feature-text-col"> <div class="post-title"><h3><a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php the_title(); ?> </a></h3></div> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php echo themeloy_short_title(190, get_the_excerpt()); ?> </div> <?php } else { ?> <div class="small-feature"> <?php $post_date = get_post_custom_values('date_themeloy_select', get_the_ID()); $post_date = $post_date[0] != '' ? $post_date[0] : of_get_option('blog_date_post'); if ($post_date == '1') { ?> <div class="feature_post_style"> <span class="post_date"><span class="date_number"><?php echo get_the_date('d'); ?> </span> <?php echo get_the_date('M'); ?> <i class="icon-caret-right feature-icon-right"></i> </span> <span class="post_time"><i class="icon-time"></i> <?php echo get_the_time('H:i'); ?> </span> </div> <?php } ?> <div class="feature-link feature-item"> <a href="<?php the_permalink(); ?> " class="feature-link"> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'medium-feature'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/medium-feature.jpg' . '">'; } ?> </a> <?php echo themeloy_post_type(); ?> </div> <div class="feature-text"> <div class="post-title"><h4 class="list_title"> <a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php the_title(); ?> </a></h4></div> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> <div class="clear"></div> </div> </div> <?php } } ?> </div> </div> <?php wp_reset_query(); // column right $themeloy_widget1 = null; $themeloy_widget1 = new WP_Query($themeloy_args1); $i = 0; while ($themeloy_widget1->have_posts()) { $themeloy_widget1->the_post(); $i++; $post_id = get_the_ID(); $thumb = themeloy_get_thumbnail(get_the_ID()); if ($i == 1) { ?> <div class="main-post-col2"> <?php if (!empty($instance['title1'])) { ?> <h3 class="widget-title"><span><?php echo $instance["title1"]; ?> </span></h3><?php } ?> <div class="two-content-wrapper"> <div class="image_review_wrapper"> <div class="entry-thumb feature-item"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'feature-large'); ?> <img class="cat-feature-large-img" src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img class="cat-feature-large-img" src="' . get_template_directory_uri() . '/images/demo/feature-large.jpg' . '">'; } ?> </a> <div class="cat-feature-large"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider">'; echo the_category(', ') . '</p>'; } ?> </div> <?php echo themeloy_post_type(); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> </div> <div class="feature-text-col"> <div class="post-title"><h3><a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php the_title(); ?> </a></h3></div> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php echo themeloy_short_title(190, get_the_excerpt()); ?> </div> <?php } else { $date = '<span class="date">' . get_the_date('M d, Y') . '</span>'; ?> <div class="small-feature"> <?php $post_date = get_post_custom_values('date_themeloy_select', get_the_ID()); $post_date = $post_date[0] != '' ? $post_date[0] : of_get_option('blog_date_post'); if ($post_date == '1') { ?> <div class="feature_post_style"> <span class="post_date"><span class="date_number"><?php echo get_the_date('d'); ?> </span> <?php echo get_the_date('M'); ?> <i class="icon-caret-right feature-icon-right"></i> </span> <span class="post_time"><i class="icon-time"></i> <?php echo get_the_time('H:i'); ?> </span> </div> <?php } ?> <div class="feature-link feature-item"> <a href="<?php the_permalink(); ?> " class="feature-link"> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'medium-feature'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/medium-feature.jpg' . '">'; } ?> </a> <?php echo themeloy_post_type(); ?> </div> <div class="feature-text"> <div class="post-title"><h4 class="list_title"><a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php the_title(); ?> </a></h4></div> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> <div class="clear"></div> </div> </div> <?php } } ?> </div> </div> </div> <?php wp_reset_query(); }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); if (!($number = absint($instance['number']))) { $number = 5; } $themeloy_args = array('showposts' => $number, 'orderby' => 'comment_count'); $show_comment_tab = isset($instance['show_comment_tab']) ? $instance['show_comment_tab'] : false; $themeloy_args1 = array('showposts' => $number, 'orderby' => 'date'); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); $themeloy_widget1 = null; $themeloy_widget1 = new WP_Query($themeloy_args1); echo $before_widget; if ($title != "") { echo $before_title; echo $title; echo $after_title; } ?> <div class="widget_container"> <!--tabs-nav --> <ul class="tabs-nav"> <li class="active"><a class="title" href="#tab1"><?php _e('Popular', 'tl_back'); ?> </a></li> <li class=""><a class="title" href="#tab2"><?php _e('Latest', 'tl_back'); ?> </a></li> <?php if ($show_comment_tab == true) { ?> <li class=""><a class="title" href="#tab4"><?php _e('Comment', 'tl_back'); ?> </a></li><?php } ?> </ul> <!-- end tabs-nav --> <div class="tabs-container"> <!--tab1 --> <div id="tab1" class="tab-content" style="display: block;"> <ul class="post_list"> <?php while ($themeloy_widget->have_posts()) { $themeloy_widget->the_post(); $post_id = get_the_ID(); ?> <li class="clearfix"> <div class="img_thumbnail feature-item"> <?php echo '<a class="img_thumbnail" href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">'; ?> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'small-feature'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/small-feature.jpg' . '">'; } ?> </a> <?php echo themeloy_post_type(); ?> </div> <div class="list_desc"> <h4 class="list_title"><a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent link to <?php the_title_attribute(); ?> "> <?php echo themeloy_short_title(60, get_the_title('')); ?> </a></h4> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> </li> <?php } wp_reset_query(); ?> </ul> </div> <!-- end tab1 --> <!--tab2 --> <div id="tab2" class="tab-content"> <ul class="post_list"> <?php while ($themeloy_widget1->have_posts()) { $themeloy_widget1->the_post(); $post_id = get_the_ID(); ?> <li class="clearfix"> <div class="img_thumbnail feature-item"> <?php echo '<a class="img_thumbnail" href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">'; ?> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'small-feature'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/small-feature.jpg' . '">'; } ?> </a> <?php echo themeloy_post_type(); ?> </div> <div class="list_desc"> <h4 class="list_title"> <a class="title" href="<?php the_permalink(); ?> " rel="bookmark" title="Permanent link to <?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h4> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> </li> <?php } wp_reset_query(); ?> </ul> </div> <!-- end tab2 --> <?php if ($show_comment_tab == true) { ?> <!--tab4 --> <div id="tab4" class="tab-content comment-tab"> <ul class="post_list"> <?php $args = array('status' => 'approve', 'number' => $number); $postcount = 0; $comments = get_comments($args); foreach ($comments as $comment) { $postcount++; $commentcontent = strip_tags($comment->comment_content); if (strlen($commentcontent) > 50) { $commentcontent = mb_substr($commentcontent, 0, 100) . "..."; } $commentauthor = $comment->comment_author; if (strlen($commentauthor) > 30) { $commentauthor = mb_substr($commentauthor, 0, 29) . "..."; } $commentid = $comment->comment_ID; $commenturl = get_comment_link($commentid); ?> <li class="clearfix"> <a class="img_thumbnail" href="<?php echo $commenturl; ?> "><?php echo get_avatar($comment, '65'); ?> </a> <div class="list_desc"> <h4 class="list_title"><a class="post-title" href="<?php echo $commenturl; ?> "><?php echo $commentcontent; ?> </a></h4> <p class="post-meta"> <span class="meta-date"><i class="icon-time"></i> <?php echo human_time_diff(get_comment_date('U', $comment->comment_ID), current_time('timestamp')), __(' ago', 'tl_back'); ?> </span> </p> </div> </li> <?php } ?> </ul> </div> <!-- end tab4 --> <?php } ?> </div> <div class="clear"></div> </div> <!-- end tabs-container --> <?php echo $after_widget; }
function block($instance) { extract($instance); $titles = apply_filters('widget_title', empty($instance['titles']) ? 'Recent Posts' : $instance['titles'], $instance, $this->id_base); $show_style_1 = isset($instance['show_style_1']) ? $instance['show_style_1'] : false; if (!isset($instance["cats"])) { $cats = ''; } // array to call recent posts. $themeloy_args = array('showposts' => $number_show, 'category__in' => $cats); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); ?> <div class="widget post_list_medium_widget"> <?php if (!empty($instance['titles'])) { ?> <h3 class="widget-title"><span><?php echo $instance["titles"]; ?> </span></h3><?php } ?> <div class="widget_container"> <ul class="<?php if ($show_style_1 == true) { echo "post_list_medium_style1"; } else { echo "post_list_medium"; } ?> "> <?php $row_count = 0; while ($themeloy_widget->have_posts()) { $row_count++; $themeloy_widget->the_post(); $post_id = get_the_ID(); $thumb = themeloy_get_thumbnail(get_the_ID()); ?> <li class="list_item <?php if ($row_count % 2 == 0) { echo "left-column-post"; } ?> "> <div class="entry-thumb feature-item"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'feature-large'); ?> <img class="cat-feature-large-img" src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img class="cat-feature-large-img" src="' . get_template_directory_uri() . '/images/demo/feature-large.jpg' . '">'; } ?> </a> <div class="cat-feature-large"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider">'; echo the_category(', ') . '</p>'; } ?> </div> <?php echo themeloy_post_type(); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> <h3><a href="<?php the_permalink(); ?> " class="title"><?php the_title(); ?> </a></h3> <?php $enable_review = get_post_custom_values('reviewthemeloy_checkbox', get_the_ID()); ?> <?php if (of_get_option('disable_review') == 0) { if ($enable_review[0] == 1) { ?> <span class="review-wrap"> <span class="review-star"> <span style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %" class="review-star-inline"> </span> </span> </span> <?php } else { ?> <span class="review-wrap"> <span class="review-star-none"> <span class="review-star-inline-none"></span> </span> </span> <?php } } else { ?> <span class="review-wrap"> <span class="review-star-none"> <span class="review-star-inline-none"></span> </span> </span> <?php } ?> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php if ($show_style_1 == true) { } else { ?> <p><?php echo themeloy_short_title(320, get_the_excerpt('')); ?> </p> <?php } ?> <div class="clear"></div> </li> <?php } ?> </ul> </div> </div> <?php wp_reset_query(); }
function block($instance) { extract($instance); $titles = apply_filters('widget_title', empty($instance['titles']) ? ' ' : $instance['titles'], $instance, $this->id_base); if (!($number_show = absint($instance['number_show']))) { $number_show = 5; } if (!($cats = $instance["cats"])) { $cats = ''; } // Post list in widget> ?> <div class="widget post_list_medium_widget"> <?php if (!empty($instance['titles'])) { ?> <h3 class="widget-title"><span><?php echo $instance["titles"]; ?> </span></h3><?php } ?> <div class="widget_container"> <!--tabs-nav --> <ul class="tabs-nav home-page-tab-widget"> <?php if (!empty($cats)) { foreach ($cats as $cat_id) { echo '<li class=""><a class="title" href="#tab' . $cat_id . '">' . get_the_category_by_ID($cat_id) . '</a></li>'; } } else { echo '<li class=""><a class="title" href="#">'; _e('Please choose at least two categories', 'tl_back'); echo '</a></li>'; } ?> </ul> <!-- end tabs-nav --> <div class="tabs-container"> <?php if (!empty($cats)) { foreach ($cats as $cat_id) { $themeloy_args = array('showposts' => $number_show, 'category__in' => $cat_id); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); ?> <div id="tab<?php echo $cat_id; ?> " class="tab-content homepage-tab-post"> <?php echo "<ul class=\"home-page-tab post_list_medium\">\n"; while ($themeloy_widget->have_posts()) { $themeloy_widget->the_post(); $post_id = get_the_ID(); ?> <li class="list_item"> <div class="entry-thumb feature-item"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'feature-large'); ?> <img class="cat-feature-large-img" src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img class="cat-feature-large-img" src="' . get_template_directory_uri() . '/images/demo/feature-large.jpg' . '">'; } ?> </a> <div class="cat-feature-large"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider">'; echo the_category(', ') . '</p>'; } ?> </div> <?php echo themeloy_post_type(); ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> </div> <h3><a href="<?php the_permalink(); ?> " class="title"><?php the_title(); ?> </a></h3> <?php $enable_review = get_post_custom_values('reviewthemeloy_checkbox', get_the_ID()); ?> <?php if (of_get_option('disable_review') == 0) { if ($enable_review[0] == 1) { ?> <span class="review-wrap"> <span class="review-star"> <span style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %" class="review-star-inline"> </span> </span> </span> <?php } else { ?> <span class="review-wrap"> <span class="review-star-none"> <span class="review-star-inline-none"></span> </span> </span> <?php } } else { ?> <span class="review-wrap"> <span class="review-star-none"> <span class="review-star-inline-none"></span> </span> </span> <?php } ?> <?php echo themeloy_post_meta(get_the_ID()); ?> <p><?php echo themeloy_short_title(320, get_the_excerpt('')); ?> </p> <div class="clear"></div> </li> <?php } echo '</ul></div>'; wp_reset_query(); } } ?> </div> </div></div> <?php wp_reset_query(); }
function block($instance) { extract($instance); $titles = apply_filters('widget_title', empty($instance['titles']) ? 'Recent Posts' : $instance['titles'], $instance, $this->id_base); $show_style_1 = isset($instance['show_style_1']) ? $instance['show_style_1'] : false; if (!($number_show = absint($instance['number_show']))) { $number_show = 4; } if (!isset($instance["cats"])) { $cats = ''; } // array to call recent posts. $themeloy_args = array('showposts' => $number_show, 'category__in' => $cats); $themeloy_widget = null; $themeloy_widget = new WP_Query($themeloy_args); // Widget title // Post list in widget ?> <div class="widget post_grid_list_widget"> <?php if (!empty($instance['titles'])) { ?> <h3 class="widget-title"><span><?php echo $instance["titles"]; ?> </span></h3><?php } ?> <div class="widget_container"> <ul class="<?php if ($show_style_1 == true) { echo " post_grid_list_style1"; } else { echo " post_grid_list"; } ?> "> <?php while ($themeloy_widget->have_posts()) { $themeloy_widget->the_post(); $post_id = get_the_ID(); $thumb = themeloy_get_thumbnail(get_the_ID()); ?> <li class="list_item feature-item"> <a class="entry-thumb" href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'main-square'); ?> <img src="<?php echo $image[0]; ?> " /> <?php } else { echo '<img src="' . get_template_directory_uri() . '/images/demo/main-square.jpg' . '">'; } ?> </a> <?php if ($show_style_1 == false) { ?> <h4 class="caption"> <?php $post_cat = get_post_custom_values('cat_themeloy_select', get_the_ID()); $post_cat = $post_cat[0] != '' ? $post_cat[0] : of_get_option('blog_category_post'); if ($post_cat == '1') { echo '<p class="cat-slider">'; echo the_category(', ') . '</p>'; } ?> <span> <a class="entry-thumb" href="<?php the_permalink(); ?> "> <?php the_title(); ?> </a></span></h4><?php } ?> <?php $post_review = get_post_custom_values('enable_review_themeloy_select', $post_id); $post_review = $post_review[0] != '' ? $post_review[0] : of_get_option('enable_all_review'); $total_review = absint(themeloy_get_total_review($post_id)); if ($post_review == '1') { ?> <div class="ratings"> <div class="rating-box"> <div class="rating" style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?> %"></div> </div> </div> <?php } ?> <?php echo themeloy_post_type(); ?> <?php if ($show_style_1 == true) { ?> <h4 class="caption"><a href="<?php the_permalink(); ?> " class="title"><span><?php the_title(); ?> </span></a></h4><?php } ?> <?php echo themeloy_post_meta(get_the_ID()); ?> <?php if ($show_style_1 == true) { ?> <p><?php echo themeloy_short_title(320, get_the_excerpt('')); ?> </p> <?php } ?> <div class="clear"></div> <?php } ?> </ul> <div class="clear"></div> </div> </div> <?php wp_reset_query(); }