/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ function widget($args, $instance) { // Set vars for widget usage $title = isset($instance['title']) ? $instance['title'] : ''; $title = apply_filters('widget_title', $title); $post_type = isset($instance['post_type']) ? $instance['post_type'] : ''; $taxonomy = isset($instance['taxonomy']) ? $instance['taxonomy'] : ''; $terms = isset($instance['terms']) ? $instance['terms'] : ''; $number = isset($instance['number']) ? $instance['number'] : ''; $order = isset($instance['order']) ? $instance['order'] : ''; $columns = isset($instance['columns']) ? $instance['columns'] : '3'; $img_hover = isset($instance['img_hover']) ? $instance['img_hover'] : ''; $img_size = isset($instance['img_size']) ? $instance['img_size'] : 'wpex_custom'; $img_height = !empty($instance['img_height']) ? intval($instance['img_height']) : ''; $img_width = !empty($instance['img_width']) ? intval($instance['img_width']) : ''; $img_size = $img_width || $img_height ? 'wpex_custom' : $img_size; $exclude = is_singular() ? array(get_the_ID()) : NULL; // Sanitize terms if ($terms) { $terms = str_replace(', ', ',', $terms); $terms = explode(',', $terms); } // Before widget WP hook echo $args['before_widget']; // Display title if defined if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="wpex-recent-posts-thumb-grid wpex-row clr"> <?php // Query args $query_args = array('post_type' => $post_type, 'posts_per_page' => $number, 'orderby' => $order, 'meta_key' => '_thumbnail_id', 'post__not_in' => $exclude, 'no_found_rows' => true); // Taxonomy args if (!empty($taxonomy) && !empty($terms)) { $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $terms)); } // Query posts $my_query = new WP_Query($query_args); ?> <?php // Set post counter variable $count = 0; ?> <?php // Loop through posts while ($my_query->have_posts()) { $my_query->the_post(); ?> <?php // Add to counter variable $count++; ?> <?php // Get post thumbnail $thumbnail = wpex_get_post_thumbnail(array('size' => $img_size, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); ?> <?php // Get hover classes if ($img_hover) { $hover_classes = ' class="' . wpex_image_hover_classes($img_hover) . '"'; } else { $hover_classes = ''; } ?> <li class="<?php echo wpex_grid_class($columns); ?> nr-col col-<?php echo $count; ?> "> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> "<?php echo $hover_classes; ?> ><?php echo $thumbnail; ?> </a> </li> <?php // Reset counter to clear floats if ($count == $columns) { $count = '0'; } ?> <?php // End loop } ?> <?php // Reset global query post data wp_reset_postdata(); ?> </ul> <?php // After widget WP hook echo $args['after_widget']; ?> <?php }
} } $img['thumbnail'] = str_replace('<img ', '<img data-vc-zoom="' . $large_img_src . '" ', $img['thumbnail']); break; } // backward compatibility if (vc_has_class('prettyphoto', $el_class)) { $el_class = vc_remove_class('prettyphoto', $el_class); } // Image Filter - TOTAL THEME if (!empty($img_filter)) { $img_filter = ' ' . wpex_image_filter_class($img_filter); } // Image - Hover if (!empty($img_hover)) { $img_hover = ' ' . wpex_image_hover_classes($img_hover); } $html = 'vc_box_shadow_3d' === $style ? '<span class="vc_box_shadow_3d_wrap">' . $img['thumbnail'] . '</span>' : $img['thumbnail']; // TOTAL OVERLAY CAPTION if ($img_caption) { $html .= '<span class="wpb_single_image_caption">' . $img_caption . '</span>'; } // TOTAL OVERLAY CAPTION END $wrapper_classes = 'vc_single_image-wrapper'; if ($style) { $wrapper_classes .= ' ' . $style; $wrapper_classes .= ' ' . $border_color; } if ($img_filter) { $wrapper_classes .= ' ' . $img_filter; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { // Parse instance extract(wp_parse_args($instance, $this->defaults)); $img_hover_classes = wpex_image_hover_classes($img_hover); // Apply filters to the title $title = apply_filters('widget_title', $title, $instance, $this->id_base); // Before widget WP hook echo $args['before_widget']; // Display title if defined if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="wpex-recent-posts-thumb-grid wpex-row clr"> <?php // Query args $query_args = array('post_type' => $post_type, 'posts_per_page' => $number, 'meta_key' => '_thumbnail_id', 'no_found_rows' => true); // Order params - needs FALLBACK don't ever edit! if (!empty($orderby)) { $query_args['order'] = $order; $query_args['orderby'] = $orderby; } else { $query_args['orderby'] = $order; // THIS IS THE FALLBACK } // Taxonomy args if (!empty($taxonomy) && !empty($terms)) { // Sanitize terms and convert to array $terms = str_replace(', ', ',', $terms); $terms = explode(',', $terms); // Add to query arg $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $terms)); } // Exclude current post if (is_singular()) { $query_args['post__not_in'] = array(get_the_ID()); } // Query posts $wpex_query = new WP_Query($query_args); // Set post counter variable $count = 0; // Loop through posts while ($wpex_query->have_posts()) { $wpex_query->the_post(); ?> <?php // Add to counter variable $count++; ?> <li class="<?php echo wpex_grid_class($columns); ?> nr-col col-<?php echo esc_attr($count); ?> "> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> "<?php if ($img_hover_classes) { echo ' class="' . esc_attr($img_hover_classes) . '"'; } ?> > <?php wpex_post_thumbnail(array('size' => $img_size, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); ?> </a> </li> <?php // Reset counter to clear floats if ($count == $columns) { $count = '0'; } ?> <?php // End loop } ?> <?php // Reset global query post data wp_reset_postdata(); ?> </ul> <?php // After widget WP hook echo $args['after_widget']; ?> <?php }
$my_query = new WP_Query(array('post_type' => 'attachment', 'post_status' => 'any', 'posts_per_page' => -1, 'paged' => NULL, 'no_found_rows' => true, 'post__in' => $attachment_ids, 'orderby' => $orderby)); // Display carousel if there are images if ($my_query->have_posts()) { // Image Classes $img_classes = array('wpex-carousel-entry-media', 'clr'); if ('yes' == $rounded_image) { $img_classes[] = ' wpex-rounded-images'; } if ($overlay_style) { $img_classes[] = wpex_overlay_classes($overlay_style); } if ($img_filter) { $img_classes[] = wpex_image_filter_class($img_filter); } if ($img_hover_style) { $img_classes[] = wpex_image_hover_classes($img_hover_style); } $img_classes = implode(' ', $img_classes); // Lightbox links if ('lightbox' == $thumbnail_link) { vcex_enque_style('ilightbox', $lightbox_skin); $atts['lightbox_data'] = array(); $atts['lightbox_data'][] = 'data-type="image"'; if ($lightbox_skin) { $atts['lightbox_data'][] = 'data-skin="' . $lightbox_skin . '"'; } } // Output js for front-end editor $inline_js = array('carousel'); if ('lightbox' == $thumbnail_link) { $inline_js[] = 'ilightbox';
} ?> <?php // Image if ($image) { ?> <?php // Generate image classes $image_classes = $media_classes; if ($img_filter) { $image_classes .= ' ' . wpex_image_filter_class($img_filter); } if ($img_hover_style) { $image_classes .= ' ' . wpex_image_hover_classes($img_hover_style); } if ('stretch' == $img_style) { $image_classes .= ' stretch-image'; } ?> <figure class="<?php echo $image_classes; ?> "> <?php // Open URl if ($url) { ?> <a href="<?php
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { // Parse instance extract(wp_parse_args($instance, $this->defaults)); // Apply filters to the title $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : ''; // Before widget WP hook echo $args['before_widget']; // Display title if defined if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="wpex-widget-recent-posts wpex-clr style-<?php echo esc_attr($style); ?> "> <?php // Query args $query_args = array('post_type' => $post_type, 'posts_per_page' => $number, 'meta_key' => '_thumbnail_id', 'no_found_rows' => true); // Order params - needs FALLBACK don't ever edit! if (!empty($orderby)) { $query_args['order'] = $order; $query_args['orderby'] = $orderby; } else { $query_args['orderby'] = $order; // THIS IS THE FALLBACK } // Taxonomy args if (!empty($taxonomy) && !empty($terms)) { // Sanitize terms and convert to array $terms = str_replace(', ', ',', $terms); $terms = explode(',', $terms); // Add to query arg $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $terms)); } // Exclude current post if (is_singular()) { $query_args['post__not_in'] = array(get_the_ID()); } // Query posts $wpex_query = new WP_Query($query_args); // If there are posts loop through them if ($wpex_query->have_posts()) { // Loop through posts while ($wpex_query->have_posts()) { $wpex_query->the_post(); ?> <?php // Get hover classes if ($img_hover) { $hover_classes = ' ' . wpex_image_hover_classes($img_hover); } else { $hover_classes = ''; } ?> <li class="wpex-widget-recent-posts-li clr"> <?php if (has_post_thumbnail()) { ?> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> " class="wpex-widget-recent-posts-thumbnail<?php echo esc_attr($hover_classes); ?> "> <?php wpex_post_thumbnail(array('size' => $img_size, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); ?> </a> <?php } ?> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> " class="wpex-widget-recent-posts-title"><?php the_title(); ?> </a> <?php // Display date if enabled if ('1' != $date) { ?> <div class="wpex-widget-recent-posts-date"> <?php echo get_the_date(); ?> </div><!-- .wpex-widget-recent-posts-date --> <?php } ?> </li><!-- .wpex-widget-recent-posts-li --> <?php } ?> <?php } ?> </ul><!-- .wpex-widget-recent-posts --> <?php wp_reset_postdata(); ?> <?php // After widget WordPress hook echo $args['after_widget']; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ function widget($args, $instance) { // Set vars $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : __('Recent Posts', 'wpex'); $number = isset($instance['number']) ? $instance['number'] : '3'; $style = isset($instance['style']) ? $instance['style'] : 'default'; $order = isset($instance['order']) ? $instance['order'] : ''; $date = isset($instance['date']) ? $instance['date'] : ''; $post_type = isset($instance['post_type']) ? $instance['post_type'] : ''; $taxonomy = isset($instance['taxonomy']) ? $instance['taxonomy'] : ''; $terms = isset($instance['terms']) ? $instance['terms'] : ''; $img_hover = isset($instance['img_hover']) ? $instance['img_hover'] : ''; $img_size = isset($instance['img_size']) ? $instance['img_size'] : 'wpex_custom'; $img_height = !empty($instance['img_height']) ? intval($instance['img_height']) : ''; $img_width = !empty($instance['img_width']) ? intval($instance['img_width']) : ''; $img_size = $img_width || $img_height ? 'wpex_custom' : $img_size; $exclude = is_singular() ? array(get_the_ID()) : NULL; // Sanitize terms if ($terms) { $terms = str_replace(', ', ',', $terms); $terms = explode(',', $terms); } // Before widget WP hook echo $args['before_widget']; // Display title if defined if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="wpex-widget-recent-posts clr style-<?php echo $style; ?> "> <?php // Query args $query_args = array('post_type' => $post_type, 'posts_per_page' => $number, 'orderby' => $order, 'post__not_in' => $exclude, 'meta_key' => '_thumbnail_id', 'no_found_rows' => true); // Taxonomy args if (!empty($taxonomy) && !empty($terms)) { $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $terms)); } // Query posts $my_query = new WP_Query($query_args); // If there are posts loop through them if ($my_query->have_posts()) { // Loop through posts while ($my_query->have_posts()) { $my_query->the_post(); ?> <?php // Get post thumbnail $thumbnail = wpex_get_post_thumbnail(array('size' => $img_size, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); ?> <?php // Get hover classes if ($img_hover) { $hover_classes = ' ' . wpex_image_hover_classes($img_hover); } else { $hover_classes = ''; } ?> <li class="wpex-widget-recent-posts-li clr"> <?php if ($thumbnail) { ?> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> " class="wpex-widget-recent-posts-thumbnail<?php echo $hover_classes; ?> "><?php echo $thumbnail; ?> </a> <?php } ?> <a href="<?php wpex_permalink(); ?> " title="<?php wpex_esc_title(); ?> " class="wpex-widget-recent-posts-title"><?php the_title(); ?> </a> <?php // Display date if enabled if ('1' != $date) { ?> <div class="wpex-widget-recent-posts-date"> <?php echo get_the_date(); ?> </div><!-- .wpex-widget-recent-posts-date --> <?php } ?> </li><!-- .wpex-widget-recent-posts-li --> <?php } ?> <?php } ?> </ul><!-- .wpex-widget-recent-posts --> <?php wp_reset_postdata(); ?> <?php // After widget WordPress hook echo $args['after_widget']; }
$img_alt = 'alt="' . $img_alt . '"'; } // The image string $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => $style . $border_color)); // No Image so bail. if ($img == NULL) { $thumbnail = '<img src="' . get_template_directory_uri() . '/images/dummy-image.jpg" />'; $img = array('thumbnail' => $thumbnail); } $el_class = $this->getExtraClass($el_class); $link_to = ''; $a_class = ''; // Wrapper Classes $wrapper_classes = array('vc_single_image-wrapper'); if ($img_hover) { $wrapper_classes[] = wpex_image_hover_classes($img_hover); } if ($style) { $wrapper_classes[] = $style; } if ($border_color) { $wrapper_classes[] = $border_color; } $wrapper_classes = implode(' ', $wrapper_classes); // Gallery Lightbox if ($lightbox_gallery) { vcex_enque_style('ilightbox'); $gallery_ids = explode(",", $lightbox_gallery); if ($gallery_ids && is_array($gallery_ids)) { $gallery_images = ''; $count = 0;