<i class="fa fa-hand-pointer-o" style="text-shadow: 0px 0px 10px <?php echo esc_attr($cat_data['catBG']); ?> "></i> <?php if (strlen($img = get_the_post_thumbnail(get_the_ID(), array(150, 150)))) { $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); //get img URL if ($i == 0) { $image = crystalskull_aq_resize($img_url, 422, 300, true, '', true); //resize & crop img } else { $image = crystalskull_aq_resize($img_url, 120, 95, true, '', true); //resize & crop img } ?> <img src="<?php echo esc_url($image[0]); ?> " alt="<?php the_title(); ?> " /> <?php } else { if ($i == 0) { ?>
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $nopost = $instance['nopost']; ?> <?php $crystalskull_allowed = wp_kses_allowed_html('post'); echo wp_kses($before_widget, $crystalskull_allowed); if ($instance['title']) { ?> <div class="title-wrapper"> <h3 class="widget-title"><i class="fa fa-newspaper-o"></i> <?php echo esc_attr($instance['title']); ?> </h3><div class="clear"></div></div> <?php } ?> <ul class="review"> <?php $pc = new WP_Query(array('meta_key' => 'overall_rating', 'orderby' => array('comment_count' => 'DESC', 'meta_value_num' => 'DESC'), 'cat' => $instance['cat'], 'posts_per_page' => $nopost)); if ($pc->have_posts()) { while ($pc->have_posts()) { $pc->the_post(); ?> <li><a rel="bookmark" href="<?php the_permalink(); ?> "> <div class="img"> <?php if (has_post_thumbnail()) { $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); //get img URL $image = crystalskull_aq_resize($img_url, 368, 148, true); //resize & crop img ?> <img alt="img" src="<?php echo esc_url($image); ?> " /> <?php } else { ?> <img alt="img" src="<?php echo esc_url(get_template_directory_uri()) . '/img/defaults/default.jpg'; ?> "/> <?php } ?> <span class="overlay-link"></span> </div> <div class="info"> <small> <i class="fa fa-calendar"></i> <?php the_time('F j, Y'); ?> </small> <a href="<?php the_permalink(); ?> " class="pw_maint"> <?php the_title(); ?> </a> <?php global $post; $categories = wp_get_post_categories($post->ID); $cat_data = get_option("category_{$categories['0']}"); // overall stars $postid = $pc->post->ID; $overall_rating = get_post_meta($post->ID, 'overall_rating', true); ?> <?php if (of_get_option('rating_type') == 'numbers') { ?> <?php if ($overall_rating != "0" && $overall_rating == "0.5") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 0.5</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "1") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 1</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "1.5") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 1.5</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "2") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 2</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "2.5") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 2.5</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "3") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 3</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "3.5") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 3.5</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "4") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 4</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "4.5") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 4.5</b>/5 </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "5") { ?> <div class="overall-score"> <b style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "><i class="fa fa-trophy"></i> 5</b>/5 </div> <?php } ?> <?php } else { ?> <?php if ($overall_rating != "0" && $overall_rating == "0.5") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "1") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "1.5") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "2") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "2.5") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "3") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "3.5") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "4") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "4.5") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> </div> <?php } ?> <?php if ($overall_rating != "0" && $overall_rating == "5") { ?> <div class="overall-score" style="color: <?php echo esc_attr($cat_data["catBG"]); ?> "> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> </div> <?php } ?> <?php } ?> </div> <div class="clear"></div> </a> </li> <?php } ?> <?php } else { ?> <li><div><?php esc_html_e("No popular posts!", 'crystalskull'); ?> </div></li> <?php } wp_reset_postdata(); ?> </ul> <?php echo wp_kses($after_widget, $crystalskull_allowed); ?> <?php }
} ?> <a rel="bookmark" href="<?php the_permalink(); ?> "> <i class="fa fa-hand-pointer-o" style="text-shadow: 0px 0px 10px <?php echo esc_attr($cat_data['catBG']); ?> "></i> <?php if (has_post_thumbnail()) { $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); //get img URL $image = crystalskull_aq_resize($img_url, 350, 230, true, '', true); //resize & crop img ?> <img src="<?php echo esc_url($image[0]); ?> " alt="<?php the_title(); ?> " /> <?php } else { ?> <img src="<?php echo get_template_directory_uri() . '/img/defaults/default.jpg';
public static function generate_owl_html($id) { $owl = new crystalskull_Wp_Owl_Carousel(); $files = $owl->get_owl_items($id); $category = get_post_meta($id, self::prefix . 'post_cat', 1); if ($category == 0) { if (empty($files)) { return; } $size_id = get_post_meta($id, self::prefix . 'image_size', true); $sizes = get_intermediate_image_sizes(); $settings = $owl->generate_settings_array($id); $settings = json_encode($settings); $lazyLoad = get_post_meta($id, self::prefix . 'lazyLoad', true); $link_to_size = get_post_meta($id, self::prefix . 'link_to_size', true); $rel = get_post_meta($id, self::prefix . 'rel', true); $html = '<div id="owl-carousel-' . $id . '" class="owl-carousel" data-owloptions=\'' . $settings . '\'>'; foreach ($files as $id => $url) { $html .= '<div>'; $img = wp_get_attachment_image_src($id, $sizes[$size_id]); if ($link_to_size != 0) { $img_link = wp_get_attachment_image_src($id, $sizes[$link_to_size]); $html .= '<a href="' . esc_url($img_link[0]) . '"'; $html .= !empty($rel) ? ' rel="' . $rel . '"' : ''; $html .= ' >'; } $html .= '<img alt="" src="' . $img[0] . '" '; if ($lazyLoad == 'on') { $html .= 'class="lazyOwl" '; $html .= 'data-src="' . $img[0] . '" '; } $html .= '/>'; $html .= $link_to_size != 0 ? ' </a>' : ''; $html .= '</div>'; } $html .= '</div>'; return $html; } else { $settings = $owl->generate_settings_array($id); $settings = json_encode($settings); $lazyLoad = get_post_meta($id, self::prefix . 'lazyLoad', true); $link_to_size = get_post_meta($id, self::prefix . 'link_to_size', true); $rel = get_post_meta($id, self::prefix . 'rel', true); $html = '<div id="owl-carousel-' . $id . '" class="owl-carousel" data-owloptions=\'' . $settings . '\'>'; if ($category == 999) { $args = array('orderby' => 'rand', 'posts_per_page' => -1); } else { $args = array('category' => $category, 'posts_per_page' => -1); } $myposts = get_posts($args); foreach ($myposts as $post) { $categories = wp_get_post_categories($post->ID); if (isset($categories[0])) { $cat_data = get_option("category_{$categories['0']}"); } if (of_get_option('rating_type') == 'numbers') { $html .= '<div>'; if (get_post_meta($post->ID, 'overall_rating', true) != 0) { $html .= '<div class="carousel_rating carousel_rating_number">'; // overall stars $overall_rating = get_post_meta($post->ID, 'overall_rating', true); if ($overall_rating != "0" && $overall_rating == "0.5") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 0.5</b>/5'; } if ($overall_rating != "0" && $overall_rating == "1") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 1</b>/5'; } if ($overall_rating != "0" && $overall_rating == "1.5") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 1.5</b>/5'; } if ($overall_rating != "0" && $overall_rating == "2") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 2</b>/5'; } if ($overall_rating != "0" && $overall_rating == "2.5") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 2.5</b>/5'; } if ($overall_rating != "0" && $overall_rating == "3") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 3</b>/5'; } if ($overall_rating != "0" && $overall_rating == "3.5") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 3.5</b>/5'; } if ($overall_rating != "0" && $overall_rating == "4") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 4</b>/5'; } if ($overall_rating != "0" && $overall_rating == "4.5") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 4.5</b>/5'; } if ($overall_rating != "0" && $overall_rating == "5") { $html .= '<b style="color: ' . esc_attr($cat_data["catBG"]) . ' "><i class="fa fa-trophy"></i> 5</b>/5'; } $html .= '</div>'; } } else { $html .= '<div>'; if (get_post_meta($post->ID, 'overall_rating', true) != 0) { $html .= '<div class="carousel_rating" style="color: ' . esc_attr($cat_data["catBG"]) . '">'; // overall stars $overall_rating = get_post_meta($post->ID, 'overall_rating', true); if ($overall_rating != "0" && $overall_rating == "0.5") { $html .= ' <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "1") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "1.5") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "2") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "2.5") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "3") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "3.5") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "4") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "4.5") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-half-o"></i> '; } if ($overall_rating != "0" && $overall_rating == "5") { $html .= ' <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> '; } $html .= '</div>'; } } $post_thumbnail_id = get_post_thumbnail_id($post->ID); if (!isset($size_id)) { $size_id = ''; } if (!isset($sizes[$size_id])) { $sizes[$size_id] = ''; } $img = wp_get_attachment_image_src($post_thumbnail_id, $sizes[$size_id]); if ($link_to_size != 0) { $img_link = wp_get_attachment_image_src($post_thumbnail_id, $sizes[$link_to_size]); $html .= '<a href="' . esc_url($img_link[0]) . '"'; $html .= !empty($rel) ? ' rel="' . $rel . '"' : ''; $html .= ' >'; } $thumb = get_post_thumbnail_id($post->ID); $img_url = wp_get_attachment_url($thumb, 'full'); //get img URL $image = crystalskull_aq_resize($img_url, 230, 325, true, '', true); //resize & crop img if (empty($image[0])) { $image[0] = get_template_directory_uri() . '/img/defaults/default-carousel.jpg'; } $html .= '<a class="car_image" href="' . get_the_permalink($post->ID) . '"><img alt="" src="' . esc_url($image[0]) . '" '; if ($lazyLoad == 'on') { $html .= 'class="lazyOwl" '; $html .= 'data-src="' . $image[0] . '" '; } $html .= '/></a>'; $html .= $link_to_size != 0 ? ' </a>' : ''; if (isset($categories[0])) { $html .= '<div class="car_title"><a href="' . esc_url(get_category_link($categories[0])) . '" class="ncategory" style="background-color: ' . esc_attr($cat_data["catBG"]) . ' !important" >'; } if (isset($categories[0])) { $html .= get_cat_name($categories[0]); } $html .= '</a>'; $html .= '<a class="car_inner_title" href="' . get_the_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a>'; $author_id = $post->post_author; $html .= esc_html__('by ', 'crystalskull'); $html .= '<a data-original-title="' . esc_html__("View all posts by ", 'crystalskull') . get_the_author_meta('user_nicename', $author_id) . '" href="' . esc_url(get_author_posts_url($author_id)) . '">' . get_the_author_meta('user_nicename', $author_id) . '</a></div>'; $html .= '</div>'; } $html .= '</div>'; return $html; } }
$posts->the_post(); ?> <div class="blog-post"> <div class="blog-twrapper"><!-- blog-twrapper --> <div class="blog-image right"><!-- blog-image --> <?php if (has_post_thumbnail()) { ?> <?php $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); //get img URL $image = crystalskull_aq_resize($img_url, 817, 320, true, '', true); //resize & crop img ?> <a href="<?php the_permalink(); ?> "><img alt="img" src="<?php echo esc_url($image[0]); ?> " /></a> <?php } ?>