تابع ووکامرسی wc_setup_product_data افزودن اطلاعات اضافه به محصولات ووکامرس

تابع ووکامرسی wc_setup_product_data – افزودن اطلاعات اضافه به محصولات ووکامرس حین استفاده از the_post
Syntax – سینتکس
(WC_Product) wc_setup_product_data( (mixed) $post );
Parameters – پارامتر ها (1)
- 1- $post (mixed)
Usage – نحوه استفاده
if ( !function_exists( 'wc_setup_product_data' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; } // The post. $post = null; // NOTICE! Understand what this does before running. $result = wc_setup_product_data($post);
Defined – محل تعریف
/includes/wc-template-functions.php
function wc_setup_product_data( $post ) { unset( $GLOBALS['product'] ); if ( is_int( $post ) ) $post = get_post( $post ); if ( empty( $post->post_type ) || ! in_array( $post->post_type, array( 'product', 'product_variation' ) ) ) return; $GLOBALS['product'] = wc_get_product( $post ); return $GLOBALS['product']; }
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر