تابع woocommerce_subcategory_thumbnail نمایش تصویر شاخص زیر دسته محصول
تابع ووکامرسی woocommerce_subcategory_thumbnail – نمایش تصویر شاخص زیر دسته محصول
Syntax – سینتکس
woocommerce_subcategory_thumbnail( (mixed) $category );
Parameters – پارامتر ها (1)
- 1- $category (mixed)
Usage – نحوه استفاده
if ( !function_exists( 'woocommerce_subcategory_thumbnail' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; } // The category. $category = null; // NOTICE! Understand what this does before running. $result = woocommerce_subcategory_thumbnail($category);
Defined – محل تعریف
/includes/wc-template-functions.php
function woocommerce_subcategory_thumbnail( $category ) { $small_thumbnail_size = apply_filters( 'subcategory_archive_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]; $image_srcset = function_exists( 'wp_get_attachment_image_srcset' ) ? wp_get_attachment_image_srcset( $thumbnail_id, $small_thumbnail_size ) : false; $image_sizes = function_exists( 'wp_get_attachment_image_sizes' ) ? wp_get_attachment_image_sizes( $thumbnail_id, $small_thumbnail_size ) : false; } else { $image = wc_placeholder_img_src(); $image_srcset = $image_sizes = false; } if ( $image ) { // Prevent esc_url from breaking spaces in urls for image embeds // Ref: https://core.trac.wordpress.org/ticket/23605 $image = str_replace( ' ', '%20', $image ); // Add responsive image markup if available if ( $image_srcset && $image_sizes ) { echo ''; } else { echo ''; } } }
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر