不知何故,类别页面垂直显示我的产品,而不是例如4个产品水平然后重新开始。我认为问题出在一些PHP文件中,它为每个产品提供100%宽度的div,因此忽略我的CSS为内联块和25%宽度(类别页面上的产品)。
这是我的意思的解释图片,以及我如何修复"它在Chrome Inspector Tool上。
我要看看wrapper-start.php文件还是? (请记住,我没有任何使用PHP的经验,而且我已经尝试重命名文件以查看错误排序的位置)
该代码如下:
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$template = get_option( 'template' );
switch( $template ) {
case 'twentyeleven' :
echo '<div id="primary"><div id="content" role="main">';
break;
case 'twentytwelve' :
echo '<div id="primary" class="site-content"><div id="content" role="main">';
break;
case 'twentythirteen' :
echo '<div id="primary" class="site-content"><div id="content" role="main" class="entry-content twentythirteen">';
break;
case 'twentyfourteen' :
echo '<div id="primary" class="content-area"><div id="content" role="main" class="site-content twentyfourteen"><div class="tfwc">';
break;
default :
echo '<div id="main-container" class="container"><div class="row" style="padding: 0px 15px; width:100%; display:inline-block;">';
break;
}
或者是content-product_cat.php?
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce_loop;
// Store loop count we're currently on
if ( empty( $woocommerce_loop['loop'] ) )
$woocommerce_loop['loop'] = 0;
// Store column count for displaying the grid
if ( empty( $woocommerce_loop['columns'] ) )
$woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );
// Increase loop count
$woocommerce_loop['loop']++;
?>
<li class="product-category product<?php
if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1 )
echo ' first';
if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
echo ' last';
?>">
<?php do_action( 'woocommerce_before_subcategory', $category ); ?>
<a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>">
<?php
/**
* woocommerce_before_subcategory_title hook
*
* @hooked woocommerce_subcategory_thumbnail - 10
*/
do_action( 'woocommerce_before_subcategory_title', $category );
?>
<h3>
<?php
echo $category->name;
if ( $category->count > 0 )
echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category );
?>
</h3>
<?php
/**
* woocommerce_after_subcategory_title hook
*/
do_action( 'woocommerce_after_subcategory_title', $category );
?>
</a>
<?php do_action( 'woocommerce_after_subcategory', $category ); ?>
</li>
这是A link to the website/category page。