有几种解决方案。我建议的解决方案是删除打印价格的操作&;标题放在首位。我建议以编程方式删除这些操作的主要原因是因为它与主题无关。这些修改应该适用于任何主题,您不必担心CSS的特殊性或任何废话。
如果您使用的是自定义主题,那么只需在函数中插入几行即可。php文件,但由于您使用的主题将在下次更新时覆盖您的更改,我建议creating your own woocommerce plugin. 这并不像听起来那么可怕。事实上,我相信我刚刚开发的这个小插件可以满足您的所有需要。
<?php
/*
Plugin Name: My WooCommerce Modifications
Plugin URI: http://woothemes.com/
Description: Modificatinos to my WooCommerce site
Version: 1.0
Author: Patrick Rauland
Author URI: http://www.patrickrauland.com/
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
/* Copyright 2013 Patrick Rauland
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Check if WooCommerce is active
**/
if ( in_array( \'woocommerce/woocommerce.php\', apply_filters( \'active_plugins\', get_option( \'active_plugins\' ) ) ) ) {
// remove default woocommerce actions
function my_woocommerce_modifications()
{
// hide product price on category page
remove_action( \'woocommerce_after_shop_loop_item_title\', \'woocommerce_template_loop_price\', 10);
// hide add to cart button on category page
remove_action( \'woocommerce_after_shop_loop_item\', \'woocommerce_template_loop_add_to_cart\', 10);
}
add_action( \'init\', \'my_woocommerce_modifications\' );
// remove the title on the category shop page
function my_woocommerce_title_modifications($title, $id)
{
// if we\'re on the category shop page then return nothing.
if(in_the_loop() && is_product_category())
{
return "";
}
return $title;
}
add_filter( \'the_title\', \'my_woocommerce_title_modifications\');
}
这是
version controlled gist 如果你需要的话。