تابع ووکامرسی wc_get_template_part نمایش صفحات تکرار شدنی مثل shop-loop
تابع ووکامرسی wc_get_template_part – نمایش صفحات تکرار شدنی مثل shop-loop یا فرخوانی فرم و …
Syntax – سینتکس
wc_get_template_part( (mixed) $slug, (string) $name = '' );
Parameters – پارامتر ها (2)
- 1- $slug (mixed)
- 2- $name (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_template_part' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; } // The slug. $slug = null; // (default: '') $name = ''; // NOTICE! Understand what this does before running. $result = wc_get_template_part($slug, $name);
Defined – محل تعریف
/includes/wc-core-functions.php
function wc_get_template_part( $slug, $name = '' ) { $template = ''; // Look in yourtheme/slug-name.php and yourtheme/woocommerce/slug-name.php if ( $name && ! WC_TEMPLATE_DEBUG_MODE ) { $template = locate_template( array( "{$slug}-{$name}.php", WC()->template_path() . "{$slug}-{$name}.php" ) ); } // Get default slug-name.php if ( ! $template && $name && file_exists( WC()->plugin_path() . "/templates/{$slug}-{$name}.php" ) ) { $template = WC()->plugin_path() . "/templates/{$slug}-{$name}.php"; } // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/woocommerce/slug.php if ( ! $template && ! WC_TEMPLATE_DEBUG_MODE ) { $template = locate_template( array( "{$slug}.php", WC()->template_path() . "{$slug}.php" ) ); } // Allow 3rd party plugins to filter template file from their plugin. $template = apply_filters( 'wc_get_template_part', $template, $slug, $name ); if ( $template ) { load_template( $template, false ); } }
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر