تابع ووکامرسی wc_display_item_downloads نمایش لینک محصولات دانلودی

تابع ووکامرسی wc_display_item_downloads نمایش لینک محصولات دانلودی

تابع ووکامرسی wc_display_item_downloads – نمایش لینک محصولات دانلودی

Syntax – سینتکس

(string|void) wc_display_item_downloads( (WC_Item) $item, (array) $args = array() ); 

Parameters – پارامتر ها (2)

  • 1- $item (WC_Item)
  • 2- $args (array)

Usage – نحوه استفاده

if ( !function_exists( 'wc_display_item_downloads' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
} 
  
// The item. 
$item = null; 
  
// The args. 
$args = array(); 
  
// NOTICE! Understand what this does before running. 
$result = wc_display_item_downloads($item, $args); 
    

Defined – محل تعریف

/includes/wc-template-functions.php

function wc_display_item_downloads( $item, $args = array() ) { 
    $strings = array(); 
    $html = ''; 
    $args = wp_parse_args( $args, array( 
        'before' => '
  • ', 'after' => '
', 'separator' => '
  • ', 'echo' => true, 'show_url' => false, ) ); if ( is_object( $item ) && $item->is_type( 'line_item' ) && ( $downloads = $item->get_item_downloads() ) ) { $i = 0; foreach ( $downloads as $file ) { $i ++; if ( $args['show_url'] ) { $strings[] = '' . esc_html( $file['name'] ) . ': ' . esc_html( $file['download_url'] ); } else { $prefix = sizeof( $downloads ) > 1 ? sprintf( __( 'Download %d', woocommerce ), $i ) : __( 'Download', woocommerce ); $strings[] = '' . $prefix . ': ' . esc_html( $file['name'] ) . ''; } } } if ( $strings ) { $html = $args['before'] . implode( $args['separator'], $strings ) . $args['after']; } $html = apply_filters( 'woocommerce_display_item_downloads', $html, $item, $args ); if ( $args['echo'] ) { echo $html; } else { return $html; } }
  • versions – نسخه ها

    از نسخه : 3.0.0

    نسخه فعلی : 3.0.6

    دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

    ارسال نظر

    جهت استفاده از کد حتما از تگ pre استفاده نمایید .

    contact us