woocommerce/templates/loop-shop.php

53 lines
1.4 KiB
PHP
Raw Normal View History

2011-08-09 15:16:18 +00:00
<?php
global $columns, $per_page;
2011-08-10 17:11:11 +00:00
do_action('woocommerce_before_shop_loop');
2011-08-09 15:16:18 +00:00
$loop = 0;
if (!isset($columns) || !$columns) $columns = apply_filters('loop_shop_columns', 4);
if (!isset($per_page) || !$per_page) $per_page = apply_filters('loop_shop_per_page', get_option('posts_per_page'));
2011-08-10 18:40:47 +00:00
if ($per_page !== get_option('posts_per_page')) query_posts( array_merge( $wp_query->query, array( 'posts_per_page' => $per_page ) ) );
2011-08-09 15:16:18 +00:00
ob_start();
2011-08-10 17:11:11 +00:00
if (have_posts()) : while (have_posts()) : the_post(); $_product = &new woocommerce_product( $post->ID ); $loop++;
2011-08-09 15:16:18 +00:00
?>
<li class="product <?php if ($loop%$columns==0) echo 'last'; if (($loop-1)%$columns==0) echo 'first'; ?>">
2011-08-10 17:11:11 +00:00
<?php do_action('woocommerce_before_shop_loop_item'); ?>
2011-08-09 15:16:18 +00:00
<a href="<?php the_permalink(); ?>">
2011-08-10 17:11:11 +00:00
<?php do_action('woocommerce_before_shop_loop_item_title', $post, $_product); ?>
2011-08-09 15:16:18 +00:00
2011-08-10 17:30:58 +00:00
<h3><?php the_title(); ?></h3>
2011-08-09 15:16:18 +00:00
2011-08-10 17:11:11 +00:00
<?php do_action('woocommerce_after_shop_loop_item_title', $post, $_product); ?>
2011-08-09 15:16:18 +00:00
</a>
2011-08-10 17:11:11 +00:00
<?php do_action('woocommerce_after_shop_loop_item', $post, $_product); ?>
2011-08-09 15:16:18 +00:00
</li><?php
if ($loop==$per_page) break;
endwhile; endif;
if ($loop==0) :
2011-08-10 17:11:11 +00:00
echo '<p class="info">'.__('No products found which match your selection.', 'woothemes').'</p>';
2011-08-09 15:16:18 +00:00
else :
$found_posts = ob_get_clean();
echo '<ul class="products">' . $found_posts . '</ul><div class="clear"></div>';
endif;
2011-08-10 17:11:11 +00:00
do_action('woocommerce_after_shop_loop');