function thb_teammember($atts, $content = null) { extract(shortcode_atts(array('image' => '', 'name' => '', 'position' => '', 'facebook' => '', 'twitter' => '', 'googleplus' => '', 'linkedin' => ''), $atts)); $out = ''; $img_id = preg_replace('/[^\\d]/', '', $image); $img = wp_get_attachment_image_src($img_id, 'full'); $resized = aq_resize($img[0], 270, 270, true, false); $out .= '<aside class="team_member">'; $out .= '<img src="' . $resized[0] . '" width="' . $resized[1] . '" height="' . $resized[2] . '" alt="' . $name . '" />'; $out .= $name ? '<strong>' . $name . '</strong>' : ''; $out .= $position ? '<small>' . $position . '</small>' : ''; if ($facebook || $googleplus || $twitter || $linkedin) { $out .= '<div class="social_links">'; if ($facebook) { $out .= '<a href="' . $facebook . '" class="facebook icon-2x"><i class="fa fa-facebook"></i></a>'; } if ($twitter) { $out .= '<a href="' . $twitter . '" class="twitter icon-2x"><i class="fa fa-twitter"></i></a>'; } if ($googleplus) { $out .= '<a href="' . $googleplus . '" class="google-plus icon-2x"><i class="fa fa-google-plus"></i></a>'; } if ($linkedin) { $out .= '<a href="' . $linkedin . '" class="linkedin icon-2x"><i class="fa fa-linkedin"></i></a>'; } $out .= '</div>'; } $out .= '</aside>'; return $out; }
function getCameraHTML($slider_result) { $options = get_option($slider_result->option_name); $html = '<div class="clearfix ut-slider-wrap"><div class="camera_white_skin cameraslider_' . $slider_result->id . ' camera_wrap">'; $z = 0; if (is_array($options['slides'])) { foreach ($options['slides'] as $slide) { if ($slide['imgurl']) { $html .= '<div data-thumb="' . aq_resize($slide['imgurl'], 50, 50, true) . '" data-src="' . $slide['imgurl'] . '">'; } if (!$slide['imgurl']) { $html .= '<div data-src="' . get_template_directory_uri() . '/images/blank.gif">'; } if ($slide['video']) { $html .= '<div class="caption_play"><a data-rel="prettySlider" href="' . extractURL($slide['video']) . '">PLAY</a></div>'; } if ($slide['caption_desc'] || $slide['caption_text']) { $html .= '<div class="camera_caption fadeIn"><div class="captionwrap"><div class="nevada-caption ' . $slide['caption_color'] . ' ' . $slide['caption_align'] . '"><h2>' . $slide['caption_text'] . '</h2>'; } if ($slide['caption_desc']) { $html .= '<p>' . $slide['caption_desc'] . '</p>'; } if ($slide['buttontext']) { $html .= '<a href="' . $slide['caption_link'] . '" class="excerpt">' . $slide['buttontext'] . '</a>'; } if ($slide['caption_desc'] || $slide['caption_text']) { $html .= '</div></div></div>'; } $html .= '</div>'; $z++; } } $html .= '</div></div>'; return $html; }
function thb_teammember($atts, $content = null) { extract(shortcode_atts(array('image' => '', 'name' => '', 'position' => '', 'text' => '', 'advanced' => false, 'facebook' => '', 'twitter' => '', 'pinterest' => '', 'linkedin' => ''), $atts)); $out = ''; $img_id = preg_replace('/[^\\d]/', '', $image); $img = wp_get_attachment_image_src($img_id, 'full'); $resized = aq_resize($img[0], 320, 340, true, false, true); $out .= '<aside class="team_member">'; $out .= '<figure class="fresco">'; $out .= '<img src="' . $resized[0] . '" width="' . $resized[1] . '" height="' . $resized[2] . '" alt="' . $name . '" />'; $out .= '<div class="overlay"><div class="buttons ' . ($advanced ? 'advanced' : '') . '">'; $out .= $name ? '<h5>' . $name . '</h5>' : ''; $out .= $position ? '<h6>' . $position . '</h6>' : ''; if ($facebook || $pinterest || $twitter || $linkedin) { $out .= '<div class="social_links">'; if ($facebook) { $out .= '<a href="' . $facebook . '" class="facebook"><i class="fa fa-facebook"></i></a>'; } if ($twitter) { $out .= '<a href="' . $twitter . '" class="twitter"><i class="fa fa-twitter"></i></a>'; } if ($pinterest) { $out .= '<a href="' . $pinterest . '" class="pinterest"><i class="fa fa-pinterest"></i></a>'; } if ($linkedin) { $out .= '<a href="' . $linkedin . '" class="linkedin"><i class="fa fa-linkedin"></i></a>'; } $out .= '</div>'; } $out .= '</div></div>'; $out .= '</figure>'; $out .= '</aside>'; return $out; }
function thb_slider($atts, $content = null) { extract(shortcode_atts(array('images' => '', 'width' => '1170', 'height' => '540', 'bullets' => '', 'navigation' => ''), $atts)); $images = explode(',', $images); ob_start(); $nav = $navigation == 'true' ? 'true' : 'false'; $bul = $bullets == 'true' ? 'true' : 'false'; ?> <div class="carousel-container bottom-pagination"> <div class="carousel owl" data-columns="1" data-navigation="<?php echo $nav; ?> " data-pagination="<?php echo $bul; ?> "> <?php foreach ($images as $image) { $image_link = wp_get_attachment_image_src($image, 'full'); $image_src = aq_resize($image_link[0], $width, $height, true, false, true); $image_title = get_post($image)->post_excerpt; ?> <figure class="wp-caption"> <img src="<?php echo $image_src[0]; ?> " width="<?php echo $image_src[1]; ?> " height="<?php echo $image_src[2]; ?> " alt="<?php echo $image_title; ?> " /> <?php if ($image_title) { ?> <p class="wp-caption-text"><?php echo $image_title; ?> </p> <?php } ?> </figure> <?php } ?> </div> </div> <?php $out = ob_get_contents(); if (ob_get_contents()) { ob_end_clean(); } return $out; }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $number = apply_filters('widget_number', $instance['number']); $order = apply_filters('widget_order', $instance['order']); $post_type = apply_filters('widget_post_type', $instance['post_type']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="wpex-widget-recent-posts"> <?php global $post; $args = array('post_type' => $post_type, 'numberposts' => $number, 'orderby' => $order, 'no_found_rows' => true); $myposts = get_posts($args); foreach ($myposts as $post) { setup_postdata($post); if (has_post_thumbnail()) { ?> <li class="clearfix wpex-widget-recent-posts-li"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="wpex-widget-recent-posts-thumbnail"><img src="<?php echo aq_resize(wp_get_attachment_url(get_post_thumbnail_id()), 65, 65, true); ?> " alt="<?php the_title(); ?> " /></a> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="wpex-widget-recent-posts-title"><?php the_title(); ?> </a> <div class="wpex-widget-recent-posts-date"><?php echo get_the_date(); ?> </div> </li> <?php } } wp_reset_postdata(); ?> </ul> <?php echo $after_widget; }
/** * The Featured Thumbnail * * @since 1.0.0 */ function resize_thumbnail_by_url($url, $title, $width, $height, $crop) { if (function_exists('aq_resize')) { $thumbnail = aq_resize($url, $width, $height, $crop, false); $html = '<img width="' . $thumbnail[1] . '" height="' . $thumbnail[2] . '" src="' . $thumbnail[0] . '" alt="' . $title . '" title="' . $title . '" />'; return $html; } }
public function resizeByRatio($ratio) { if (is_string($ratio)) { $ratioArr = explode(':', $ratio); $ratio = $ratioArr[0] / $ratioArr[1]; } return \aq_resize($this->image->url, $this->image->width, round($ratio * $this->image->width), true); }
function vntd_thumb($w, $h = null) { require_once dirname(__FILE__) . '/../../includes/aq_resizer.php'; global $post; $imgurl = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); return $imgurl[0]; return aq_resize($imgurl[0], $w, $h, true); }
function waxom_thumb($w, $h = null) { require_once get_template_directory() . '/includes/aq_resizer.php'; global $post; $imgurl = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); return $imgurl[0]; return aq_resize($imgurl[0], $w, $h, true); }
function woocommerce_template_loop_product_thumbnail() { global $post; $details = get_option('shop_catalog_image_size'); $url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $resized_image = aq_resize($url[0], $details['width'], $details['height'], $details['crop']); echo '<a href="' . get_permalink() . '"><img src="' . $resized_image . '" alt="' . get_the_title() . '" /></a>'; }
protected function content($atts, $content = null) { $title = $width = $el_class = $output = $tax_terms = $filter = $items = $el_position = ''; extract(shortcode_atts(array('title' => '', 'item_count' => '-1', 'category' => '', 'pagination' => 'no', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts)); // CATEGORY SLUG MODIFICATION if ($category == "All") { $category = "all"; } if ($category == "all") { $category = ''; } $category_slug = str_replace('_', '-', $category); // CLIENTS QUERY SETUP global $post, $wp_query; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $client_args = array('post_type' => 'clients', 'post_status' => 'publish', 'paged' => $paged, 'clients-category' => $category_slug, 'posts_per_page' => $item_count); $clients_items = new WP_Query($client_args); $items .= '<ul class="clients-items clearfix">'; $client_width = 135; $client_height = 135; // CLIENTS LOOP while ($clients_items->have_posts()) { $clients_items->the_post(); $client_image = get_post_thumbnail_id(); $client_img_url = wp_get_attachment_url($client_image, 'full'); $client_link_url = get_post_meta($post->ID, 'sf_client_link', true); $items .= '<li class="clearfix client-item">'; $items .= '<figure>'; $image = aq_resize($client_img_url, $client_width, $client_height, true, false); if ($image) { if ($client_link_url) { $items .= '<a href="' . $client_link_url . '"><img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" /></a>'; } else { $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" />'; } } $items .= '</figure>'; } wp_reset_postdata(); $items .= '</ul>'; // PAGINATION if ($pagination == "yes") { $items .= '<div class="pagination-wrap full-width">'; $items .= pagenavi($clients_items); $items .= '</div>'; } // PAGE BUILDER OUPUT $el_class = $this->getExtraClass($el_class); $width = wpb_translateColumnWidthToSpan($width); $output .= "\n\t" . '<div class="wpb_clients_widget wpb_content_element ' . $width . $el_class . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper clients-wrap">'; $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading wpb_text_heading">' . $title . '</h3></div>' : ''; $output .= "\n\t\t\t\t" . $items; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment($width); $output = $this->startRow($el_position) . $output . $this->endRow($el_position); return $output; }
function ajax_load_portfolio() { $ST_core = new ST_core(); global $wpdb; global $post; $number = $_POST['number']; $currFilter = $_POST['currFilter']; $portfolio_column = $_POST['portfolio_column']; $args = array('post_type' => 'portfolio', 'posts_per_page' => $number); //$query_post = $wpdb->get_results("SELECT * FROM `posts` WHERE `post_type` LIKE 'portfolio'"); $query_post = new WP_Query($args); $html = ''; $counter = 0; $array_portfolio_info = ""; if ($query_post->have_posts()) { while ($query_post->have_posts()) { $query_post->the_post(); $post_term = get_the_terms($post->ID, 'categories-portfolio'); $currFilter = ltrim($currFilter, '.'); if ($post_term) { $class_por = ""; $i = 0; foreach ($post_term as $termp) { $class_por .= $termp->slug . ' '; if ($currFilter == $termp->slug) { $i = $i + 1; } } } //$currFilter_class = '';if($i == 'filtered') { $currFilter_class = 'filtered';} //print_r($post_term); $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($query_post->post->ID), 'large'); $url = $thumb['0']; $resize = aq_resize($url, 555, 300, true, true, true); $html .= '<article class="' . $portfolio_column . ' col-sm-6 project-item ' . $class_por . ' '; if ($i == 0) { $html .= 'filtered'; } $html .= ' in">'; $html .= '<div class="project-thumb in">'; $html .= '<a href="#" class="main-link">'; $html .= '<img class="img-responsive img-center" src="' . $resize . '" alt="">'; $html .= '<h2 class="project-title">' . get_the_title() . '</h2>'; $html .= '<span class="overlay-mask"></span>'; $html .= '</a>'; $html .= '<a class="enlarge cboxElement" href="' . $url . '" title="' . get_the_title() . '"><i class="fa fa-expand fa-fw"></i></a>'; $html .= '<a class="link" href="' . get_permalink() . '"><i class="fa fa-eye fa-fw"></i></a>'; $html .= '</div>'; $html .= '</article>'; $array_portfolio_info[$counter] = array(0 => get_the_title(), 1 => $url); $counter = $counter + 1; } } wp_reset_query(); //echo $html; echo json_encode(array('massage' => apply_filters('filter_portfolio_azax_backend', $html)), JSON_HEX_QUOT | JSON_HEX_TAG); die; }
protected function content($atts, $content = null) { $title = $width = $el_class = $output = $filter = $items = $el_position = ''; extract(shortcode_atts(array('title' => '', "item_count" => '12', "category" => '', 'pagination' => '', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts)); // CATEGORY SLUG MODIFICATION if ($category == "All") { $category = "all"; } if ($category == "all") { $category = ''; } $category_slug = str_replace('_', '-', $category); global $post, $wp_query; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $team_args = array('post_type' => 'team', 'post_status' => 'publish', 'paged' => $paged, 'team-category' => $category_slug, 'posts_per_page' => $item_count, 'ignore_sticky_posts' => 1); $team_members = new WP_Query($team_args); $count = 0; $items .= '<ul class="team-members clearfix">'; while ($team_members->have_posts()) { $team_members->the_post(); $member_name = get_the_title(); $member_position = get_post_meta($post->ID, 'sf_team_member_position', true); $member_image = get_post_thumbnail_id(); $member_page_link = get_permalink(); $items .= '<li data-id="id-' . $count . '" class="clearfix team-member four columns">'; $img_url = wp_get_attachment_url($member_image, 'full'); $image = aq_resize($img_url, 220, 298, true, false); $items .= '<figure>'; if ($image) { $items .= '<a href="' . $member_page_link . '"><img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $member_name . '" /></a>'; } $items .= '</figure>'; $items .= '<h4 class="team-member-name">' . $member_name . '</h4>'; $items .= '<h5 class="team-member-position">' . $member_position . '</h5>'; $items .= '<a class="read-more" href="' . $member_page_link . '">' . __("Find out more", "swiftframework") . '<i class="icon-chevron-right"></i></a>'; $items .= '</li>'; $count++; } wp_reset_postdata(); $items .= '</ul>'; // PAGINATION if ($pagination == "yes") { $items .= '<div class="pagination-wrap full-width">'; $items .= pagenavi($team_members); $items .= '</div>'; } $el_class = $this->getExtraClass($el_class); $width = wpb_translateColumnWidthToSpan($width); $output .= "\n\t" . '<div class="team_list_widget wpb_content_element ' . $width . $el_class . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= $title != '' ? "\n\t\t\t" . '<h3 class="wpb_heading">' . $title . '</h3>' : ''; $output .= "\n\t\t\t\t" . $items; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment($width); $output = $this->startRow($el_position) . $output . $this->endRow($el_position); return $output; }
function coupon_new_home_coupons_list($category_id, $thumb, $discount, $date, $daysleft) { ?> <li class="coupon_new_li"> <a href="<?php echo get_category_link($category_id); ?> " class="coupon_new_link"> <div class="coupon_new_wrapper"> <div class="coupon_new_logo" > <img class="coupon_new_logo_img" src="<?php echo aq_resize($thumb, 75, 60, true); ?> " alt="<?php the_title(); ?> "> </div> <div class="coupon_new_text"> <div class="coupon_new_title"> <h2 class="coupon_title_font" style="margin:0;"><?php truncate_title(38); ?> </h2> </div> <!--Change: New Font for class 13.11.2015--> <div class="coupon_new_discount"> <?php if ($discount != '') { ?> <span class="value secondary"><?php echo $discount; ?> </span> <?php } ?> <span class="coupon_new_expire"> <?php if ($date == '') { _e('有效', 'Couponize'); } else { if ($daysleft <= 0) { _e('已过期', 'Couponize'); } else { echo sprintf(_n('%d天后过期', '%d天后过期', $daysleft, 'Couponize'), $daysleft); } } ?> </span> </div> </div> </div> </a> </li> <?php }
function getUserImage($dimension) { if (class_exists('Aq_Resize')) { $image = \get_field('quan_userimage', 'user_' . $this->user->ID); if (!empty($image)) { $resized = \aq_resize($image['url'], $dimension, $dimension, true); return $resized ? $resized : $image['url']; } } }
protected function content($atts, $content = null) { $width = $el_class = $output = $items = $image = $el_position = ''; extract(shortcode_atts(array("item_count" => '12', "full_width" => "", 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts)); global $post, $wp_query; $args = array('post_type' => 'showcase', 'post_status' => 'publish', 'posts_per_page' => $item_count, 'ignore_sticky_posts' => 1); $showcase_items = query_posts($args); $count = 0; if (have_posts()) { $items .= '<div class="home-slider-wrap"> <div id="home-slider" class="flexslider"> <ul class="slides">'; while (have_posts()) { the_post(); $items .= '<li>'; $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb, 'full'); if ($full_width) { $image = aq_resize($img_url, 1000, 480, true, false); } else { $image = aq_resize($img_url, 940, 480, true, false); } $slide_link = get_post_meta($post->ID, 'sf_slide_link', true); $items .= '<figure>'; if ($slide_link) { $items .= '<a href="' . $slide_link . '" target="_blank">'; if ($image) { $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" />'; } $items .= '</a>'; } else { if ($image) { $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" />'; } } $items .= '</figure></li>'; } wp_reset_query(); $items .= '</ul></div></div>'; } $el_class = $this->getExtraClass($el_class); $width = wpb_translateColumnWidthToSpan($width); if ($full_width == "yes") { $output .= "\n\t" . '<div class="wpb_showcase_widget full-width wpb_content_element ' . $width . $el_class . '">'; } else { $output .= "\n\t" . '<div class="wpb_showcase_widget wpb_content_element ' . $width . $el_class . '">'; } $output .= "\n\t\t" . '<div class="wpb_wrapper showcase-wrap">'; $output .= "\n\t\t\t\t" . $items; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment($width); $output = $this->startRow($el_position) . $output . $this->endRow($el_position); return $output; }
function kobu_get_featured_img_url($attachment_id = '', $full_image = false, $main_query = true) { // Post Vars global $post, $kobu_query; $post_id = $post->ID; $post_type = get_post_type($post_id); $attachment_id = $attachment_id ? $attachment_id : get_post_thumbnail_id($post_id); $attachment_url = wp_get_attachment_url($attachment_id); // Resizing Vars $width = 9999; $height = 9999; $crop = false; // Return full image url if set to true if ($full_image) { return $attachment_url; } /** Pages **/ if ($post_type == 'page' && is_singular('page')) { $width = '9999'; $height = '9999'; } /** Standard post **/ if ($post_type == 'post') { if (is_singular() && !$wpex_query) { $width = '640'; $height = '340'; } else { $width = '640'; $height = '340'; } } /** Search retuls **/ if (is_search()) { $width = '150'; $height = '150'; } // Return Dimensions & crop $width = intval($width); $width = $width ? $width : '9999'; $height = intval($height); $height = $height ? $height : '9999'; $width = apply_filters('kobu_featured_image_width', $width); $height = apply_filters('kobu_featured_image_height', $height); $crop = $height == '9999' ? false : true; $cropped_image = aq_resize($attachment_url, $width, $height, $crop); $cropped_image = apply_filters('kobu_get_featured_img_url', $cropped_image); return $cropped_image; }
public static function get_image($img_src, $alias) { if (empty($alias)) { return $img_src; } $al = explode('x', $alias); include_once MetaDataFilterCore::get_application_path() . 'lib/aq_resizer.php'; $new_img_src = aq_resize($img_src, $al[0], $al[1], true); if (!$new_img_src) { } return $new_img_src; }
function kreativa_related_media($w, $h) { ?> <div class="ImageWrapper"> <?php if (get_post_gallery()) { $gallery = get_post_gallery(get_the_ID(), false); ?> <div class="slider"> <div class="fullwidthbanner-container"> <div class="fullwidthbanner"> <ul> <?php foreach ($gallery['src'] as $src) { $img_url = wp_get_attachment_image_src($src); $n_img = aq_resize($src, $width = $w, $height = $h, $crop = true, $single = true, $upscale = true); ?> <li class="first-slide" data-transition="fade" data-slotamount="10" data-masterspeed="300"> <img class="img-responsive" src="<?php echo esc_url($n_img); ?> " alt="" data-fullwidthcentering="on" alt="slide"> </li> <?php } ?> </ul> </div> </div> </div> <?php } ?> <?php if (has_post_thumbnail() && !get_post_gallery()) { $thumbnail = get_post_thumbnail_id(); $img_url = wp_get_attachment_image_src($thumbnail, 'full'); $n_img = aq_resize($img_url[0], $width = $w, $height = $h, $crop = true, $single = true, $upscale = true); //get img URL ?> <div class="portfolio-media"> <img src="<?php echo esc_url($n_img); ?> " class="img-responsive"/></div> <?php } ?> </div> <?php }
function images_sc($atts, $content) { extract(shortcode_atts(array('src' => '', 'width' => '', 'height' => '', 'title' => '', 'lightbox' => '', 'url' => '', 'frame' => '', 'framecolor' => '', 'frameborder' => '', 'align' => '', 'float' => ''), $atts)); if ($lightbox == 'yes') { $lightbox = 'href="' . $src . '"'; $cbox_class = 'lightbox_img'; } elseif ($lightbox == 'no') { $lightbox = ''; $cbox_class = ''; } if ($url != '' && $lightbox != 'yes') { $url = 'href="' . $url . '"'; } if ($frame == '') { $frame = ''; } elseif ($frame == 'light') { $frame = 'class="light"'; } elseif ($frame == 'dark') { $frame = 'class="dark"'; } elseif ($frame == 'custom') { $frame = 'class="light"'; } if ($frame != '') { $width = $width - 16; } if ($align == 'left') { $align = 'text-align:left;'; } elseif ($align == 'right') { $align = 'text-align:right;'; } elseif ($align == 'center') { $align = 'text-align:center;'; } if ($float == '') { $float = ''; } elseif ($float == 'left') { $float = 'imgsc_left'; } elseif ($float == 'right') { $float = 'imgsc_right'; } if ($framecolor == '') { $framecolor = ''; } else { $framecolor = 'background-color:' . $framecolor . ';'; } if ($frameborder == '') { $frameborder = ''; } else { $frameborder = 'border-color:' . $frameborder . ';'; } $imgsc = aq_resize($src, $width, $height, true); return '<div class="' . $float . '" style="' . $align . '"><a class="image_sc ' . $cbox_class . '" ' . $lightbox . $url . ' title="' . $title . '" rel="group"><img ' . $frame . ' style="' . $framecolor . $frameborder . '" src="' . $imgsc . '" alt="' . $title . '" /></a></div>'; }
function woocommerce_template_loop_product_thumbnail() { global $post; global $product; $details = get_option('shop_catalog_image_size'); $url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $resized_image = aq_resize($url[0], $details['width'], $details['height'], $details['crop']); echo '<figure>'; if ($product->is_on_sale()) { echo '<span class="onsale">' . __('Sale!', 'zonya') . '</span>'; } echo '<a href="' . get_permalink() . '"><div class="text-overlay"><div class="info">' . get_the_title() . '</div></div><img src="' . $resized_image . '" alt="' . get_the_title() . '" /></a></figure>'; }
/** * Abstract Function to Call Aqua Resizer */ function ld_aq_resize($attachment_id, $width = null, $height = null, $crop = true, $single = true) { if (is_null($attachment_id)) { return null; } $image = wp_get_attachment_image_src($attachment_id, 'full'); $return = aq_resize($image[0], $width, $height, $crop, $single); if ($return) { return $return; } else { return $image[0]; } }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $post_type = apply_filters('widget_post_type', $instance['post_type']); $number = apply_filters('widget_number', $instance['number']); $order = apply_filters('widget_order', $instance['order']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="wpex-recent-posts-thumb-grid clearfix"> <?php global $post; $args = array('post_type' => $post_type, 'numberposts' => $number, 'orderby' => $order, 'no_found_rows' => true, 'meta_query' => array(array('key' => '_thumbnail_id'))); $myposts = get_posts($args); $wpex_rpw_count = 0; foreach ($myposts as $post) { setup_postdata($post); $wpex_rpw_count++; if (has_post_thumbnail()) { ?> <li class="col-<?php echo $wpex_rpw_count; ?> "><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><img src="<?php echo aq_resize(wp_get_attachment_url(get_post_thumbnail_id()), '65', '65', true); ?> " alt="<?php the_title(); ?> " /></a></li> <?php } if ($wpex_rpw_count == 3) { $wpex_rpw_count = '0'; } } wp_reset_postdata(); ?> </ul> <?php echo $after_widget; }
function wpex_entry_thumbnail() { ?> <?php if (!has_post_thumbnail()) { return; } // Overlay Icon $url = get_permalink(); $overlay_icon = 'fa fa-plus'; $extra_classes = ''; $format = get_post_format(); if ('gallery' == $format) { $overlay_icon = 'fa-picture-o'; } elseif ('audio' == $format) { $overlay_icon = 'fa-music'; } elseif ('link' == $format) { $url = get_post_meta(get_the_ID(), 'wpex_post_url', true) ? get_post_meta(get_the_ID(), 'wpex_post_url', true) : get_the_permalink(); $overlay_icon = 'fa-link'; } elseif ('image' == $format) { $url = wp_get_attachment_url(get_post_thumbnail_id()); $extra_classes = 'fancybox'; $overlay_icon = 'fa-arrows-alt'; } ?> <a href="<?php echo $url; ?> " title="<?php the_title(); ?> " class="loop-entry-img-link <?php echo $extra_classes; ?> "> <img src="<?php echo aq_resize(wp_get_attachment_url(get_post_thumbnail_id()), wpex_img_size('entry', 'width'), wpex_img_size('entry', 'height'), wpex_img_size('entry', 'crop')); ?> " alt="<?php echo the_title(); ?> " /> <div class="entry-overlay"><span class="fa <?php echo $overlay_icon; ?> "></span></div> </a> <?php }
function thb_clients($atts, $content = null) { extract(shortcode_atts(array('images' => ''), $atts)); $all_images = explode(',', $images); $output = ''; $output .= '<div class="carousel-container"><div class="owl carousel clients row" data-columns="6" data-navigation="true">'; foreach ($all_images as $img_id) { $img = wp_get_attachment_image_src($img_id, 'full'); $resized = aq_resize($img[0], 185, 130, true, false); $output .= '<div class="client two columns">'; $output .= '<img src="' . $resized[0] . '" />'; $output .= '</div>'; } $output .= '</div></div>'; return $output; }
function folio_get_posts_array($post_type = '', $get_by = 'image') { $posts = ''; $qry = new WP_Query(array('post_type' => $post_type, 'posts_per_page' => -1)); if ($qry->have_posts()) { while ($qry->have_posts()) { $qry->the_post(); if ($get_by == 'id') { $posts[get_the_ID()] = get_the_title(); } elseif ($get_by == 'image') { $posts[' <img src="' . aq_resize(folio_get_featured_image(get_the_id()), 32, 32, true) . '" alt="" title="' . get_the_title() . '" />'] = get_the_ID(); } } } return $posts; }
function teo_resize($url, $width, $height, $try = 0) { //$try will try to get a 2x image, for better display on mobiles $thumb = ''; if ($try == 1) { $thumb = aq_resize($url, $width * 2, $height * 2, true, true); } if ($thumb == '') { $thumb = aq_resize($url, $width, $height, true, true); } //if thumb is still empty, we return the original image(the image is either too small or it's from an external website) if ($thumb == '') { $thumb = $url; } return $thumb; }
public static function get_image($img_src, $alias, $show_cap = true) { if (empty($alias)) { return $img_src; } $al = explode('*', $alias); $new_img_src = aq_resize($img_src, $al[0], $al[1], true); $caps = TMM::get_option('dark') == '1' ? 'caps_dark' : 'caps_light'; if (!$new_img_src) { if ($show_cap) { $al = str_replace('*', 'x', $alias); return TMM_THEME_URI . '/images/' . $caps . '/no-image_' . $al . '.jpg'; } } return $new_img_src; }
function cq_vc_mediumgallery_func($atts, $content = null, $tag) { if (version_compare(WPB_VC_VERSION, "4.6") >= 0) { $atts = vc_map_get_attributes($tag, $atts); extract($atts); } else { extract(shortcode_atts(array('images' => '', 'gallerywidth' => '', 'thumbwidth' => '', 'lowreswidth' => '', 'background' => '', 'gutter' => '', 'extra_class' => '', 'titles' => '', 'alts' => '', 'layoutno' => '21343522341234232233'), $atts)); } wp_register_style('vc_mediumgallery_cq_style', plugins_url('css/style.css', __FILE__)); wp_enqueue_style('vc_mediumgallery_cq_style'); wp_register_script('photosetgrid', plugins_url('js/jquery.photosetgrid.min.js', __FILE__), array("jquery")); wp_enqueue_script('photosetgrid'); wp_register_script('fluidbox', plugins_url('js/jquery.fluidbox.min.js', __FILE__), array('jquery')); wp_enqueue_script('fluidbox'); wp_register_style('fluidbox', plugins_url('css/fluidbox.css', __FILE__)); wp_enqueue_style('fluidbox'); wp_register_script('photosetgrid_init', plugins_url('js/init.min.js', __FILE__), array("jquery", "photosetgrid", "fluidbox")); wp_enqueue_script('photosetgrid_init'); // $aligncenter = $aligncenter == 'center' ? 'center' : ''; $content = wpb_js_remove_wpautop($content); // fix unclosed/unwanted paragraph tags in $content $imagesarr = explode(',', $images); $titlearr = explode(',', $titles); $altarr = explode(',', $alts); $i = -1; $output = ''; $output .= '<div class="cq-medium-gallery" data-gallerywidth="' . $gallerywidth . '" data-background="' . $background . '" data-layoutno="' . $layoutno . '" data-lowreswidth="' . $lowreswidth . '" data-gutter="' . $gutter . '" style="margin:0 auto;">'; foreach ($imagesarr as $key => $image) { $i++; if (!isset($titlearr[$i])) { $titlearr[$i] = ''; } if (!isset($altarr[$i])) { $altarr[$i] = ''; } if (wp_get_attachment_image_src(trim($image), 'full')) { $return_img_arr = wp_get_attachment_image_src(trim($image), 'full'); if ($thumbwidth != "") { $output .= '<img src="' . aq_resize($return_img_arr[0], $thumbwidth, null, true, true, true) . '" data-highres="' . $return_img_arr[0] . '" class="mediumgallery-img ' . $extra_class . '" title="' . $titlearr[$i] . '" alt="' . $altarr[$i] . '" />'; } else { $output .= '<img src="' . $return_img_arr[0] . '" data-highres="' . $return_img_arr[0] . '" class="mediumgallery-img ' . $extra_class . '" title="' . $titlearr[$i] . '" alt="' . $altarr[$i] . '" />'; } } } $output .= '</div>'; return $output; }
function custom_gallery($atts, $content = null) { extract(shortcode_atts(array('width' => '150', 'height' => '150'), $atts)); ob_start(); $attachs = get_posts(array('numberposts' => -1, 'post_type' => 'attachment', 'post_parent' => get_the_ID(), 'post_mime_type' => 'image', 'output' => ARRAY_A)); if (!empty($attachs)) { foreach ($attachs as $att) { // get image's source based on size, can be 'thumbnail', 'medium', 'large', 'full' or registed post thumbnails sizes $imgsc = aq_resize($src, 217, 150, true); // show image echo '<div><img src="' . $src . '" alt="" /></div>'; } } $content = ob_get_contents(); ob_end_clean(); return $content; }