本文整理汇总了PHP中wc_get_image_size函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_image_size函数的具体用法?PHP wc_get_image_size怎么用?PHP wc_get_image_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_get_image_size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post, $woocommerce, $data;
if (!$placeholder_width) {
if (function_exists('wc_get_image_size')) {
$placeholder_width = wc_get_image_size('shop_catalog_image_width');
} else {
$placeholder_width = $woocommerce->get_image_size('shop_catalog_image_width');
}
}
if (!$placeholder_height) {
if (function_exists('wc_get_image_size')) {
$placeholder_height = wc_get_image_size('shop_catalog_image_height');
} else {
$placeholder_height = $woocommerce->get_image_size('shop_catalog_image_height');
}
}
$output = '<div class="image">';
if (has_post_thumbnail()) {
$width = '150';
$height = '130';
if (!empty($data['woo_cat_image_size'])) {
$width = $data['woo_cat_image_size']['width'];
$height = $data['woo_cat_image_size']['height'];
}
$image = vt_resize(get_post_thumbnail_id($post->ID), '', $width, $height, true);
$output .= '<a href="' . get_permalink() . '"><img src="' . $image['url'] . '" alt=""></a>';
} else {
$output .= '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />';
}
$output .= '</div>';
return $output;
}
开发者ID:sumovska,项目名称:jodi,代码行数:33,代码来源:zn-woocommerce-init.php
示例2: yit_get_image_size
/**
* Get default image size
*
* @param array $size current size
*
* @return array
* @author Lorenzo Giuffrida
* @since 1.0.0
*/
function yit_get_image_size($size)
{
if (function_exists('wc_get_image_size')) {
return wc_get_image_size($size);
} else {
global $woocommerce;
return $woocommerce->get_image_size($size);
}
}
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:18,代码来源:functions.yith-wcmg.php
示例3: yit_shop_thumbnail_w
/**
* Return the shop_thumbnail image width
*
* @return integer
* @since 1.0.0
*/
function yit_shop_thumbnail_w()
{
global $woocommerce;
if (function_exists('wc_get_image_size')) {
$size = wc_get_image_size('shop_thumbnail');
} else {
$size = $woocommerce->get_image_size('shop_thumbnail');
}
return $size['width'];
}
开发者ID:zgomotos,项目名称:Bazar,代码行数:16,代码来源:functions.yith-wcmg.php
示例4: woops_get_product_thumbnail
public static function woops_get_product_thumbnail($post_id, $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $woocommerce;
$woocommerce_db_version = get_option('woocommerce_db_version', null);
$shop_catalog = version_compare($woocommerce_db_version, '2.1', '<') ? $woocommerce->get_image_size('shop_catalog') : wc_get_image_size('shop_catalog');
if (is_array($shop_catalog) && isset($shop_catalog['width']) && $placeholder_width == 0) {
$placeholder_width = $shop_catalog['width'];
}
if (is_array($shop_catalog) && isset($shop_catalog['height']) && $placeholder_height == 0) {
$placeholder_height = $shop_catalog['height'];
}
if (has_post_thumbnail($post_id)) {
return get_the_post_thumbnail($post_id, $size);
}
$mediumSRC = '';
if (trim($mediumSRC == '')) {
$args = array('post_parent' => $post_id, 'numberposts' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'ID', 'post_status' => null);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
$mediumSRC = wp_get_attachment_image($attachment->ID, $size, true);
break;
}
}
}
if (trim($mediumSRC == '')) {
// Load the product
$product = get_post($post_id);
// Get ID of parent product if one exists
if (!empty($product->post_parent)) {
$post_id = $product->post_parent;
}
if (has_post_thumbnail($post_id)) {
return get_the_post_thumbnail($post_id, $size);
}
if (trim($mediumSRC == '')) {
$args = array('post_parent' => $post_id, 'numberposts' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'ID', 'post_status' => null);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
$mediumSRC = wp_get_attachment_image($attachment->ID, $size, true);
break;
}
}
}
}
if (trim($mediumSRC != '')) {
return $mediumSRC;
} else {
return '<img src="' . (version_compare($woocommerce_db_version, '2.1', '<') ? woocommerce_placeholder_img_src() : wc_placeholder_img_src()) . '" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />';
}
}
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:52,代码来源:class-wc-predictive-search.php
示例5: display_field
public function display_field($element = array(), $args = array())
{
$this->_columns++;
$this->grid_break = "";
$default_value = isset($element['default_value']) ? is_array($element['default_value']) ? in_array((string) $this->_default_value_counter, $element['default_value']) : false : false;
if ((double) $this->_columns > (double) $this->items_per_row && $this->items_per_row > 0) {
$this->grid_break = " cpf_clear";
$this->_columns = 1;
}
$hexclass = "";
$li_class = "";
$search_for_color = $args['label'];
if (isset($element['color'])) {
$search_for_color = $element['color'];
}
if (preg_match('/#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?\\b/', $search_for_color)) {
$size = 'shop_thumbnail';
$dimensions = wc_get_image_size($size);
$tmhexcolor = 'tmhexcolor_' . $args['element_counter'] . "_" . $args['field_counter'] . "_" . $args['tabindex'] . $args['form_prefix'];
$hexclass = $tmhexcolor;
$this->css_string = "." . $tmhexcolor . " + label .tmhexcolorimage{background-color:" . $search_for_color . " !important;}";
if (!empty($element['item_width'])) {
if (is_numeric($element['item_width'])) {
$element['item_width'] .= "px";
}
$this->css_string .= "." . $tmhexcolor . " + label .tmhexcolorimage{display: inline-block !important;width:" . $element['item_width'] . " !important;min-width:" . $element['item_width'] . " !important;max-width:" . $element['item_width'] . " !important;}";
}
if (!empty($element['item_height'])) {
if (is_numeric($element['item_height'])) {
$element['item_height'] .= "px";
}
$this->css_string .= "." . $tmhexcolor . " + label .tmhexcolorimage{display: inline-block !important;height:" . $element['item_height'] . " !important;min-height:" . $element['item_height'] . " !important;max-height:" . $element['item_height'] . " !important;}";
}
if (!empty($element['item_width']) || !empty($element['item_height'])) {
$this->css_string .= ".tmhexcolorimage-li.tm-li-unique-" . $args['element_counter'] . "-" . $args['field_counter'] . "-" . $args['tabindex'] . $args['form_prefix'] . "{display: inline-block;}";
$li_class .= "tmhexcolorimage-li tm-li-unique-" . $args['element_counter'] . "-" . $args['field_counter'] . "-" . $args['tabindex'] . $args['form_prefix'];
} else {
$li_class .= "tmhexcolorimage-li-nowh";
}
$this->css_string = str_replace(array("\r", "\n"), "", $this->css_string);
TM_EPO()->inline_styles = TM_EPO()->inline_styles . $this->css_string;
}
$display = array('li_class' => $li_class, 'class' => !empty($element['class']) ? $element['class'] . ' ' . $hexclass : "" . $hexclass, 'label' => wptexturize(apply_filters('woocommerce_tm_epo_option_name', $args['label'])), 'value' => esc_attr($args['value']), 'id' => 'tmcp_choice_' . $args['element_counter'] . "_" . $args['field_counter'] . "_" . $args['tabindex'] . $args['form_prefix'], 'textbeforeprice' => isset($element['text_before_price']) ? $element['text_before_price'] : "", 'textafterprice' => isset($element['text_after_price']) ? $element['text_after_price'] : "", 'hide_amount' => isset($element['hide_amount']) ? " " . $element['hide_amount'] : "", 'use_images' => $element['use_images'], 'use_lightbox' => isset($element['use_lightbox']) ? $element['use_lightbox'] : "", 'use_url' => $element['use_url'], 'grid_break' => $this->grid_break, 'items_per_row' => $this->items_per_row, 'percent' => $this->_percent, 'image' => isset($element['images'][$args['field_counter']]) ? $element['images'][$args['field_counter']] : "", 'imagep' => isset($element['imagesp'][$args['field_counter']]) ? $element['imagesp'][$args['field_counter']] : "", 'url' => isset($element['url'][$args['field_counter']]) ? $element['url'][$args['field_counter']] : "", 'limit' => empty($element['limit']) ? "" : $element['limit'], 'exactlimit' => empty($element['exactlimit']) ? "" : $element['exactlimit'], 'minimumlimit' => empty($element['minimumlimit']) ? "" : $element['minimumlimit'], 'swatchmode' => empty($element['swatchmode']) ? "" : $element['swatchmode'], 'tm_epo_no_lazy_load' => TM_EPO()->tm_epo_no_lazy_load, 'changes_product_image' => empty($element['changes_product_image']) ? "" : $element['changes_product_image'], 'default_value' => $default_value, 'quantity' => isset($element['quantity']) ? $element['quantity'] : "");
if (isset($element['color'])) {
$display["color"] = $element['color'];
}
$this->_default_value_counter++;
return $display;
}
开发者ID:baden03,项目名称:access48,代码行数:49,代码来源:class-tm-epo-fields-checkbox.php
示例6: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post, $woocommerce;
if (!$placeholder_width) {
$placeholder_width = wc_get_image_size('shop_catalog_image_width');
}
if (!$placeholder_height) {
$placeholder_height = wc_get_image_size('shop_catalog_image_height');
}
$output = '<a href="' . get_permalink() . '">';
if (has_post_thumbnail()) {
$output .= get_the_post_thumbnail($post->ID, $size);
} else {
$output .= '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />';
}
$output .= '</a>';
return $output;
}
开发者ID:Beutiste,项目名称:wordpress,代码行数:18,代码来源:config.php
示例7: woocommerce_subcategory_thumbnail
function woocommerce_subcategory_thumbnail($category)
{
$small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_catalog');
$dimensions = wc_get_image_size($small_thumbnail_size);
$thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true);
if ($thumbnail_id) {
$image = wp_get_attachment_image_src($thumbnail_id, $small_thumbnail_size);
$image = $image[0];
} else {
$image = wc_placeholder_img_src();
}
if ($image) {
// Prevent esc_url from breaking spaces in urls for image embeds
// Ref: http://core.trac.wordpress.org/ticket/23605
$image = str_replace(' ', '%20', $image);
echo '<img src="' . esc_url($image) . '" alt="' . esc_attr($category->name) . '"/>';
}
}
开发者ID:editiontirol,项目名称:site-theme,代码行数:18,代码来源:overwrites.php
示例8: yit_shop_featured_c
function yit_shop_featured_c()
{
$size = wc_get_image_size('shop_featured');
return $size['crop'];
}
开发者ID:lieison,项目名称:IndustriasFenix,代码行数:5,代码来源:woocommerce.php
示例9: woocommerce_subcategory_thumbnail
function woocommerce_subcategory_thumbnail($category)
{
$small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'product_small_thumbnail');
$thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_catalog');
$dimensions = wc_get_image_size($small_thumbnail_size);
$thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true);
if ($thumbnail_id) {
$image_small = wp_get_attachment_image_src($thumbnail_id, $small_thumbnail_size);
$image_small = $image_small[0];
$image = wp_get_attachment_image_src($thumbnail_id, $thumbnail_size);
$image = $image[0];
} else {
$image = $image_small = wc_placeholder_img_src();
}
if ($image_small) {
echo '<img data-src="' . esc_url($image) . '" class="lazyOwl" src="' . esc_url($image_small) . '" alt="' . esc_attr($category->name) . '" width="' . esc_attr($dimensions['width']) . '" height="' . esc_url($dimensions['height']) . '" />';
}
}
开发者ID:quyendam2612,项目名称:quanao,代码行数:18,代码来源:functions.php
示例10: avada_dynamic_css_array
//.........这里部分代码省略.........
$css['global']['.woocommerce-tabs > .tabs']['border-bottom'] = '1px solid #dddddd';
$css['global']['.woocommerce-tabs > .tabs li']['float'] = 'left';
$css['global']['.woocommerce-tabs > .tabs li a']['border'] = '1px solid transparent !important';
$css['global']['.woocommerce-tabs > .tabs li a']['padding'] = '10px 20px';
$css['global']['.woocommerce-tabs > .tabs .active']['border'] = '1px solid #dddddd';
$css['global']['.woocommerce-tabs > .tabs .active']['border-bottom'] = 'none';
$css['global']['.woocommerce-tabs > .tabs .active']['min-height'] = '40px';
$css['global']['.woocommerce-tabs > .tabs .active']['margin-bottom'] = '-1px';
$css['global']['.woocommerce-tabs > .tabs .active:hover a']['cursor'] = 'default';
$css['global']['.woocommerce-tabs .entry-content']['float'] = 'left';
$css['global']['.woocommerce-tabs .entry-content']['margin'] = '0px';
$css['global']['.woocommerce-tabs .entry-content']['width'] = '100%';
$css['global']['.woocommerce-tabs .entry-content']['border-top'] = 'none';
}
if ('0' != Avada_Color::get_alpha_from_rgba(Avada()->settings->get('timeline_bg_color'))) {
$css['global']['.products .product-list-view']['padding-left'] = '20px';
$css['global']['.products .product-list-view']['padding-right'] = '20px';
}
$elements = array('.fusion-item-in-cart .fusion-rollover-content .fusion-rollover-title', '.fusion-item-in-cart .fusion-rollover-content .fusion-rollover-categories', '.fusion-item-in-cart .fusion-rollover-content .price', '.fusion-carousel-title-below-image .fusion-item-in-cart .fusion-rollover-content .fusion-product-buttons', '.products .product .fusion-item-in-cart .fusion-rollover-content .fusion-product-buttons');
$css['global'][avada_implode($elements)]['display'] = 'none';
if ('clean' == Avada()->settings->get('woocommerce_product_box_design')) {
$css['global']['.fusion-woo-product-design-clean .products .fusion-rollover .star-rating span:before, .fusion-woo-product-design-clean .products .fusion-rollover .star-rating:before']['color'] = Avada_Sanitize::color(Avada()->settings->get('image_rollover_icon_color'));
$css['global']['.fusion-woo-product-design-clean .products .fusion-rollover-content .fusion-product-buttons, .fusion-woo-slider .fusion-product-buttons']['color'] = Avada_Sanitize::color(Avada()->settings->get('image_rollover_text_color'));
$css['global']['.fusion-woo-product-design-clean .products .fusion-rollover-content .fusion-product-buttons a, .fusion-woo-slider .fusion-product-buttons a']['color'] = Avada_Sanitize::color(Avada()->settings->get('image_rollover_text_color'));
$css['global']['.fusion-woo-product-design-clean .products .fusion-rollover-content .fusion-product-buttons a, .fusion-woo-slider .fusion-product-buttons a']['letter-spacing'] = '1px';
$css['global']['.fusion-woo-product-design-clean .products .fusion-rollover-content .fusion-rollover-linebreak, .fusion-woo-slider .fusion-product-buttons .fusion-rollover-linebreak']['color'] = Avada_Sanitize::color(Avada()->settings->get('image_rollover_text_color'));
}
// Make the single product page layout reflect the single image size in Woo settings
if (is_product()) {
$post_image = get_the_post_thumbnail(get_the_ID(), apply_filters('single_product_large_thumbnail_size', 'shop_single'));
if ($post_image) {
preg_match('@width="([^"]+)"@', $post_image, $match);
if ('500' != $match[1]) {
$shop_single_image_size = wc_get_image_size('shop_single');
$css['global']['.product .images']['width'] = $shop_single_image_size['width'] . 'px';
$css['global']['.product .summary.entry-summary']['margin-left'] = $shop_single_image_size['width'] + 30 . 'px';
}
}
}
}
$elements = array('html', 'body', 'html body.custom-background');
if (class_exists('WooCommerce')) {
$elements[] = '.woocommerce-tabs > .tabs .active a';
}
$css['global'][avada_implode($elements)]['background-color'] = Avada_Sanitize::color(Avada()->settings->get('content_bg_color'));
if ('Wide' == Avada()->settings->get('layout')) {
$css['global'][avada_implode($elements)]['background-color'] = Avada_Sanitize::color(Avada()->settings->get('content_bg_color'));
} elseif ('Boxed' == Avada()->settings->get('layout')) {
$css['global'][avada_implode($elements)]['background-color'] = Avada_Sanitize::color(Avada()->settings->get('bg_color'));
}
if (!$site_width_percent) {
$elements = array('#main', '.fusion-secondary-header', '.sticky-header .sticky-shadow', '.tfs-slider .slide-content-container', '.header-v4 #small-nav', '.header-v5 #small-nav', '.fusion-footer-copyright-area', '.fusion-footer-widget-area', '#slidingbar', '.fusion-page-title-bar');
$css['global'][avada_implode($elements)]['padding-left'] = '30px';
$css['global'][avada_implode($elements)]['padding-right'] = '30px';
$elements = array('.width-100 .nonhundred-percent-fullwidth', '.width-100 .fusion-section-separator');
$css['global'][avada_implode($elements)]['padding-left'] = $hundredplr_padding;
$css['global'][avada_implode($elements)]['padding-right'] = $hundredplr_padding;
$elements = array('.width-100 .fullwidth-box', '.width-100 .fusion-section-separator');
$css['global'][avada_implode($elements)]['margin-left'] = $hundredplr_padding_negative_margin . '!important';
$css['global'][avada_implode($elements)]['margin-right'] = $hundredplr_padding_negative_margin . '!important';
}
$css['global']['.fusion-mobile-menu-design-modern .fusion-mobile-nav-holder li a']['padding-left'] = '30px';
$css['global']['.fusion-mobile-menu-design-modern .fusion-mobile-nav-holder li a']['padding-right'] = '30px';
$css['global']['.fusion-mobile-menu-design-modern .fusion-mobile-nav-holder .fusion-mobile-nav-item .fusion-open-submenu']['padding-right'] = '35px';
$css['global']['.fusion-mobile-menu-design-modern .fusion-mobile-nav-holder .fusion-mobile-nav-item a']['padding-left'] = '30px';
$css['global']['.fusion-mobile-menu-design-modern .fusion-mobile-nav-holder .fusion-mobile-nav-item a']['padding-right'] = '30px';
开发者ID:pedrom40,项目名称:sazoo.org,代码行数:67,代码来源:dynamic_css.php
示例11: wc_get_image_size
<?php
/**
* Single Product Image
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.0.14
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
global $post, $woocommerce, $product;
// set the image container size
$img_size = wc_get_image_size('shop_single');
if (intval($img_size['width']) < $GLOBALS['content_width']) {
$img_size['width'] = intval($img_size['width']) * 100 / $GLOBALS['content_width'];
} else {
$img_size['width'] = 100;
}
?>
<div class="images" style="width:<?php
echo $img_size['width'];
?>
%;">
<?php
if (has_post_thumbnail()) {
$image_title = esc_attr(get_the_title(get_post_thumbnail_id()));
$image_link = wp_get_attachment_url(get_post_thumbnail_id());
开发者ID:lieison,项目名称:IndustriasFenix,代码行数:31,代码来源:product-image.php
示例12: get_image_size
/**
* @deprecated 2.1.0
* @param $image_size
* @return array
*/
public function get_image_size($image_size)
{
_deprecated_function('Woocommerce->get_image_size', '2.1', 'wc_get_image_size()');
return wc_get_image_size($image_size);
}
开发者ID:donwea,项目名称:nhap.org,代码行数:10,代码来源:woocommerce.php
示例13: lpd_subcategory_thumbnail
function lpd_subcategory_thumbnail($category)
{
$small_thumbnail_size = 'theme-size-1x1';
$dimensions = wc_get_image_size($small_thumbnail_size);
$thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true);
if ($thumbnail_id) {
$image = wp_get_attachment_image_src($thumbnail_id, $small_thumbnail_size);
$image = $image[0];
} else {
$image = wc_placeholder_img_src();
}
if ($image) {
// Prevent esc_url from breaking spaces in urls for image embeds
// Ref: http://core.trac.wordpress.org/ticket/23605
$image = str_replace(' ', '%20', $image);
echo '<img src="' . esc_url($image) . '" alt="' . esc_attr($category->name) . '" width="' . esc_attr($dimensions['width']) . '" height="' . esc_attr($dimensions['height']) . '" />';
}
}
开发者ID:ksan5835,项目名称:maadithottam,代码行数:18,代码来源:woocommerce.php
示例14: has_post_thumbnail
}
// Exit if accessed directly
global $post, $woocommerce, $product;
?>
<div class="images ms-product-slider">
<?php
$attachment_ids = $product->get_gallery_attachment_ids();
$image_count = has_post_thumbnail() ? 1 : 0;
$image_count += count($attachment_ids);
if ($image_count > 1) {
$enable_thumbnail = apply_filters('msp_woocommerce_display_thumbnail_for_single_product_slider', true);
$small_thumbnail_size = apply_filters('single_product_small_single_size', 'shop_thumbnail');
$thumbnail_dimensions = wc_get_image_size($small_thumbnail_size);
$large_single_size = apply_filters('single_product_large_single_size', 'shop_single');
$slide_image_dimensions = wc_get_image_size($large_single_size);
$slider_params = array('id' => $post->ID, 'uid' => '', 'class' => '', 'margin' => 0, 'inline_style' => '', 'bg_color' => '', 'bg_image' => '', 'slider_type' => 'custom', 'width' => $slide_image_dimensions['width'], 'height' => $slide_image_dimensions['height'], 'start' => 1, 'space' => 0, 'grab_cursor' => 'true', 'swipe' => 'true', 'wheel' => 'false', 'mouse' => 'true', 'crop' => 'false', 'autoplay' => 'false', 'loop' => 'false', 'shuffle' => 'false', 'preload' => 2, 'wrapper_width' => '', 'wrapper_width_unit' => 'px', 'layout' => 'fillwidth', 'fullscreen_margin' => 0, 'height_limit' => 'false', 'auto_height' => 'false', 'smooth_height' => 'true', 'end_pause' => 'false', 'over_pause' => 'false', 'fill_mode' => 'fill', 'center_controls' => 'true', 'layers_mode' => 'center', 'hide_layers' => 'false', 'instant_show_layers' => 'false', 'speed' => 17, 'skin' => 'ms-skin-default', 'template' => '', 'template_class' => '', 'direction' => 'h', 'view' => 'basic', 'gfonts' => '', 'parallax_mode' => 'swipe', 'arrows' => 'true', 'arrows_autohide' => 'true', 'arrows_overvideo' => 'true', 'arrows_hideunder' => '', 'bullets' => 'false', 'bullets_autohide' => 'true', 'bullets_overvideo' => 'true', 'bullets_direction' => 'h', 'bullets_align' => 'bottom', 'bullets_margin' => '', 'bullets_hideunder' => '', 'thumbs' => 'false', 'thumbs_autohide' => 'false', 'thumbs_overvideo' => 'true', 'thumbs_direction' => 'h', 'thumbs_type' => 'thumbs', 'thumbs_speed' => 17, 'thumbs_inset' => 'false', 'thumbs_align' => 'bottom', 'thumbs_margin' => 0, 'thumbs_width' => $thumbnail_dimensions['width'], 'thumbs_height' => $thumbnail_dimensions['height'], 'thumbs_space' => 0, 'thumbs_hideunder' => '', 'thumbs_fillmode' => 'fill', 'scroll' => 'false', 'scroll_autohide' => 'true', 'scroll_overvideo' => 'true', 'scroll_direction' => 'h', 'scroll_align' => 'top', 'scroll_inset' => 'true', 'scroll_margin' => '', 'scroll_color' => '#3D3D3D', 'scroll_hideunder' => '', 'scroll_width' => '', 'circletimer' => 'false', 'circletimer_autohide' => 'true', 'circletimer_overvideo' => 'true', 'circletimer_color' => '#A2A2A2', 'circletimer_radius' => 4, 'circletimer_stroke' => 10, 'circletimer_margin' => '', 'circletimer_hideunder' => '', 'timebar' => 'false', 'timebar_autohide' => 'true', 'timebar_overvideo' => 'true', 'timebar_align' => 'bottom', 'timebar_color' => '#FFFFFF', 'timebar_hideunder' => '', 'timebar_width' => '', 'slideinfo' => 'false', 'slideinfo_autohide' => 'true', 'slideinfo_overvideo' => 'true', 'slideinfo_direction' => 'h', 'slideinfo_align' => 'bottom', 'slideinfo_inset' => 'false', 'slideinfo_margin' => '', 'slideinfo_hideunder' => '', 'slideinfo_width' => '', 'slideinfo_height' => '');
if ($enable_thumbnail) {
$slider_params['thumbs'] = 'true';
}
$slider_params = apply_filters('msp_woocommerce_single_product_slider_params', $slider_params, $post);
// create ms_slider shortcode
$slider_attrs = '';
foreach ($slider_params as $attr => $attr_value) {
$slider_attrs .= sprintf('%s="%s" ', $attr, esc_attr($attr_value));
}
$slides = '';
if (has_post_thumbnail()) {
$image_title = esc_attr(get_the_title(get_post_thumbnail_id()));
$image_link = wp_get_attachment_url(get_post_thumbnail_id());
$image_src = msp_get_the_resized_image_src($image_link, $slide_image_dimensions['width'], $slide_image_dimensions['height'], $slide_image_dimensions['crop']);
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:31,代码来源:product-images.php
示例15: addImage_thumbnail
function addImage_thumbnail($filename, $parent_post_id)
{
include_once ABSPATH . 'wp-admin/includes/image.php';
#wp_insert_attachment
include_once ABSPATH . 'wp-includes/class-wp-image-editor.php';
include_once ABSPATH . 'wp-includes/media.php';
#wp_get_image_editor
//Upload Image in uploads folder
// Check the type of tile. We'll use this as the 'post_mime_type'.
$image_size = array();
$wp_upload_dir = @wp_upload_dir();
$content = @file_get_contents($filename);
$upload_file = @wp_upload_bits(basename($filename), null, $content);
$filetype = @wp_check_filetype(basename($filename), null);
$date = date("Y") . '/' . date('m');
$attachment = array('guid' => $wp_upload_dir['url'] . '/' . basename($filename), 'post_mime_type' => $filetype['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($filename)), 'post_content' => '', 'post_status' => 'inherit');
$image_size['shop_thumbnail'] = wc_get_image_size('shop_thumbnail');
$image_size['shop_catalog'] = wc_get_image_size('shop_catalog');
$image_size['shop_single'] = wc_get_image_size('shop_single');
$fileName = preg_replace('/^.*?\\/(\\d{4})\\/(\\d\\d)\\/(.*)$/', $wp_upload_dir['basedir'] . '/$1/$2/$3', $filename);
foreach ($image_size as $image_key => $size) {
$image = @wp_get_image_editor($fileName);
if (!is_wp_error($image)) {
$image->resize($size['width'], $size['height'], $size['crop']);
$image->save($wp_upload_dir['basedir'] . "/" . $date . '/' . basename($filename, "." . $filetype['ext']) . "-" . $size['width'] . "x" . $size['height'] . "." . $filetype['ext']);
}
$image_size[$image_key]['file'] = basename($filename, "." . $filetype['ext']) . "-" . $size['width'] . "x" . $size['height'] . "." . $filetype['ext'];
$image_size[$image_key]['mime-type'] = $filetype['type'];
// To unset the crop in the array image_size
unset($image_size[$image_key]['crop']);
}
$attach_id = @wp_insert_attachment($attachment, $date . '/' . basename($filename), $parent_post_id);
$attach_data = @wp_generate_attachment_metadata($attach_id, $wp_upload_dir['url'] . '/' . basename($filename));
// Generate the metadata for the attachment, and update the database record.
$attach_data['sizes'] = $image_size;
@wp_update_attachment_metadata($attach_id, $attach_data);
unset($filename);
unset($parent_post_id);
return $attach_id;
}
开发者ID:amanpreet8333,项目名称:linksync,代码行数:40,代码来源:Class.linksync.php
示例16: porto_adjacent_post_link_product
function porto_adjacent_post_link_product($in_same_cat = false, $excluded_categories = '', $previous = true)
{
if ($previous && is_attachment()) {
$post = get_post(get_post()->post_parent);
} else {
$post = porto_get_adjacent_post_product($in_same_cat, $excluded_categories, $previous);
}
if ($post) {
if ($previous) {
$label = 'prev';
} else {
$label = 'next';
}
$product = wc_get_product($post->ID);
?>
<div class="product-<?php
echo $label;
?>
">
<a href="<?php
echo get_permalink($post);
?>
" title="">
<span class="product-link"></span>
<span class="product-popup">
<span class="featured-box">
<span class="box-content">
<span class="product-image">
<span class="inner">
<?php
if (has_post_thumbnail($post->ID)) {
echo get_the_post_thumbnail($post->ID, apply_filters('single_product_small_thumbnail_size', 'shop_thumbnail'));
} else {
echo '<img src="' . wc_placeholder_img_src() . '" alt="Placeholder" width="' . wc_get_image_size('shop_thumbnail_image_width') . '" height="' . wc_get_image_size('shop_thumbnail_image_height') . '" />';
}
?>
</span>
</span>
<span class="product-details">
<span class="product-title"><?php
echo get_the_title($post) ? get_the_title($post) : $post->ID;
?>
</span>
<?php
echo $product->get_price_html();
?>
</span>
</span>
</span>
</span>
</a>
</div>
<?php
}
}
开发者ID:booklein,项目名称:wpbookle,代码行数:55,代码来源:woocommerce.php
示例17: wc_dynamic_gallery_preview
public static function wc_dynamic_gallery_preview($request = '')
{
if (!is_user_logged_in() || !current_user_can('manage_options')) {
die;
}
global $wc_dgallery_fonts_face;
$request = $_REQUEST;
/**
* Single Product Image
*/
$post = new stdClass();
$current_db_version = get_option('woocommerce_db_version', null);
$woo_a3_gallery_settings = $request;
$lightbox_class = 'lightbox';
$thumbs_list_class = '';
$display_back_and_forward = 'true';
$post->ID = rand(10, 10000);
if (!isset($woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'width_type']) || $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'width_type'] == 'px') {
$g_width = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'product_gallery_width_fixed'] . 'px';
$g_height = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'product_gallery_height'];
} else {
$g_width = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'product_gallery_width_responsive'] . '%';
$g_height = false;
$max_height = 533;
$width_of_max_height = 400;
?>
<script type="text/javascript">
(function($){
$(function(){
a3revWCDynamicGallery_<?php
echo $post->ID;
?>
= {
setHeightProportional: function () {
var image_wrapper_width = $( '#gallery_<?php
echo $post->ID;
?>
' ).find('.a3dg-image-wrapper').width();
var width_of_max_height = parseInt(<?php
echo $width_of_max_height;
?>
);
var image_wrapper_height = parseInt(<?php
echo $max_height;
?>
);
if( width_of_max_height > image_wrapper_width ) {
var ratio = width_of_max_height / image_wrapper_width;
image_wrapper_height = parseInt(<?php
echo $max_height;
?>
) / ratio;
}
$( '#gallery_<?php
echo $post->ID;
?>
' ).find('.a3dg-image-wrapper').css({ height: image_wrapper_height });
}
}
a3revWCDynamicGallery_<?php
echo $post->ID;
?>
.setHeightProportional();
$( window ).resize(function() {
a3revWCDynamicGallery_<?php
echo $post->ID;
?>
.setHeightProportional();
});
});
})(jQuery);
</script>
<?php
}
$caption_font = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'caption_font'];
$navbar_font = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'navbar_font'];
$google_fonts = array($caption_font['face'], $navbar_font['face']);
$wc_dgallery_fonts_face->generate_google_webfonts($google_fonts);
?>
<div class="images" style="width:<?php
echo $g_width;
?>
;margin:30px auto;">
<div class="product_gallery">
<?php
$shop_thumbnail = wc_get_image_size('shop_thumbnail');
$g_thumb_width = $shop_thumbnail['width'];
$g_thumb_height = $shop_thumbnail['height'];
$g_thumb_spacing = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_spacing'];
if (isset($woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_show_type'])) {
$thumb_show_type = 'slider';
} else {
$thumb_show_type = 'static';
}
$thumb_columns = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_columns'];
if ('static' == $thumb_show_type) {
$thumbs_list_class = 'a3dg-thumbs-static';
//.........这里部分代码省略.........
开发者ID:asaduryan,项目名称:manushak_am,代码行数:101,代码来源:class-wc-dynamic-gallery-preview.php
示例18: kt_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*
* @since Kute theme 1.0.0
*/
function kt_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on kutetheme, use a find and replace
* to change 'kutetheme' to the name of your theme in all the template files
*/
load_theme_textdomain('kutetheme', THEME_DIR . '/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
set_post_thumbnail_size(825, 510, true);
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(array('primary' => esc_attr__('Primary Menu', 'kutetheme'), 'vertical' => esc_attr__('Vertical Menu', 'kutetheme'), 'topbar_menuleft' => esc_attr__('Top bar Menu left', 'kutetheme'), 'topbar_menuright' => esc_attr__('Top bar Menu right', 'kutetheme'), 'custom_header_menu' => esc_attr__('Custom Header Menu', 'kutetheme'), 'custom_footer_menu' => esc_attr__('Custom Footer Menu', 'kutetheme')));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
/*
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
) );
*/
// $color_scheme = kt_get_color_scheme();
// $default_color = trim( $color_scheme[0], '#' );
// // Setup the WordPress core custom background feature.
// add_theme_support( 'custom-background', apply_filters( 'kt_custom_background_args', array(
// 'default-color' => $default_color,
// 'default-attachment' => 'fixed',
// ) ) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style(THEME_URL . 'css/editor-style.css');
add_image_size('kt-post-thumb', 345, 244, true);
add_image_size('kt-post-thumb-small', 70, 49, true);
add_image_size('kt_post_blog_268x255', 268, 255, true);
add_image_size('lookbook-thumb', 270, 270, true);
add_image_size('lookbook-thumb-masonry', 375, 375, false);
add_image_size('colection-thumb', 380, 532, true);
add_image_size('colection_small_thumb', 250, 349, true);
add_image_size('testimonial-thumb', 140, 140, true);
//Support woocommerce
add_theme_support('woocommerce');
if (function_exists('is_woocommerce')) {
$product_size = array('kt_shop_catalog_131' => 131, 'kt_shop_catalog_142' => 142, 'kt_shop_catalog_164' => 164, 'kt_shop_catalog_175' => 175, 'kt_shop_catalog_193' => 193, 'kt_shop_catalog_200' => 200, 'kt_shop_catalog_204
|
请发表评论