PageRenderTime 54ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/loop-shop.php

https://github.com/scottpoulin/jigoshop
PHP | 70 lines | 28 code | 25 blank | 17 comment | 9 complexity | fe7241a785f3a7eaae19097e40fbda9a MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * Loop shop template
  4. *
  5. * DISCLAIMER
  6. *
  7. * Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer
  8. * versions in the future. If you wish to customise Jigoshop core for your needs,
  9. * please use our GitHub repository to publish essential changes for consideration.
  10. *
  11. * @package Jigoshop
  12. * @category Catalog
  13. * @author Jigoshop
  14. * @copyright Copyright Š 2011-2013 Jigoshop.
  15. * @license http://jigoshop.com/license/commercial-edition
  16. */
  17. ?>
  18. <?php
  19. global $columns, $per_page;
  20. do_action('jigoshop_before_shop_loop');
  21. $loop = 0;
  22. if (!isset($columns) || !$columns) $columns = apply_filters('loop_shop_columns', 4);
  23. //if (!isset($per_page) || !$per_page) $per_page = apply_filters('loop_shop_per_page', get_option('posts_per_page'));
  24. //if ($per_page > get_option('posts_per_page')) query_posts( array_merge( $wp_query->query, array( 'posts_per_page' => $per_page ) ) );
  25. ob_start();
  26. if (have_posts()) : while (have_posts()) : the_post(); $_product = new jigoshop_product( $post->ID ); $loop++;
  27. ?>
  28. <li class="product <?php if ($loop%$columns==0) echo 'last'; if (($loop-1)%$columns==0) echo 'first'; ?>">
  29. <?php do_action('jigoshop_before_shop_loop_item'); ?>
  30. <a href="<?php the_permalink(); ?>">
  31. <?php do_action('jigoshop_before_shop_loop_item_title', $post, $_product); ?>
  32. <strong><?php the_title(); ?></strong>
  33. <?php do_action('jigoshop_after_shop_loop_item_title', $post, $_product); ?>
  34. </a>
  35. <?php do_action('jigoshop_after_shop_loop_item', $post, $_product); ?>
  36. </li><?php
  37. if ($loop==$per_page) break;
  38. endwhile; endif;
  39. if ($loop==0) :
  40. echo '<p class="info">'.__('No products found which match your selection.', 'jigoshop').'</p>';
  41. else :
  42. $found_posts = ob_get_clean();
  43. echo '<ul class="products">' . $found_posts . '</ul><div class="clear"></div>';
  44. endif;
  45. do_action('jigoshop_after_shop_loop');