本文整理汇总了PHP中wc_placeholder_img函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_placeholder_img函数的具体用法?PHP wc_placeholder_img怎么用?PHP wc_placeholder_img使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_placeholder_img函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sw_product_thumbnail
function sw_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post;
$html = '';
$id = get_the_ID();
$gallery = get_post_meta($id, '_product_image_gallery', true);
$attachment_image = '';
if (!empty($gallery)) {
$gallery = explode(',', $gallery);
$first_image_id = $gallery[0];
$attachment_image = wp_get_attachment_image($first_image_id, $size, false, array('class' => 'hover-image back'));
}
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '');
if (has_post_thumbnail()) {
if ($attachment_image) {
$html .= '<div class="product-thumb-hover">';
$html .= get_the_post_thumbnail($post->ID, $size);
$html .= $attachment_image;
$html .= '</div>';
} else {
$html .= get_the_post_thumbnail($post->ID, $size);
}
return $html;
} elseif (wc_placeholder_img_src()) {
$html .= wc_placeholder_img($size);
return $html;
}
}
开发者ID:pqzada,项目名称:avispate,代码行数:28,代码来源:woocommerce-hook.php
示例2: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $product;
if ($product->is_type('variable')) {
global $prdctfltr_global;
$pf_activated = isset($prdctfltr_global['active_filters']) ? $prdctfltr_global['active_filters'] : array();
if (!empty($pf_activated)) {
$attrs = array();
foreach ($pf_activated as $k => $v) {
if (substr($k, 0, 3) == 'pa_') {
$attrs = $attrs + array($k => $v[0]);
}
}
if (count($attrs) > 0) {
$curr_var = $product->get_available_variations();
foreach ($curr_var as $key => $var) {
$curr_var_set[$key]['attributes'] = $var['attributes'];
$curr_var_set[$key]['variation_id'] = $var['variation_id'];
}
$found = WC_Prdctfltr::prdctrfltr_search_array($curr_var_set, $attrs);
}
}
}
if (isset($found[0]) && $found[0]['variation_id'] && has_post_thumbnail($found[0]['variation_id'])) {
$image = get_the_post_thumbnail($found[0]['variation_id'], $size);
} elseif (has_post_thumbnail($product->id)) {
$image = get_the_post_thumbnail($product->id, $size);
} elseif (($parent_id = wp_get_post_parent_id($product->id)) && has_post_thumbnail($parent_id)) {
$image = get_the_post_thumbnail($product, $size);
} else {
$image = wc_placeholder_img($size);
}
return $image;
}
开发者ID:arobbins,项目名称:spellestate,代码行数:34,代码来源:pf-variable-override.php
示例3: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'news-thumb', $placeholder_width = 0, $placeholder_height = 0)
{
global $post;
if (has_post_thumbnail()) {
return get_the_post_thumbnail($post->ID, $size, array('class' => 'img-responsive'));
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($size);
}
}
开发者ID:baperrou,项目名称:pedal-bookings,代码行数:9,代码来源:woo-hooks.php
示例4: spyropress_wc_product_thumbnail
function spyropress_wc_product_thumbnail()
{
$image = '';
if (has_post_thumbnail()) {
$image = get_image(array('echo' => false, 'class' => 'img-responsive'));
} elseif (wc_placeholder_img_src()) {
$image = wc_placeholder_img('shop_single');
}
echo '
<a href="' . get_permalink() . '">
<span class="product-thumb-info-image">
<span class="product-thumb-info-act">
<span class="product-thumb-info-act-left"><em>' . __('View', 'spyropress') . '</em></span>
<span class="product-thumb-info-act-right"><em><i class="icon icon-plus"></i> ' . __('Details', 'spyropress') . '</em></span>
</span>
' . str_replace('wp-post-image', 'img-responsive', $image) . '
</span>
</a>';
}
开发者ID:rinodung,项目名称:myfreetheme,代码行数:19,代码来源:woocommerce-init.php
示例5: get_image
/**
* Returns the main product image
*
* @param string $size (default: 'shop_thumbnail')
* @return string
*/
public function get_image($size = 'shop_thumbnail', $attr = array())
{
if (has_post_thumbnail($this->id)) {
$image = get_the_post_thumbnail($this->id, $size, $attr);
} elseif (($parent_id = wp_get_post_parent_id($this->id)) && has_post_thumbnail($parent_id)) {
$image = get_the_post_thumbnail($parent_id, $size, $attr);
} else {
$image = wc_placeholder_img($size);
}
return $image;
}
开发者ID:nathanielks,项目名称:woocommerce,代码行数:17,代码来源:abstract-wc-product.php
示例6: woocommerce_get_product_thumbnail
/**
* Get the product thumbnail, or the placeholder if not set.
*
* @access public
* @subpackage Loop
* @param string $size (default: 'shop_catalog')
* @param int $placeholder_width (default: 0)
* @param int $placeholder_height (default: 0)
* @return string
*/
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post;
if (has_post_thumbnail()) {
return get_the_post_thumbnail($post->ID, $size);
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($size);
}
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:19,代码来源:wc-template-functions.php
示例7: dtwl_product_thumbnail
function dtwl_product_thumbnail()
{
global $post;
$size = 'shop_thumbnail';
if (has_post_thumbnail()) {
echo get_the_post_thumbnail($post->ID, $size, array('class' => "attachment-{$size}"));
} elseif (wc_placeholder_img_src()) {
echo wc_placeholder_img($size);
}
}
开发者ID:dawnthemes,项目名称:dtwl,代码行数:10,代码来源:dt-template-functions.php
示例8: get_image
/**
* Returns the main product image.
*
* @param string $size (default: 'shop_thumbnail')
* @param array $attr
* @param bool True to return $placeholder if no image is found, or false to return an empty string.
* @return string
*/
public function get_image($size = 'shop_thumbnail', $attr = array(), $placeholder = true)
{
if (has_post_thumbnail($this->id)) {
$image = get_the_post_thumbnail($this->id, $size, $attr);
} elseif (($parent_id = wp_get_post_parent_id($this->id)) && has_post_thumbnail($parent_id)) {
$image = get_the_post_thumbnail($parent_id, $size, $attr);
} elseif ($placeholder) {
$image = wc_placeholder_img($size);
} else {
$image = '';
}
return str_replace(array('https://', 'http://'), '//', $image);
}
开发者ID:nishitlangaliya,项目名称:woocommerce,代码行数:21,代码来源:abstract-wc-product.php
示例9: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'product_small_thumbnail', $placeholder_width = 0, $placeholder_height = 0)
{
global $post;
if (has_post_thumbnail()) {
$image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'shop_catalog');
return get_the_post_thumbnail($post->ID, $size, array('data-src' => $image_src[0], 'class' => 'lazyOwl'));
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($size);
}
}
开发者ID:quyendam2612,项目名称:quanao,代码行数:10,代码来源:functions.php
示例10: test_wc_placeholder_img
/**
* Test wc_placeholder_img()
*
* @since 2.4
*/
public function test_wc_placeholder_img()
{
$sizes = array('shop_thumbnail' => array('width' => '180', 'height' => '180'), 'shop_single' => array('width' => '600', 'height' => '600'), 'shop_catalog' => array('width' => '300', 'height' => '300'));
foreach ($sizes as $size => $values) {
$img = '<img src="' . wc_placeholder_img_src() . '" alt="' . __('Placeholder', 'woocommerce') . '" width="' . $values['width'] . '" class="woocommerce-placeholder wp-post-image" height="' . $values['height'] . '" />';
$this->assertEquals(apply_filters('woocommerce_placeholder_img', $img), wc_placeholder_img($size));
}
$img = '<img src="' . wc_placeholder_img_src() . '" alt="' . __('Placeholder', 'woocommerce') . '" width="180" class="woocommerce-placeholder wp-post-image" height="180" />';
$this->assertEquals(apply_filters('woocommerce_placeholder_img', $img), wc_placeholder_img());
}
开发者ID:nightbook,项目名称:woocommerce,代码行数:15,代码来源:functions.php
示例11: woocommerce_get_product_thumbnail
/**
* Get the product thumbnail, or the placeholder if not set.
*
* @subpackage Loop
* @param string $size (default: 'shop_catalog')
* @param int $deprecated1 Deprecated since WooCommerce 2.0 (default: 0)
* @param int $deprecated2 Deprecated since WooCommerce 2.0 (default: 0)
* @return string
*/
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $deprecated1 = 0, $deprecated2 = 0)
{
global $post;
if (has_post_thumbnail() && wp_attachment_is_image(get_post_thumbnail_id())) {
return get_the_post_thumbnail($post->ID, $size);
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($size);
}
}
开发者ID:rsantellan,项目名称:wordpress-ecommerce,代码行数:18,代码来源:wc-template-functions.php
示例12: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post;
if (has_post_thumbnail()) {
return "<div class=\"imageswrap productthumbnail\"><div class=\"imageHOpacity\"></div>" . get_the_post_thumbnail($post->ID, $size) . "</div>";
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($size);
}
}
开发者ID:rmilano24,项目名称:moto,代码行数:9,代码来源:utilities.php
示例13: woocommerce_template_loop_product_thumbnail
function woocommerce_template_loop_product_thumbnail($view = 'grid-view')
{
global $woocommerce_loop, $post, $media_center_theme_options, $woocommerce_loop;
$product_item_size = isset($woocommerce_loop['product_item_size']) ? $woocommerce_loop['product_item_size'] : $media_center_theme_options['product_item_size'];
switch ($product_item_size) {
case 'size-medium':
$image_size = 'product-medium';
break;
case 'size-small':
$image_size = 'product-small';
break;
case 'size-big':
$image_size = 'product-large';
break;
default:
$image_size = 'product-medium';
}
if ($view == 'list-view') {
$image_size = 'product-medium';
}
echo '<div class="product-image">';
echo '<a href="' . get_permalink($post->ID) . '">';
if ($media_center_theme_options['lazy_loading']) {
if (has_post_thumbnail($post->ID)) {
$post_thumbnail_ID = get_post_thumbnail_id($post->ID);
$post_thumbnail_src = wp_get_attachment_image_src($post_thumbnail_ID, $image_size);
} else {
$dimensions = wc_get_image_size($image_size);
$post_thumbnail_src = array(wc_placeholder_img_src(), esc_attr($dimensions['width']), esc_attr($dimensions['height']));
}
echo '<img class="post-image echo-lazy-loading" src="' . get_template_directory_uri() . '/assets/images/blank.gif" alt="" data-echo="' . $post_thumbnail_src[0] . '" width="' . $post_thumbnail_src[1] . '" height="' . $post_thumbnail_src[2] . '">';
} else {
if (has_post_thumbnail($post->ID)) {
echo get_the_post_thumbnail($post->ID, $image_size);
} else {
echo wc_placeholder_img($image_size);
}
}
echo '</a>';
echo '</div>';
}
开发者ID:Qualitair,项目名称:ecommerce,代码行数:41,代码来源:woocommerce-template-functions.php
示例14: do_action
?>
>
<?php
}
?>
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<?php
$image_html = "";
if (has_post_thumbnail()) {
$image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
} else {
if (wc_placeholder_img_src()) {
$image_html = wc_placeholder_img('shop_catalog');
}
}
?>
<?php
if ($shop_product_listing == 'style1') {
?>
<figure class="fresco">
<?php
do_action('thb_product_badge');
?>
<?php
echo $image_html;
?>
<div class="overlay"></div>
开发者ID:developmentDM2,项目名称:CZND,代码行数:31,代码来源:content-product.php
示例15: content
protected function content($atts, $content = null)
{
$atts = shortcode_atts(array('per_page' => '', 'orderby' => 'name', 'order' => 'ASC', 'ids' => '', 'hide_empty' => 'true', 'parent' => '', 'autoheight' => true, 'autoplay' => false, 'mousedrag' => true, 'autoplayspeed' => 5000, 'slidespeed' => 200, 'carousel_skin' => '', 'desktop' => 4, 'desktopsmall' => 3, 'tablet' => 2, 'mobile' => 1, 'gutters' => true, 'navigation' => true, 'navigation_always_on' => true, 'navigation_position' => 'center-outside', 'navigation_style' => 'normal', 'pagination' => false, 'pagination_position' => 'center-bottom', 'pagination_style' => 'dot-stroke', 'css_animation' => '', 'animation_delay' => '', 'el_class' => '', 'css' => ''), $atts);
$atts['columns'] = $atts['desktop'];
$atts['number'] = $atts['per_page'];
$atts['hide_empty'] = apply_filters('sanitize_boolean', $atts['hide_empty']);
extract($atts);
$elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'products-brands-carousel ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'woocommerce' => 'woocommerce columns-' . $desktop, 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
$carousel_ouput = cruxstore_render_carousel(apply_filters('cruxstore_render_args', $atts), '', 'cruxstore-owl-carousel');
$output = $carousel_html = '';
if (isset($atts['ids'])) {
$ids = explode(',', $atts['ids']);
$ids = array_map('trim', $ids);
} else {
$ids = array();
}
$hide_empty = $atts['hide_empty'] == true || $atts['hide_empty'] == 1 ? 1 : 0;
// get terms and workaround WP bug with parents/pad counts
$args = array('orderby' => $atts['orderby'], 'order' => $atts['order'], 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $atts['parent']);
$product_brands = get_terms('yith_product_brand', $args);
if ('' !== $atts['parent']) {
$product_brands = wp_list_filter($product_brands, array('parent' => $atts['parent']));
}
if ($hide_empty) {
foreach ($product_brands as $key => $brand) {
if ($brand->count == 0) {
unset($product_brands[$key]);
}
}
}
if ($atts['number']) {
$product_brands = array_slice($product_brands, 0, $atts['number']);
}
ob_start();
if ($product_brands) {
global $woocommerce_carousel;
$woocommerce_carousel = 'normal';
$css_animation = cruxstore_getCSSAnimation($css_animation);
foreach ($product_brands as $key => $term) {
if ($animation_delay) {
$animation_delay_item = sprintf(' data-wow-delay="%sms"', $key * $animation_delay);
} else {
$animation_delay_item = '';
}
echo '<div class="brand-banner' . $css_animation . '"' . $animation_delay_item . '><div class="brand-banner-content">';
$thumbnail_id = absint(yith_wcbr_get_term_meta($term->term_id, 'thumbnail_id', true));
$image_size = apply_filters('cruxstore_brand_logo', 'cruxstore_grid');
if ($thumbnail_id) {
$image = wp_get_attachment_image_src($thumbnail_id, $image_size);
printf('<div class="brand-image"><img src="%s" width="%d" height="%d" alt="%s"/></div>', $image[0], $image[1], $image[2], $term->name);
} else {
do_action('yith_wcbr_no_brand_logo', $term->term_id, $term, 'yith_wcbr_logo_size', false, false);
echo '<div class="brand-image">' . wc_placeholder_img() . '</div>';
}
printf('<h4 class="brand-count"><span>%s</span> %s</a></h4>', $term->count, esc_html__('Products', 'cruxstore'));
printf('<a href="%s">%s</a>', get_term_link($term), $term->name);
echo '</div></div>';
}
}
wp_reset_postdata();
$carousel_html .= ob_get_clean();
if ($carousel_html) {
$elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
$output = '<div class="' . esc_attr($elementClass) . '"><div class="products-brands-inner">' . str_replace('%carousel_html%', $carousel_html, $carousel_ouput) . '</div></div>';
}
return $output;
}
开发者ID:websideas,项目名称:Mondova,代码行数:67,代码来源:brands.php
示例16: woocommerce_get_product_thumbnail
/**
* Get the product thumbnail, or the placeholder if not set.
*
* @subpackage Loop
* @param string $size (default: 'shop_catalog')
* @param int $deprecated1 Deprecated since WooCommerce 2.0 (default: 0)
* @param int $deprecated2 Deprecated since WooCommerce 2.0 (default: 0)
* @return string
*/
function woocommerce_get_product_thumbnail($size = 'medium', $deprecated1 = 0, $deprecated2 = 0)
{
global $post;
if (has_post_thumbnail()) {
return get_the_post_thumbnail($post->ID, $size, array('class' => '[ image-responsive ]'));
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($size);
}
}
开发者ID:pcuervo,项目名称:ur-imprint,代码行数:18,代码来源:wc-template-functions.php
示例17: woocommerce_get_product_thumbnail
/**
* Get the product thumbnail, or the placeholder if not set.
*
* @subpackage Loop
* @param string $size (default: 'shop_catalog')
* @param int $deprecated1 Deprecated since WooCommerce 2.0 (default: 0)
* @param int $deprecated2 Deprecated since WooCommerce 2.0 (default: 0)
* @return string
*/
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $deprecated1 = 0, $deprecated2 = 0)
{
global $post;
$image_size = apply_filters('single_product_archive_thumbnail_size', $size);
if (has_post_thumbnail()) {
$props = wc_get_product_attachment_props(get_post_thumbnail_id(), $post);
return get_the_post_thumbnail($post->ID, $image_size, array('title' => $props['title'], 'alt' => $props['alt']));
} elseif (wc_placeholder_img_src()) {
return wc_placeholder_img($image_size);
}
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:20,代码来源:wc-template-functions.php
示例18: edit_category_fields
function edit_category_fields($term, $taxonomy)
{
global $ts_default_sidebars;
$sidebar_options = array();
foreach ($ts_default_sidebars as $key => $_sidebar) {
$sidebar_options[$_sidebar['id']] = $_sidebar['name'];
}
$bg_breadcrumbs_id = get_woocommerce_term_meta($term->term_id, 'bg_breadcrumbs_id', true);
$layout = get_woocommerce_term_meta($term->term_id, 'layout', true);
$left_sidebar = get_woocommerce_term_meta($term->term_id, 'left_sidebar', true);
$right_sidebar = get_woocommerce_term_meta($term->term_id, 'right_sidebar', true);
?>
<tr class="form-field">
<th scope="row" valign="top"><label><?php
esc_html_e('Breadcrumbs Background Image', 'gon');
?>
</label></th>
<td>
<div id="product_cat_bg_breadcrumbs">
<?php
if (empty($bg_breadcrumbs_id)) {
echo wc_placeholder_img('thumbnail');
} else {
echo wp_get_attachment_image($bg_breadcrumbs_id, 'thumbnail');
}
?>
</div>
<div class="upload-button">
<input type="hidden" name="wc_placeholder_img_src" id="wc_placeholder_img_src" value="<?php
echo esc_url(wc_placeholder_img_src());
?>
" />
<input type="hidden" name="product_cat_bg_breadcrumbs_id" id="product_cat_bg_breadcrumbs_id" value="<?php
echo esc_attr($bg_breadcrumbs_id);
?>
" />
<button type="button" class="product_cat_bg_breadcrumbs_upload_button button"><?php
esc_html_e('Upload/Add image', 'gon');
?>
</button>
<button type="button" class="product_cat_bg_breadcrumbs_remove_button button"><?php
esc_html_e('Remove image', 'gon');
?>
</button>
</div>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label><?php
esc_html_e('Layout', 'gon');
?>
</label></th>
<td>
<select name="layout" id="layout">
<option value="" <?php
selected($layout, '');
?>
><?php
esc_html_e('Default', 'gon');
?>
</option>
<option value="0-1-0" <?php
selected($layout, '0-1-0');
?>
><?php
esc_html_e('Fullwidth', 'gon');
?>
</option>
<option value="1-1-0" <?php
selected($layout, '1-1-0');
?>
><?php
esc_html_e('Left Sidebar', 'gon');
?>
</option>
<option value="0-1-1" <?php
selected($layout, '0-1-1');
?>
><?php
esc_html_e('Right Sidebar', 'gon');
?>
</option>
<option value="1-1-1" <?php
selected($layout, '1-1-1');
?>
><?php
esc_html_e('Left & Right Sidebar', 'gon');
?>
</option>
</select>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label><?php
esc_html_e('Left Sidebar', 'gon');
?>
</label></th>
<td>
//.........这里部分代码省略.........
开发者ID:ericsoncardosoweb,项目名称:dallia,代码行数:101,代码来源:woo_term.php
示例19: porto_widget_product_thumbnail
function porto_widget_product_thumbnail()
{
global $porto_settings;
$id = get_the_ID();
$size = 'shop_thumbnail';
$gallery = get_post_meta($id, '_product_image_gallery', true);
$attachment_image = '';
if (!empty($gallery) && $porto_settings['category-image-hover']) {
$gallery = explode(',', $gallery);
$first_image_id = $gallery[0];
$attachment_image = wp_get_attachment_image($first_image_id, $size, false, array('class' => 'hover-image '));
}
$thumb_image = get_the_post_thumbnail($id, $size, array('class' => ''));
if (!$thumb_image) {
if (wc_placeholder_img_src()) {
$thumb_image = wc_placeholder_img($size);
}
}
echo '<div class="inner' . ($attachment_image ? ' img-effect' : '') . '">';
// show images
echo $thumb_image;
echo $attachment_image;
echo '</div>';
}
开发者ID:rinodung,项目名称:live-theme,代码行数:24,代码来源:woocommerce.php
示例20: woocommerce_get_product_thumbnail
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
$product = get_product(get_the_ID());
$attrs = array();
foreach ($_GET as $k => $v) {
if (substr($k, 0, 3) == 'pa_') {
if (!strpos($v, ',')) {
$v_val = $v;
} else {
$v_val = explode(',', $v);
$v_val = $v_val[0];
}
$attrs = $attrs + array($k => $v_val);
}
}
if (count($attrs) == 0) {
global $wp_the_query;
if (isset($wp_the_query->query)) {
foreach ($wp_the_query->query as $k => $v) {
if (substr($k, 0, 3) == 'pa_') {
if (!strpos($v, ',')) {
$v_val = $v;
} else {
$v_val = explode(',', $v);
$v_val = $v_val[0];
}
$attrs = $attrs + array($k => $v_val);
}
}
}
}
if (count($attrs) == 0) {
global $prdctfltr_global;
if (isset($prdctfltr_global['active_filters'])) {
foreach ($prdctfltr_global['active_filters'] as $k => $v) {
if (substr($k, 0, 3) == 'pa_') {
if (!strpos($v, ',')) {
$v_val = $v;
} else {
$v_val = explode(',', $v);
$v_val = $v_val[0];
}
$attrs = $attrs + array($k => $v_val);
}
}
}
}
if (is_product_taxonomy()) {
$attrs = array_merge($attrs, array(get_query_var('taxonomy') => get_query_var('term')));
}
if (count($attrs) > 0) {
if ($product->is_type('variable')) {
$curr_var = $product->get_available_variations();
$si = prdctrfltr_search_array($curr_var, $attrs);
}
}
if (isset($si[0]) && $si[0]['variation_id'] && has_post_thumbnail($si[0]['variation_id'])) {
$image = get_the_post_thumbnail($si[0]['variation_id'], $size);
} elseif (has_post_thumbnail($product->id)) {
$image = get_the_post_thumbnail($product->id, $size);
} elseif (($parent_id = wp_get_post_parent_id($product->id)) && has_post_thumbnail($parent_id)) {
$image = get_the_post_thumbnail($product, $size);
} else {
$image = wc_placeholder_img($size);
}
return $image;
}
开发者ID:ardiqghenatya,项目名称:web4,代码行数:67,代码来源:prdctfltr.php
注:本文中的wc_placeholder_img函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论