考虑:
<?php
/**
* Single variation display
*
* This is a javascript-based template for single variations (see https://codex.wordpress.org/Javascript_Reference/wp.template).
* The values will be dynamically replaced after selecting attributes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<script type="text/template" id="tmpl-variation-template">
<div class="woocommerce-variation-description">{{{ data.variation.variation_description }}}</div>
<div class="woocommerce-variation-price">{{{ data.variation.price_html }}}</div>
<div class="woocommerce-variation-availability">{{{ data.variation.availability_html }}}</div>
<div class="woocommerce-variation-custom-text-field">
GTIN: <span class="sku">{{{ data.variation.wccaf_gtin }}}</span>
</div>
<div class="woocommerce-variation-custom-text-field">
MPN: …Run Code Online (Sandbox Code Playgroud) 将我的生产 WordPress 相关网站导入到本地 Xampp 环境后,出现以下错误:
致命错误:未捕获错误:调用 C:\xampp\htdocs\public_html\siliconharvest\wp-content\themes\storefront-child\functions.php:62 中未定义的函数 is_product() 堆栈跟踪:#0 C:\xampp\ htdocs\public_html\siliconharvest\wp-includes\class-wp-hook.php(286): wc_variable_simple_conditions('') #1 C:\xampp\htdocs\public_html\siliconharvest\wp-includes\class-wp-hook.php (310): WP_Hook->apply_filters(NULL, Array) #2 C:\xampp\htdocs\public_html\siliconharvest\wp-includes\plugin.php(453): WP_Hook->do_action(Array) #3 C:\xampp \htdocs\public_html\siliconharvest\wp-includes\general-template.php(2614): do_action('wp_head') #4 C:\xampp\htdocs\public_html\siliconharvest\wp-content\themes\storefront\header.php (18): wp_head() #5 C:\xampp\htdocs\public_html\siliconharvest\wp-includes\template.php(688): require_once('C:\xampp\htdocs...') #6 C:\ xampp\htdocs\public_html\siliconharvest\wp-includes\template.php(647): load_template('C:\xampp\htdocs...', true) #7 C:\xampp\htdocs\public_html\siliconharvest\wp-包括 \general-template.php( 在 C:\xampp\htdocs\public_html\siliconharvest\wp-content\themes\storefront-child\functions.php 第 62 行
我已尝试以下诊断步骤,但对错误没有影响:
然而,无论执行上述任何步骤,错误仍然存在。正确的解决方案必须使所有这些错误消失。
编辑:错误中引用的functions.php文件的第1-73行:
<?php
// BEGIN Remove "Storefront Designed by WooThemes" from Footer as per https://danielsantoro.com/remove-storefront-designed-woothemes/
add_action('init', 'custom_remove_footer_credit', 10);
function custom_remove_footer_credit()
{
remove_action('storefront_footer', 'storefront_credit', 20);
add_action('storefront_footer', 'custom_storefront_credit', …Run Code Online (Sandbox Code Playgroud) 请考虑以下PHP:
function get_ship_class()
{
$csv = array_map("str_getcsv", file("somefile.csv", "r"));
$header = array_shift($csv);
// Seperate the header from data
$col = array_search("heavy_shipping_class", $header);
foreach ($csv as $row)
{
$array[] = $row[$col];
}
}
Run Code Online (Sandbox Code Playgroud)
如何将上述函数中生成的数组传递给
if( in_array() ){
//code
}
Run Code Online (Sandbox Code Playgroud)
?
php ×3
wordpress ×2
arrays ×1
debugging ×1
javascript ×1
mustache ×1
mustache.php ×1
woocommerce ×1