Skip to content

Commit 19f1863

Browse files
committed
1 parent 69d9b4c commit 19f1863

File tree

8 files changed

+198
-182
lines changed

8 files changed

+198
-182
lines changed

archive-goods.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
$category_list = get_categories('hide_empty=0&type=goods&taxonomy=goods_category&parent=0&orderby=ID' . $category_id);
1616
// include
1717
echo '<div class="goods-catalog">';
18+
echo '<div class="catalog-inner">';
19+
1820
include 'content-goods_category.php';
19-
echo '</div>';
20-
echo '</div>';
21-
get_footer();
22-
21+
22+
echo '</div>'; // catalog-inner
23+
echo '</div>'; // goods-catalog
24+
echo '</div>'; // goods-catalog-container
25+
get_footer();

catalog-style.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/* Containers */
2-
.goods-catalog {}
2+
.goods-catalog {
3+
/*overflow:hidden;*/
4+
}
5+
6+
.catalog-inner {
7+
float: left;
8+
}
39

410
/* Grid catalog */
511
.goods-catalog .grid {

content-goods_category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@
4343
}
4444

4545
echo "</div>";
46-
echo "<div class=\"clear\"></div>";
46+
//echo "<div class=\"clear\"></div>";
4747
}

goods-cat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Goods Catalog
55
Plugin URI: http://oriolo.ru/wordpress/goods-catalog/
66
Description: Plugin that creates simple catalog of goods.
7-
Version: 0.5
7+
Version: 0.5.1
88
Author: Irina Sokolovskaya
99
Author URI: http://oriolo.ru/
1010
License: GNU General Public License v2 or later

readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== Goods Catalog ===
22
Contributors: oriolo
33
Tags: catalog, catalogue, product, products, goods, product catalog, product catalogue, catalog of goods
4-
Stable tag: v0.5
4+
Stable tag: v0.5.1
55
Requires at least: 3.3.0
66
Tested up to: 3.8.1
77
License: GNU General Public License v2 or later
@@ -40,6 +40,10 @@ You need to update your permalinks. Just go to Console -> Settings -> Permalinks
4040

4141
== Changelog ==
4242

43+
= v0.5.1 =
44+
45+
* Fixed bug on single product page: http://wordpress.org/support/topic/sidebar-85?replies=6#post-5368763
46+
4347
= v0.5 =
4448

4549
* Added sidebar
@@ -87,7 +91,6 @@ Small bug fix:
8791

8892
= v0.2-beta.1 =
8993

90-
Small update:
9194
* removed displaying of PHP errors
9295

9396
= v0.2-beta =

single-goods.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
get_header();
77
echo '<div class="goods-catalog-container">';
8-
load_template ( dirname( __FILE__ ) . '/sidebar-goods.php' ) ;
8+
load_template(dirname(__FILE__) . '/sidebar-goods.php');
99

1010
echo '<div class="goods-catalog">';
11+
echo '<div class="catalog-inner">';
1112
if (have_posts()) {
1213
while (have_posts()) {
1314
the_post();
@@ -77,15 +78,14 @@
7778
echo '</p>';
7879
?>
7980
</div>
81+
<div class="clear"></div>
8082
</header>
81-
<div class="clear"></div>
8283
<div class="entry-content">
8384
<?php
8485
the_content();
8586
?>
8687
</div>
87-
<footer>
88-
</footer>
88+
<div class="clear"></div>
8989
</article>
9090
<?php
9191
}
@@ -99,4 +99,5 @@
9999
get_404_template();
100100
}
101101
echo '</div>';
102+
echo '</div>';
102103
get_footer();

taxonomy-goods_category.php

Lines changed: 94 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -5,116 +5,118 @@
55

66
get_header();
77
echo '<div class="goods-catalog-container">';
8-
load_template ( dirname( __FILE__ ) . '/sidebar-goods.php' ) ;
8+
load_template(dirname(__FILE__) . '/sidebar-goods.php');
99

1010
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1111
?>
1212
<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+
}
2226
} else {
23-
my_breadcrumb();
27+
print ' ';
2428
}
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];
3334

34-
ob_start();
35+
ob_start();
3536

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>';
3839

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+
);
5051

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';
5455

55-
echo "<hr>";
56-
}
56+
echo "<hr>";
57+
}
5758

5859
// 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);
8283

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>
101102

102-
<?php
103+
<?php
104+
}
105+
} else {
106+
echo __('There are no products in the category.', 'gcat');
103107
}
104-
} else {
105-
echo __('There are no products in the category.', 'gcat');
106-
}
107108
// 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();
117109
?>
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>
118120
</div>
119121
</div>
120122
<?php

0 commit comments

Comments
 (0)