-5
有人可以向我解釋這段代碼究竟幹了什麼嗎?我特別對'額外職位類'部分感到困惑。我試圖達到的唯一目標是每4個班級都有一個額外的班級。我需要一些關於此代碼的幫助
global $product, $woocommerce_loop;
$PHT_shopID = get_option('woocommerce_shop_page_id');
$PHT_shopID = get_permalink($PHT_shopID);
// 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);
}
// Ensure visibility
if (!$product || !$product->is_visible()) {
return;
}
// Increase loop count
$woocommerce_loop['loop']++;
// Extra post classes
$PHTclasses = array();
if (0 === ($woocommerce_loop['loop']) % $woocommerce_loop['columns'] || 1 === $woocommerce_loop['columns'])
$PHTclasses[] = 'first';
if (0 === ($woocommerce_loop['loop']) % $woocommerce_loop['columns'])
$PHTclasses[] = 'last';
$PHTclasses[] = 'primary-product-block';
?>
這是什麼部分讓你感到困惑? – Carcigenicate
當這些課程獲得一個額外的課@Carcigenicate – Bokdem
我投票結束這個問題作爲題外話,因爲[so]不是用於解釋什麼代碼 –