تابع ووکامرسی wc_get_template نمایش دیگر صفحات فروشگاه

تابع ووکامرسی wc_get_template نمایش دیگر صفحات فروشگاه

تابع ووکامرسی wc_get_template نمایش دیگر صفحات فروشگاه مثل header , footer , sidebar , content

Syntax – سینتکس

wc_get_template( (string) $template_name, (array) $args = array(), (string) $template_path = '', (string) $default_path = '' ); 

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

  • 1- $template_name (string)
  • 2- $args (array)
  • 3- $template_path (string)
  • 4- $default_path (string)

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

if ( !function_exists( 'wc_get_template' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
} 
  
// The template name. 
$template_name = ''; 
  
// (default: array()) 
$args = array(); 
  
// The template path. 
$template_path = ''; 
  
// The default path. 
$default_path = ''; 
  
// NOTICE! Understand what this does before running. 
$result = wc_get_template($template_name, $args, $template_path, $default_path); 
    

Defined – محل تعریف

/includes/wc-core-functions.php

function wc_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { 
    if ( ! empty( $args ) && is_array( $args ) ) { 
        extract( $args ); 
    } 
 
    $located = wc_locate_template( $template_name, $template_path, $default_path ); 
 
    if ( ! file_exists( $located ) ) { 
        wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', woocommerce ), '' . $located . '' ), '2.1' ); 
        return; 
    } 
 
    // Allow 3rd party plugin filter template file from their plugin. 
    $located = apply_filters( 'wc_get_template', $located, $template_name, $args, $template_path, $default_path ); 
 
    do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located, $args ); 
 
    include( $located ); 
 
    do_action( 'woocommerce_after_template_part', $template_name, $template_path, $located, $args ); 
} 

versions – نسخه ها

از نسخه : 3.0.2

نسخه فعلی : 3.0.6

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

ارسال نظر

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

contact us