gpt4 book ai didi

php - 更改单一产品 stock.php woocommerce 会破坏网站,

转载 作者:行者123 更新时间:2023-11-27 23:36:49 27 4
gpt4 key购买 nike

我试图从 wp-content/plugins/woocommerce/templates/single-product/stock.php 更改 stock.php 文件的样式,同时通过将其复制到 mytheme/woocommerce/single-product/stock.php 如文件描述中所写,但由于某种原因它破坏了网站,现在即使我恢复更改或删除错误的副本代码和文件,当在浏览器中打开网页时,我收到消息:

"Warning: include(/homepages/13/d767788347/htdocs/clickandbuilds/Competitions294574/wp-content/plugins/woocommerce/templates/archive-product.php): failed to open stream: No such file or directory in /homepages/13/d767788347/htdocs/clickandbuilds/Competitions294574/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 249"

如果副本保留在文件夹中,则错误更改为:

"Warning: include(/homepages/13/d767788347/htdocs/clickandbuilds/Competitions294574/wp-content/plugins/woocommerce/templates/single-product.php): failed to open stream: No such file or directory in /homepages/13/d767788347/htdocs/clickandbuilds/Competitions294574/wp-includes/template-loader.php on line 78 "

我尝试改变颜色的文件如下所示:

<?php
/**
* Single Product stock.
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/stock.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.0.0
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

?>
<p class="stock <?php echo esc_attr( $class ); ?>"><?php echo wp_kses_post( $availability ); ?></p>

请帮助我恢复网站并更改显示库存产品数量的元素的颜色,我还想将文本“X 库存”更改为不同的内容,请问我该怎么做?

最佳答案

你试过吗:

1) 删除您在主题文件夹中创建的文件/文件夹以覆盖 WooCommerce

2) 删除 WooCommerce 并再次上传最新版本 - 或者如果您有权访问 wp-admin,则从插件更新它(如果您已经在使用最新版本,请将版本从 wp-content/plugins/更改为某个旧版本woocommerce/woocommerce.php)

关于php - 更改单一产品 stock.php woocommerce 会破坏网站,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57211463/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com