use*_*660 5 css php wordpress woocommerce
我想在将商品添加到购物车后删除"产品成功添加到购物车"的措辞和区域.我只是希望没有任何内容,没有消息,也没有空间留言.
这是网站:http ://www.tinytreasurehunts.com该代码在woocommerece-functions.php中
有什么想法吗?
要在PHP级别解决此问题,请在主题中添加以下模板文件(和结构)
/wp-content/themes/YOUR-THEME/woocommerce/shop/messages.php:
<?php
/**
* Show messages
*
* @author brasofilo
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! $messages ) return;
foreach ( $messages as $message ) :
// The message does not contain the "add to cart" string, so print the message
// http://stackoverflow.com/q/4366730/1287812
if ( strpos( $message, 'added to your cart' ) === false ) :
?>
<div class="woocommerce-message"><?php echo wp_kses_post( $message ); ?></div>
<?php
endif;
endforeach;
Run Code Online (Sandbox Code Playgroud)
请参阅:模板结构+通过主题覆盖模板
小智 7
使用以下其中一个:
旧版本
$woocommerce->clear_messages();
Run Code Online (Sandbox Code Playgroud)
版本2.3
wc_clear_notices();
Run Code Online (Sandbox Code Playgroud)
使用 CSS 并将 ID 或关联类的显示设置为无。
.page-id-522 .woocommerce_message {
display: none;
}
Run Code Online (Sandbox Code Playgroud)
这是特定于页面 ID 522 的。确保这不会隐藏其他有用的消息,例如信用卡被拒绝等。