|
5 | 5 |
|
6 | 6 | get_header(); |
7 | 7 | echo '<div class="goods-catalog-container">'; |
8 | | -load_template ( dirname( __FILE__ ) . '/sidebar-goods.php' ) ; |
| 8 | +load_template(dirname(__FILE__) . '/sidebar-goods.php'); |
9 | 9 |
|
10 | 10 | $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
11 | 11 | ?> |
12 | 12 | <div class="goods-catalog"> |
13 | | - <?php |
14 | | - if (have_posts()) { |
15 | | - ?> |
16 | | - <div class="breadcrumbs"> |
17 | | - <?php |
18 | | - if (!is_search() || !is_404()) { |
19 | | - global $post; |
20 | | - if ($post != null) { |
21 | | - my_breadcrumb($post->post_parent); |
| 13 | + <div class="catalog-inner"> |
| 14 | + <?php |
| 15 | + if (have_posts()) { |
| 16 | + ?> |
| 17 | + <div class="breadcrumbs"> |
| 18 | + <?php |
| 19 | + if (!is_search() || !is_404()) { |
| 20 | + global $post; |
| 21 | + if ($post != null) { |
| 22 | + my_breadcrumb($post->post_parent); |
| 23 | + } else { |
| 24 | + my_breadcrumb(); |
| 25 | + } |
22 | 26 | } else { |
23 | | - my_breadcrumb(); |
| 27 | + print ' '; |
24 | 28 | } |
25 | | - } else { |
26 | | - print ' '; |
27 | | - } |
28 | | - ?> |
29 | | - </div> |
30 | | - <?php |
31 | | - global $posts; |
32 | | - $post = $posts[0]; |
| 29 | + ?> |
| 30 | + </div> |
| 31 | + <?php |
| 32 | + global $posts; |
| 33 | + $post = $posts[0]; |
33 | 34 |
|
34 | | - ob_start(); |
| 35 | + ob_start(); |
35 | 36 |
|
36 | | - echo '<h2 class="single-category-title">' . single_cat_title('', false) . '</h2>'; |
37 | | - echo '<p>' . category_description() . '</p>'; |
| 37 | + echo '<h2 class="single-category-title">' . single_cat_title('', false) . '</h2>'; |
| 38 | + echo '<p>' . category_description() . '</p>'; |
38 | 39 |
|
39 | | - // show sub-categories only in first page, if paged |
40 | | - if (!is_paged()) { |
41 | | - // show sub-categories list |
42 | | - $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
43 | | - $args = array( |
44 | | - 'parent' => $current_term->term_id, |
45 | | - 'taxonomy' => $current_term->taxonomy, |
46 | | - 'hide_empty' => 0, |
47 | | - 'hierarchical' => true, |
48 | | - 'depth' => 1 |
49 | | - ); |
| 40 | + // show sub-categories only in first page, if paged |
| 41 | + if (!is_paged()) { |
| 42 | + // show sub-categories list |
| 43 | + $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
| 44 | + $args = array( |
| 45 | + 'parent' => $current_term->term_id, |
| 46 | + 'taxonomy' => $current_term->taxonomy, |
| 47 | + 'hide_empty' => 0, |
| 48 | + 'hierarchical' => true, |
| 49 | + 'depth' => 1 |
| 50 | + ); |
50 | 51 |
|
51 | | - $category_list = get_categories($args); |
52 | | - // include |
53 | | - include 'content-goods_category.php'; |
| 52 | + $category_list = get_categories($args); |
| 53 | + // include |
| 54 | + include 'content-goods_category.php'; |
54 | 55 |
|
55 | | - echo "<hr>"; |
56 | | - } |
| 56 | + echo "<hr>"; |
| 57 | + } |
57 | 58 |
|
58 | 59 | // Start the Loop |
59 | | - while (have_posts()) { |
60 | | - the_post(); |
61 | | - ?> |
62 | | - <div class="grid"> |
63 | | - <article <?php post_class(); ?>> |
64 | | - <div class="goods-item-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> |
65 | | - <div class="goods-item-content"> |
66 | | - <?php |
67 | | - // show thumbnails |
68 | | - echo '<div class="goods-item-thumb-container">'; |
69 | | - if (has_post_thumbnail()) { |
70 | | - echo '<a href="' . get_permalink() . '">'; |
71 | | - the_post_thumbnail(array(150, 150), array('class' => 'goods-item-thumb')); |
72 | | - echo '</a>'; |
73 | | - } else { |
74 | | - // show default image if the thumbnail is not found |
75 | | - echo '<a href="' . get_permalink() . '"><img class="goods-item-thumb" src="' . plugins_url('img/gi.png', __FILE__) . '" alt=""></a>'; |
76 | | - } |
77 | | - echo '</div>'; |
78 | | - // get fields from metabox |
79 | | - $price = get_post_meta(get_the_ID(), 'gc_price', true); |
80 | | - $sku = get_post_meta(get_the_ID(), 'gc_sku', true); |
81 | | - $descr = get_post_meta(get_the_ID(), 'gc_descr', true); |
| 60 | + while (have_posts()) { |
| 61 | + the_post(); |
| 62 | + ?> |
| 63 | + <div class="grid"> |
| 64 | + <article <?php post_class(); ?>> |
| 65 | + <div class="goods-item-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> |
| 66 | + <div class="goods-item-content"> |
| 67 | + <?php |
| 68 | + // show thumbnails |
| 69 | + echo '<div class="goods-item-thumb-container">'; |
| 70 | + if (has_post_thumbnail()) { |
| 71 | + echo '<a href="' . get_permalink() . '">'; |
| 72 | + the_post_thumbnail(array(150, 150), array('class' => 'goods-item-thumb')); |
| 73 | + echo '</a>'; |
| 74 | + } else { |
| 75 | + // show default image if the thumbnail is not found |
| 76 | + echo '<a href="' . get_permalink() . '"><img class="goods-item-thumb" src="' . plugins_url('img/gi.png', __FILE__) . '" alt=""></a>'; |
| 77 | + } |
| 78 | + echo '</div>'; |
| 79 | + // get fields from metabox |
| 80 | + $price = get_post_meta(get_the_ID(), 'gc_price', true); |
| 81 | + $sku = get_post_meta(get_the_ID(), 'gc_sku', true); |
| 82 | + $descr = get_post_meta(get_the_ID(), 'gc_descr', true); |
82 | 83 |
|
83 | | - // show fields values |
84 | | - if ((isset($price)) && ($price != '')) { |
85 | | - echo "<p class=\"goods-price-single\">"; |
86 | | - echo __('Price:', 'gcat'); |
87 | | - echo " $price</p>"; |
88 | | - } |
89 | | - if ((isset($sku)) && ($sku != '')) { |
90 | | - echo "<p class=\"goods-sku\">"; |
91 | | - echo __('SKU:', 'gcat'); |
92 | | - echo " $sku</p>"; |
93 | | - } |
94 | | - if ((isset($descr)) && ($descr != '')) { |
95 | | - echo "<p class=\"goods-descr\">$descr</p>"; |
96 | | - } |
97 | | - ?> |
98 | | - </div> |
99 | | - </article> |
100 | | - </div> |
| 84 | + // show fields values |
| 85 | + if ((isset($price)) && ($price != '')) { |
| 86 | + echo "<p class=\"goods-price-single\">"; |
| 87 | + echo __('Price:', 'gcat'); |
| 88 | + echo " $price</p>"; |
| 89 | + } |
| 90 | + if ((isset($sku)) && ($sku != '')) { |
| 91 | + echo "<p class=\"goods-sku\">"; |
| 92 | + echo __('SKU:', 'gcat'); |
| 93 | + echo " $sku</p>"; |
| 94 | + } |
| 95 | + if ((isset($descr)) && ($descr != '')) { |
| 96 | + echo "<p class=\"goods-descr\">$descr</p>"; |
| 97 | + } |
| 98 | + ?> |
| 99 | + </div> |
| 100 | + </article> |
| 101 | + </div> |
101 | 102 |
|
102 | | - <?php |
| 103 | + <?php |
| 104 | + } |
| 105 | + } else { |
| 106 | + echo __('There are no products in the category.', 'gcat'); |
103 | 107 | } |
104 | | - } else { |
105 | | - echo __('There are no products in the category.', 'gcat'); |
106 | | - } |
107 | 108 | // Display navigation to next/previous pages when applicable |
108 | | - ?> |
109 | | - |
110 | | - <div class="clear"></div> |
111 | | - <div class="navigation"> |
112 | | - <?php |
113 | | - if (function_exists('goods_pagination')) |
114 | | - goods_pagination(); |
115 | | - else |
116 | | - posts_nav_link(); |
117 | 109 | ?> |
| 110 | + |
| 111 | + <div class="clear"></div> |
| 112 | + <div class="navigation"> |
| 113 | + <?php |
| 114 | + if (function_exists('goods_pagination')) |
| 115 | + goods_pagination(); |
| 116 | + else |
| 117 | + posts_nav_link(); |
| 118 | + ?> |
| 119 | + </div> |
118 | 120 | </div> |
119 | 121 | </div> |
120 | 122 | <?php |
|
0 commit comments