public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $class_wrap = isset($instance['class_wrap']) ? $instance['class_wrap'] : ''; $src = isset($instance['src']) ? $instance['src'] : ''; $image_hover = $instance['image_hover']; $width = $instance['width']; $height = $instance['height']; $content_align = isset($instance['content_align']) ? $instance['content_align'] : ''; $content_position = isset($instance['content_position']) ? $instance['content_position'] : ''; $content = $instance['content']; $button = isset($instance['button']) ? $instance['button'] : ''; $button_style = isset($instance['button_style']) ? $instance['button_style'] : ''; $button_link = isset($instance['button_link']) ? $instance['button_link'] : ''; $button_target = $instance['button_target']; $button_text = isset($instance['button_text']) ? $instance['button_text'] : ''; // Class wrap if ('' != $class_wrap) { $class_widget = $class_wrap; } else { $class_widget = uw_option('widgets_style', 'style1'); } // no 'class' attribute if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $class_widget . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $class_widget . ' ', $before_widget); } // Image url $image_src = uw_image_resize($src, $width, $height); // Classes $classes = ''; // Image hover if ('' != $image_hover && 'none' != $image_hover) { $classes .= $image_hover; } // Content align if ('left' == $content_align) { $classes .= ' uw-left'; } else { if ('center' == $content_align) { $classes .= ' uw-center'; } else { if ('right' == $content_align) { $classes .= ' uw-right'; } } } // Content position if ('top' == $content_position) { $classes .= ''; } else { if ('middle' == $content_position) { $classes .= ' valign-middle'; } else { if ('bottom' == $content_position) { $classes .= ' valign-bottom'; } } } // If button if ('yes' == $button && $button_link) { $classes .= ' uw-has-button'; } echo $before_widget; if ($title) { ?> <h3 class="uw-title"> <span><?php echo esc_attr($title); ?> </span> </h3> <?php } ?> <div class="uw-banner-wrap clr <?php echo esc_attr($classes); ?> "> <div class="uw-banner-content"> <div class="uw-banner-inner"> <?php echo do_shortcode($content); ?> </div> </div> <?php if ('yes' == $button && $button_link) { ?> <div class="uw-button"> <a class="<?php echo esc_attr($button_style); ?> " href="<?php echo esc_attr($button_link); ?> " target="_<?php echo esc_attr($button_target); ?> "><?php echo esc_attr($button_text); ?> </a> </div> <?php } ?> <img alt="" src="<?php echo esc_url($image_src['url']); ?> " /> </div> <?php echo $after_widget; }
/** @see WP_Widget::widget */ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $class_wrap = isset($instance['class_wrap']) ? $instance['class_wrap'] : ''; $number = $instance['number']; $style = $instance['style']; $order = $instance['order']; $img_height = !empty($instance['img_height']) ? intval($instance['img_height']) : '65'; $img_width = !empty($instance['img_width']) ? intval($instance['img_width']) : '65'; $image = isset($instance['image']) ? $instance['image'] : ''; $infowrap = isset($instance['infowrap']) ? $instance['infowrap'] : ''; $post_type = $instance['post_type']; // Class wrap if ('' != $class_wrap) { $class_widget = $class_wrap; } else { $class_widget = uw_option('widgets_style', 'style1'); } // no 'class' attribute if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $class_widget . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $class_widget . ' ', $before_widget); } echo $before_widget; if ($title) { ?> <h3 class="uw-title"> <span><?php echo esc_attr($title); ?> </span> </h3> <?php } if ($style == 'fullimg' || $style == 'fullinfoinside') { $class = ' full'; } else { $class = ''; } ?> <ul class="uw-ul uw-widget-recent-posts clr style-<?php echo esc_attr($style); echo esc_attr($class); ?> "> <?php global $post; $args = array('post_type' => $post_type, 'numberposts' => $number, 'orderby' => $order, 'no_found_rows' => true, 'suppress_filters' => false, 'meta_key' => '_thumbnail_id'); $myposts = get_posts($args); foreach ($myposts as $post) { setup_postdata($post); if (has_post_thumbnail()) { $featured_image = uw_image_resize(wp_get_attachment_url(get_post_thumbnail_id()), $img_width, $img_height); ?> <li class="uw-widget-recent-posts-li"> <?php if ($style == 'fullinfoinside') { ?> <div class="uw-fullinfo-wrap"><?php } ?> <?php if ($infowrap !== '1' && $style == 'fullinfoinside') { ?> <div class="uw-widget-info-wrap"> <div class="uw-widget-recent-posts-date"><i class="icon_clock_alt"></i><?php echo get_the_date(); ?> </div> <div class="uw-widget-recent-posts-comments"><i class="icon_comment_alt"></i><?php comments_popup_link(__('0', 'kho'), __('1', 'kho'), __('%', 'kho'), 'comments-link'); ?> </div> </div> <?php } ?> <?php if ($image !== '1') { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="uw-widget-recent-posts-thumbnail"> <img src="<?php echo esc_url($featured_image['url']); ?> " alt="<?php the_title(); ?> " /> </a> <?php } ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="uw-widget-recent-posts-title"><?php the_title(); ?> </a> <?php if ($infowrap !== '1' && $style !== 'fullinfoinside') { ?> <div class="uw-widget-info-wrap"> <div class="uw-widget-recent-posts-date"><i class="icon_clock_alt"></i><?php echo get_the_date(); ?> </div> <div class="uw-widget-recent-posts-comments"><i class="icon_comment_alt"></i><?php comments_popup_link(__('0', 'kho'), __('1', 'kho'), __('%', 'kho'), 'comments-link'); ?> </div> </div> <?php } ?> <?php if ($style == 'fullinfoinside') { ?> </div><?php } ?> </li> <?php } } wp_reset_postdata(); ?> </ul> <?php echo $after_widget; }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $class_wrap = isset($instance['class_wrap']) ? $instance['class_wrap'] : ''; $speed = $instance['speed']; $count = $instance['count']; $width = isset($instance['width']) ? $instance['width'] : ''; $height = isset($instance['height']) ? $instance['height'] : ''; $target = isset($instance['target']) ? $instance['target'] : ''; // Class wrap if ('' != $class_wrap) { $class_widget = $class_wrap; } else { $class_widget = uw_option('widgets_style', 'style1'); } // no 'class' attribute if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $class_widget . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $class_widget . ' ', $before_widget); } echo $before_widget; if ($title) { ?> <h3 class="uw-title"> <?php if ($count !== '1') { ?> <a href="#" class="uw-testimonial-nav uw-testimonial-prev"><i class="fa fa-angle-left"></i></a> <?php } ?> <span><?php echo esc_attr($title); ?> </span> <?php if ($count !== '1') { ?> <a href="#" class="uw-testimonial-nav uw-testimonial-next"><i class="fa fa-angle-right"></i></a> <?php } ?> </h3> <?php } ?> <div class="uw-testimonial-slider uw-flexslider" data-slidespeed="<?php echo esc_attr($speed); ?> "> <ul class="uw-ul uw-flex-slides"> <?php if ($count !== '0') { for ($i = 1; $i <= $count; $i++) { $image_src = ''; $quote = isset($instance["quote_" . $i]) ? $instance["quote_" . $i] : ''; $author_name = isset($instance["author_name_" . $i]) ? $instance["author_name_" . $i] : ''; $company = isset($instance["company_" . $i]) ? $instance["company_" . $i] : ''; $url = isset($instance["url_" . $i]) ? $instance["url_" . $i] : ''; $src = isset($instance["src_" . $i]) ? $instance["src_" . $i] : ''; if (!empty($src)) { $image_src = uw_image_resize($src, $width, $height); } ?> <li> <div class="uw-testimonial-entry-content"><span class="uw-testimonial-caret"></span><span><?php echo esc_attr($quote); ?> </span></div> <?php if (!empty($image_src)) { ?> <div class="uw-testimonial-entry-thumb"><img class="uw-testimonial-author-image" width="<?php echo esc_attr($width); ?> " height="<?php echo esc_attr($height); ?> " src="<?php echo esc_url($image_src['url']); ?> " alt="<?php echo esc_attr($company); ?> " /></div> <?php } ?> <div class="uw-testimonial-entry-meta"><span class="uw-testimonial-entry-author"><?php echo esc_attr($author_name); ?> </span> <a class="uw-testimonial-author" href="<?php echo esc_url($url); ?> " target="_<?php echo esc_attr($target); ?> "><?php echo esc_attr($company); ?> </a></div> </li> <?php } } ?> </ul> </div> <?php echo $after_widget; }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $class_wrap = isset($instance['class_wrap']) ? $instance['class_wrap'] : ''; $speed = $instance['speed']; $count = $instance['count']; $width = $instance['width']; $height = $instance['height']; $target = $instance['target']; // Class wrap if ('' != $class_wrap) { $class_widget = $class_wrap; } else { $class_widget = uw_option('widgets_style', 'style1'); } // no 'class' attribute if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $class_widget . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $class_widget . ' ', $before_widget); } echo $before_widget; ?> <?php if ($title) { ?> <h3 class="uw-title"> <?php if ($count !== '1') { ?> <a href="#" class="uw-slideshow-nav uw-slideshow-prev"><i class="fa fa-angle-left"></i></a> <?php } ?> <span><?php echo esc_attr($title); ?> </span> <?php if ($count !== '1') { ?> <a href="#" class="uw-slideshow-nav uw-slideshow-next"><i class="fa fa-angle-right"></i></a> <?php } ?> </h3> <?php } ?> <div class="uw-widget-mini-slideshow flexslider" data-slideshow="<?php echo esc_attr($speed); ?> "> <ul class="uw-ul uw-flex-slides"> <?php if ($count !== '0') { for ($i = 1; $i <= $count; $i++) { $src = isset($instance["src_" . $i]) ? $instance["src_" . $i] : ''; $link = isset($instance["link_" . $i]) ? $instance["link_" . $i] : ''; $image_src = uw_image_resize($src, $width, $height); if ($src !== '') { ?> <li> <?php if ($link !== '') { ?> <a href="<?php echo esc_url($link); ?> " target="_<?php echo esc_attr($target); ?> "> <img alt="" src="<?php echo esc_url($image_src['url']); ?> " /> </a> <?php } else { ?> <img alt="" src="<?php echo esc_url($image_src['url']); ?> " /> <?php } ?> </li> <?php } } } ?> </ul> </div> <?php echo $after_widget; }
/** @see WP_Widget::widget */ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $class_wrap = isset($instance['class_wrap']) ? $instance['class_wrap'] : ''; $number = $instance['number']; $speed = !empty($instance['speed']) ? intval($instance['speed']) : '7000'; $order = $instance['order']; $img_width = !empty($instance['img_width']) ? intval($instance['img_width']) : '320'; $img_height = !empty($instance['img_height']) ? intval($instance['img_height']) : '400'; $post_type = $instance['post_type']; // Class wrap if ('' != $class_wrap) { $class_widget = $class_wrap; } else { $class_widget = uw_option('widgets_style', 'style1'); } // no 'class' attribute if (strpos($before_widget, 'class') === false) { $before_widget = str_replace('>', 'class="' . $class_widget . '"', $before_widget); } else { $before_widget = str_replace('class="', 'class="' . $class_widget . ' ', $before_widget); } echo $before_widget; if ($title) { ?> <h3 class="uw-title"> <span><?php echo esc_attr($title); ?> </span> </h3> <?php } ?> <div class="uw-posts-slider flexslider" data-slideshow="<?php echo esc_attr($speed); ?> "> <ul class="uw-ul uw-widget-posts-slider uw-flex-slides slides clr"> <?php global $post; $args = array('post_type' => $post_type, 'numberposts' => $number, 'orderby' => $order, 'no_found_rows' => true, 'suppress_filters' => false, 'meta_key' => '_thumbnail_id'); $myposts = get_posts($args); foreach ($myposts as $post) { setup_postdata($post); if (has_post_thumbnail()) { $featured_image = uw_image_resize(wp_get_attachment_url(get_post_thumbnail_id()), $img_width, $img_height); ?> <li class="uw-posts-slider-li"> <div class="uw-posts-slider-wrap"> <div class="uw-info-wrap"> <span class="uw-posts-slider-comments"><i class="icon_comment_alt"></i><?php comments_popup_link(__('0', 'kho'), __('1', 'kho'), __('%', 'kho'), 'uw-comments-link'); ?> </span> </div> <?php if ($number !== '1') { ?> <ul class="uw-posts-slider-nav"> <li><a href="#" class="uw-posts-prev"><i class="fa fa-angle-left"></i></a></li> <li><a href="#" class="uw-posts-next"><i class="fa fa-angle-right"></i></a></li> </ul> <?php } ?> <a href="<?php the_permalink(); ?> " class="uw-posts-slider-image"><img src="<?php echo esc_url($featured_image['url']); ?> " alt="<?php the_title(); ?> " /></a> <div class="uw-posts-slider-desc"> <a href="<?php the_permalink(); ?> " class="uw-posts-slider-title" title="<?php the_title(); ?> "><?php the_title(); ?> </a> </div> </div> </li> <?php } } wp_reset_postdata(); ?> </ul> </div> <?php echo $after_widget; }