在将我的生产WordPress相关网站导入到我的本地Xampp环境后,我得到了这个错误:
致命错误:未捕获错误:在C:\xampp\htdocs\public\u html\siliconharvest\wp content\themes\storefront child\functions.php:62堆栈跟踪:#0 C:\xampp\htdocs\public\u html\siliconharvest\wp includes\class wp hook.php(286):wc_变量\u简单条件(“”)#1c:\xampp\htdocs\public\uhtml\siliconharvest\wp includes\class wp hook.php(310):wp_hook-
我尝试了以下诊断步骤,但对错误没有影响:
然而,不管上述步骤如何,错误仍然存在。正确的解决方案必须消除所有这些错误。
编辑:错误中引用的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', 20);
}
function custom_storefront_credit()
{
?>
<div class="site-info">
<div class="deferred-menu-items">
<ul style="list-style-type: none;" class="footer-menu">
<li style="display:inline-block" class="menu-item-156"><a href="/about/">About Us</a></li><!--
--><li style="display:inline-block" class="menu-item-189"><a href="/faq/">FAQ</a></li><!--
--><li style="display:inline-block" class="fa-delivery"><a href="/delivery/">Delivery</a></li><!--
--><li style="display:inline-block" class="fa-returns"><a href="/returns/">Returns</a></li><!--
--><li style="display:inline-block" class="menu-item-464"><a href="/store-policies/"><i class="far fa-handshake"></i> Store Policies</a></li><!--
--><!--<li style="display:inline-block" class="menu-item-1024"><a href="/articles/">Articles</a></li>--><!--
--><li style="display:inline-block" class="affiliates"><a href="/about-the-silicon-harvest-affiliates-program/"><i class="fas fa-bullhorn"></i> Affiliates Programme</a></li>
<!--<li style="display:inline-block" class="fa-opas"><a href="/overseas-parts-acquisition-service-opas/">Overseas Parts Acquisition Service (OPAS)</a></li>-->
</ul>
</div>
© <?php
echo get_bloginfo('name') . ' ' . get_the_date('Y') . ' | ABN: 31 022 705 565 | <a style="color:blue" href="/terms-of-service-and-privacy-policy/">Terms of Service/Privacy Policy</a> <div class="front-page-contact">
<a style="color:blue" href="/contact-us/#aggs-contact-form">Contact Form</a> | mob: 0424 214 930 | tel: (02) 8007 6871 <!--| mob: +61 424 214 930 (international) / tel: +612 8007 6871 -->| <a style="color:blue" href="mailto:mail@siliconharvest.com.au">mail@siliconharvest.com.au</a><br />Live contact hours from 9am-9pm (AEST/AEDT or Sydney/Melbourne/ACT/TAS time), Mon-Sun</div>';
?>
</div><!-- .site-info -->
<?php
}
// END Remove "Storefront Designed by WooThemes" from Footer
/* START add microdata relating to item condition to satisfy Google Merchant's optional advice - as per https://github.com/woocommerce/woocommerce/issues/15797#issuecomment-355744594 */
add_filter('woocommerce_structured_data_product_offer', 'filter_woocommerce_structured_data_product', 10, 2);
/**
* Add properties to the http://schema.org/Offer markup for all products.
*/
function filter_woocommerce_structured_data_product($markup, $product)
{
/* By default, we assume all products sold in the ecommerce are in new condition */
if (empty($markup['itemCondition'])) {
$markup['itemCondition'] = 'http://schema.org/NewCondition';
}
return $markup;
}
/* END add microdata */
// as per https://wordpress.stackexchange.com/questions/276941/woocommerce-add-extra-field-to-variation-product/277556
// based on http://www.remicorson.com/woocommerce-custom-fields-for-variations/
//THESE ACTIONS AND FILTER HANDLE YOUR PRODUCT VARIATION FIELDS + add_filter( 'woocommerce_available_variation', 'load_variation_settings_fields' ); which you have inserted into a conditional
add_action('woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3);
add_action('woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2);
add_action('wp_head', 'wc_variable_simple_conditions');
function wc_variable_simple_conditions()
{
if (is_product()) {
global $post;
$post_id = $post->ID;
$product = wc_get_product($post_id);
$type = $product->get_type();
if ($type == 'variable') {
add_filter('woocommerce_available_variation', 'load_variation_settings_fields');
} elseif ($type == 'simple') {
add_action('woocommerce_single_product_summary', 'custom_data_above_add_to_cart_button', 41);
}
}
}
如果(is_product()){是第62行,则该行为if。
试着用这个替换你的函数:
function wc_variable_simple_conditions()
{
if ( !function_exists( 'is_product' ) ) {
return;
}
if (is_product()) {
global $post;
$post_id = $post->ID;
$product = wc_get_product($post_id);
$type = $product->get_type();
if ($type == 'variable') {
add_filter('woocommerce_available_variation', 'load_variation_settings_fields');
} elseif ($type == 'simple') {
add_action('woocommerce_single_product_summary', 'custom_data_above_add_to_cart_button', 41);
}
}
}
确保您include
此函数的源includes/wc条件函数.php
http://woocommerce.wp-a2z.org/oik_api/is_product/
首先检查是否已激活,然后调用功能:
add_action('wp_head', 'wc_variable_simple_conditions');
function wc_variable_simple_conditions(){
if (!class_exists('WooCommerce')) return; // add this line
if (is_product()) {
global $post;
$post_id = $post->ID;
$product = wc_get_product($post_id);
$type = $product->get_type();
if ($type == 'variable') {
add_filter('woocommerce_available_variation', 'load_variation_settings_fields');
} elseif ($type == 'simple') {
add_action('woocommerce_single_product_summary', 'custom_data_above_add_to_cart_button', 41);
}
}
}
问题内容: 我试图与XAMPP和MySQL服务器建立简单连接,但是每当我尝试输入数据或连接到数据库时,都会出现此错误。 致命错误:未捕获错误:在C:\ xampp \ htdocs \ register.php:22中调用未定义函数mysql_connect() 堆栈跟踪:#0 {main}在第22行的C:\ xampp \ htdocs \ register.php中抛出 第22行的示例: 问题
我在尝试访问http://localhost/phpmyadmin/时收到以下错误: 在这里回顾了类似的主题后,我做了以下工作: null 我运行的是Windows10,Apache2.4-64bits、PHP7-64bits和mysqlserver5.7。Apache运行良好,PHP也运行良好(访问info.PHP无需担心) 谢了。
我正在按照一个在线教程来创建一个迷你购物车,一切都很顺利,但现在我得到了这个错误: 致命错误:未捕获错误:调用未定义函数mysql_query()
我在Codeigniter中发现了这些错误。 C:\xampp1\htdocs\CI\system\database\drivers\mysql\mysql\u驱动程序。php:92堆栈跟踪:#0 C:\xampp1\htdocs\CI\system\database\DB_驱动程序。php(116):CI_DB_mysql_驱动程序- 模范班 视图类 控制器类 数据库php
我正在尝试获取函数的值,该函数正好位于
我是一个初学者,也是一个文凭学生...请帮我解决这个错误...我尝试了很多在线解决方案,但都无济于事...我是php和MySQL的新手...