Version Description
- 19/06/2015 =
- Revamped button styles.
- Updated textdomain to 'woocommerce-grid-list-toggle'.
- Code tidy up.
Download this release
Release Info
Developer | jameskoster |
Plugin | WooCommerce Grid / List toggle |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.4.0 to 1.0.0
- assets/css/button.css +40 -1
- assets/css/button.less +21 -46
- assets/css/style.css +43 -1
- assets/css/style.less +9 -6
- languages/index.html +0 -0
- languages/wc_list_grid_toggle.po +0 -58
- languages/{wc_list_grid_toggle-de_DE.mo → woocommerce-grid-list-toggle-de_DE.mo} +0 -0
- languages/{wc_list_grid_toggle-de_DE.po → woocommerce-grid-list-toggle-de_DE.po} +0 -0
- languages/woocommerce-grid-list-toggle.pot +57 -0
- readme.txt +11 -6
- screenshot-1.jpg +0 -0
- grid-list-toggle.php → woocommerce-grid-list-toggle.php +25 -25
assets/css/button.css
CHANGED
@@ -1 +1,40 @@
|
|
1 |
-
.gridlist-toggle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.gridlist-toggle {
|
2 |
+
display: block;
|
3 |
+
clear: both;
|
4 |
+
margin: 0 !important;
|
5 |
+
padding: 1em 0 !important;
|
6 |
+
line-height: 1em !important;
|
7 |
+
}
|
8 |
+
.gridlist-toggle a {
|
9 |
+
display: inline-block;
|
10 |
+
padding: .618em;
|
11 |
+
-webkit-box-sizing: border-box;
|
12 |
+
/* Safari/Chrome, other WebKit */
|
13 |
+
-moz-box-sizing: border-box;
|
14 |
+
/* Firefox, other Gecko */
|
15 |
+
box-sizing: border-box;
|
16 |
+
/* Opera/IE 8+ */
|
17 |
+
text-align: center;
|
18 |
+
text-decoration: none !important;
|
19 |
+
font-weight: 400 !important;
|
20 |
+
font-family: sans-serif !important;
|
21 |
+
font-size: 1em !important;
|
22 |
+
line-height: 1em !important;
|
23 |
+
background-color: rgba(0, 0, 0, 0.1);
|
24 |
+
}
|
25 |
+
.gridlist-toggle a em {
|
26 |
+
display: none;
|
27 |
+
}
|
28 |
+
.gridlist-toggle a:hover {
|
29 |
+
background-color: rgba(0, 0, 0, 0.3);
|
30 |
+
}
|
31 |
+
.gridlist-toggle a.active {
|
32 |
+
background-color: rgba(0, 0, 0, 0.2);
|
33 |
+
}
|
34 |
+
.gridlist-toggle .dashicons:before,
|
35 |
+
.gridlist-toggle .dashicons {
|
36 |
+
font-size: 1em;
|
37 |
+
line-height: 1;
|
38 |
+
height: 1em;
|
39 |
+
width: 1em;
|
40 |
+
}
|
assets/css/button.less
CHANGED
@@ -2,63 +2,38 @@
|
|
2 |
|
3 |
.gridlist-toggle {
|
4 |
display: block;
|
5 |
-
clear:both;
|
6 |
-
|
7 |
-
|
8 |
-
padding:0 !important;
|
9 |
-
margin-bottom:1.5em;
|
10 |
-
.vertical_gradient(#eee,#aaa);
|
11 |
-
.border_radius(3px);
|
12 |
line-height: 1em !important;
|
13 |
-
|
14 |
-
inset 0 1px #eee,
|
15 |
-
inset 0 -1px #999,
|
16 |
-
0 1px 2px rgba(0,0,0,0.3);
|
17 |
-
box-shadow:
|
18 |
-
inset 0 1px #eee,
|
19 |
-
inset 0 -1px #999,
|
20 |
-
0 1px 2px rgba(0,0,0,0.3);
|
21 |
a {
|
22 |
display: inline-block;
|
23 |
-
|
24 |
.borderbox;
|
25 |
text-align: center;
|
26 |
-
|
27 |
-
|
28 |
-
font-weight: normal !important;
|
29 |
font-family: sans-serif !important;
|
30 |
-
font-size:1em !important;
|
31 |
-
line-height:
|
32 |
-
color:
|
33 |
-
|
34 |
-
-webkit-transition:background ease-in-out .2s;
|
35 |
-
-webkit-box-shadow:
|
36 |
-
inset 0 0 5px rgba(255,255,255,0.7),
|
37 |
-
inset 0 0 0 1px rgba(255,255,255,0.4);
|
38 |
-
box-shadow:
|
39 |
-
inset 0 0 5px rgba(255,255,255,0.7),
|
40 |
-
inset 0 0 0 1px rgba(255,255,255,0.4);
|
41 |
-
&#grid {
|
42 |
-
border-right:1px solid #000;
|
43 |
-
}
|
44 |
-
span {
|
45 |
display: none;
|
46 |
}
|
47 |
&:hover {
|
48 |
-
color:
|
49 |
-
background: rgba(255,255,255,0.2);
|
50 |
}
|
51 |
&.active {
|
52 |
-
|
53 |
-
|
54 |
-
color: #fff !important;
|
55 |
-
.text_shadow(0,1px,0,#000);
|
56 |
-
-webkit-box-shadow:
|
57 |
-
inset 0 1px 2px #444,
|
58 |
-
inset 0 -1px 0 #777;
|
59 |
-
-moz-box-shadow:
|
60 |
-
inset 0 1px 2px #444,
|
61 |
-
inset 0 -1px 0 #777;
|
62 |
}
|
63 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
2 |
|
3 |
.gridlist-toggle {
|
4 |
display: block;
|
5 |
+
clear: both;
|
6 |
+
margin: 0 !important;
|
7 |
+
padding: 1em 0 !important;
|
|
|
|
|
|
|
|
|
8 |
line-height: 1em !important;
|
9 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
a {
|
11 |
display: inline-block;
|
12 |
+
padding: .618em;
|
13 |
.borderbox;
|
14 |
text-align: center;
|
15 |
+
text-decoration: none !important;
|
16 |
+
font-weight: 400 !important;
|
|
|
17 |
font-family: sans-serif !important;
|
18 |
+
font-size: 1em !important;
|
19 |
+
line-height: 1em !important;
|
20 |
+
background-color: rgba(0,0,0,.1);
|
21 |
+
em {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
display: none;
|
23 |
}
|
24 |
&:hover {
|
25 |
+
background-color: rgba(0,0,0,.3);
|
|
|
26 |
}
|
27 |
&.active {
|
28 |
+
background-color: rgba(0,0,0,.2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
}
|
31 |
+
|
32 |
+
.dashicons:before,
|
33 |
+
.dashicons {
|
34 |
+
font-size: 1em;
|
35 |
+
line-height: 1;
|
36 |
+
height: 1em;
|
37 |
+
width: 1em;
|
38 |
+
}
|
39 |
}
|
assets/css/style.css
CHANGED
@@ -1 +1,43 @@
|
|
1 |
-
ul.products.grid div[itemprop="description"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul.products.grid div[itemprop="description"] {
|
2 |
+
display: none;
|
3 |
+
}
|
4 |
+
ul.products.grid hr {
|
5 |
+
display: none;
|
6 |
+
}
|
7 |
+
ul.products.list li.product {
|
8 |
+
float: none !important;
|
9 |
+
width: 100% !important;
|
10 |
+
text-align: left !important;
|
11 |
+
}
|
12 |
+
ul.products.list li.product:after {
|
13 |
+
content: "";
|
14 |
+
display: block;
|
15 |
+
clear: both;
|
16 |
+
}
|
17 |
+
ul.products.list li.product img {
|
18 |
+
width: 30.75% !important;
|
19 |
+
float: left;
|
20 |
+
margin-bottom: 1.5em;
|
21 |
+
-webkit-transition: none !important;
|
22 |
+
margin-right: 3.8% !important;
|
23 |
+
}
|
24 |
+
ul.products.list li.product h3,
|
25 |
+
ul.products.list li.product div[itemprop="description"],
|
26 |
+
ul.products.list li.product .price,
|
27 |
+
ul.products.list li.product .gridlist-buttonwrap {
|
28 |
+
width: 65.4%;
|
29 |
+
float: right;
|
30 |
+
clear: none;
|
31 |
+
}
|
32 |
+
ul.products.list li.product div[itemprop="description"] {
|
33 |
+
display: block;
|
34 |
+
}
|
35 |
+
ul.products.list li.product .star-rating {
|
36 |
+
margin: 0 0 1em;
|
37 |
+
}
|
38 |
+
ul.products.list li.product .gridlist-buttonwrap {
|
39 |
+
margin-bottom: 1.5em;
|
40 |
+
}
|
41 |
+
ul.products.list li.product hr {
|
42 |
+
clear: both;
|
43 |
+
}
|
assets/css/style.less
CHANGED
@@ -12,15 +12,15 @@ ul.products.grid {
|
|
12 |
ul.products.list {
|
13 |
li.product {
|
14 |
float: none !important;
|
15 |
-
width:100% !important;
|
16 |
.clearfix;
|
17 |
text-align: left !important;
|
18 |
img {
|
19 |
-
width:30.75% !important;
|
20 |
float: left;
|
21 |
-
margin-bottom:1.5em;
|
22 |
-
-webkit-transition:none !important;
|
23 |
-
margin-right:3.8% !important;
|
24 |
}
|
25 |
h3, div[itemprop="description"], .price, .gridlist-buttonwrap {
|
26 |
width: 65.4%;
|
@@ -30,8 +30,11 @@ ul.products.list {
|
|
30 |
div[itemprop="description"] {
|
31 |
display: block;
|
32 |
}
|
|
|
|
|
|
|
33 |
.gridlist-buttonwrap {
|
34 |
-
margin-bottom:1.5em;
|
35 |
}
|
36 |
hr {
|
37 |
clear: both;
|
12 |
ul.products.list {
|
13 |
li.product {
|
14 |
float: none !important;
|
15 |
+
width: 100% !important;
|
16 |
.clearfix;
|
17 |
text-align: left !important;
|
18 |
img {
|
19 |
+
width: 30.75% !important;
|
20 |
float: left;
|
21 |
+
margin-bottom: 1.5em;
|
22 |
+
-webkit-transition: none !important;
|
23 |
+
margin-right: 3.8% !important;
|
24 |
}
|
25 |
h3, div[itemprop="description"], .price, .gridlist-buttonwrap {
|
26 |
width: 65.4%;
|
30 |
div[itemprop="description"] {
|
31 |
display: block;
|
32 |
}
|
33 |
+
.star-rating {
|
34 |
+
margin: 0 0 1em;
|
35 |
+
}
|
36 |
.gridlist-buttonwrap {
|
37 |
+
margin-bottom: 1.5em;
|
38 |
}
|
39 |
hr {
|
40 |
clear: both;
|
languages/index.html
DELETED
File without changes
|
languages/wc_list_grid_toggle.po
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
# This file is distributed under the same license as the WooCommerce Grid / List Toggle package.
|
2 |
-
msgid ""
|
3 |
-
msgstr ""
|
4 |
-
"PO-Revision-Date: 2013-03-27 21:39:48+0000\n"
|
5 |
-
"MIME-Version: 1.0\n"
|
6 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
7 |
-
"Content-Transfer-Encoding: 8bit\n"
|
8 |
-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
9 |
-
"X-Generator: GlotPress/0.1\n"
|
10 |
-
"Project-Id-Version: WooCommerce Grid / List Toggle\n"
|
11 |
-
|
12 |
-
#: grid-list-toggle.php:41 grid-list-toggle.php:46
|
13 |
-
msgid "Default catalog view"
|
14 |
-
msgstr ""
|
15 |
-
|
16 |
-
#: grid-list-toggle.php:47
|
17 |
-
msgid "Display products in grid or list view by default"
|
18 |
-
msgstr ""
|
19 |
-
|
20 |
-
#: grid-list-toggle.php:51
|
21 |
-
msgid "Grid"
|
22 |
-
msgstr ""
|
23 |
-
|
24 |
-
#: grid-list-toggle.php:52
|
25 |
-
msgid "List"
|
26 |
-
msgstr ""
|
27 |
-
|
28 |
-
#: grid-list-toggle.php:111
|
29 |
-
msgid "Grid view"
|
30 |
-
msgstr ""
|
31 |
-
|
32 |
-
#: grid-list-toggle.php:111
|
33 |
-
msgid "List view"
|
34 |
-
msgstr ""
|
35 |
-
|
36 |
-
#: grid-list-toggle.php:0
|
37 |
-
msgid "WooCommerce Grid / List toggle"
|
38 |
-
msgstr ""
|
39 |
-
|
40 |
-
#: grid-list-toggle.php:0
|
41 |
-
msgid "http://jameskoster.co.uk/tag/grid-list-toggle/"
|
42 |
-
msgstr ""
|
43 |
-
|
44 |
-
#: grid-list-toggle.php:0
|
45 |
-
msgid "Adds a grid/list view toggle to product archives"
|
46 |
-
msgstr ""
|
47 |
-
|
48 |
-
#: grid-list-toggle.php:0
|
49 |
-
msgid "jameskoster"
|
50 |
-
msgstr ""
|
51 |
-
|
52 |
-
#: grid-list-toggle.php:0
|
53 |
-
msgid "http://jameskoster.co.uk"
|
54 |
-
msgstr ""
|
55 |
-
|
56 |
-
#: grid-list-toggle.php:0
|
57 |
-
msgid "0.3.2"
|
58 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/{wc_list_grid_toggle-de_DE.mo → woocommerce-grid-list-toggle-de_DE.mo}
RENAMED
File without changes
|
languages/{wc_list_grid_toggle-de_DE.po → woocommerce-grid-list-toggle-de_DE.po}
RENAMED
File without changes
|
languages/woocommerce-grid-list-toggle.pot
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2015 WooCommerce Grid / List toggle
|
2 |
+
# This file is distributed under the same license as the WooCommerce Grid / List toggle package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Grid / List toggle 1.0.0\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/woocommerce-grid-list-toggle\n"
|
7 |
+
"POT-Creation-Date: 2015-06-19 10:52:18+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: woocommerce-grid-list-toggle.php:41 woocommerce-grid-list-toggle.php:46
|
16 |
+
msgid "Default catalog view"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: woocommerce-grid-list-toggle.php:47
|
20 |
+
msgid "Display products in grid or list view by default"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: woocommerce-grid-list-toggle.php:51
|
24 |
+
msgid "Grid"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: woocommerce-grid-list-toggle.php:52
|
28 |
+
msgid "List"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: woocommerce-grid-list-toggle.php:110
|
32 |
+
msgid "Grid view"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: woocommerce-grid-list-toggle.php:110
|
36 |
+
msgid "List view"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#. Plugin Name of the plugin/theme
|
40 |
+
msgid "WooCommerce Grid / List toggle"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#. Plugin URI of the plugin/theme
|
44 |
+
msgid "http://jameskoster.co.uk/tag/grid-list-toggle/"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#. Description of the plugin/theme
|
48 |
+
msgid "Adds a grid/list view toggle to product archives"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#. Author of the plugin/theme
|
52 |
+
msgid "jameskoster"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#. Author URI of the plugin/theme
|
56 |
+
msgid "http://jameskoster.co.uk"
|
57 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WooCommerce Grid / List toggle ===
|
2 |
Contributors: jameskoster
|
3 |
Tags: woocommerce, grid, list, products, ecommerce
|
4 |
-
Requires at least:
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -11,7 +11,7 @@ Adds a grid/list view toggle to product archives
|
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
WooCommerce Grid / List toggle is a simple plugin which adds a
|
15 |
|
16 |
The list view arranges products in a vertical list and pulls in the excerpt to give a more detailed overview.
|
17 |
|
@@ -61,10 +61,15 @@ function remove_gridlist_styles() {
|
|
61 |
|
62 |
== Screenshots ==
|
63 |
|
64 |
-
1.
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
= 0.4.0 - 04/02/2013 =
|
69 |
* WooCommerce 2.1 compatibility.
|
70 |
|
@@ -112,4 +117,4 @@ function remove_gridlist_styles() {
|
|
112 |
* Removed toggle button styling - this should be done in your theme
|
113 |
|
114 |
= 0.1 =
|
115 |
-
Initial release.
|
1 |
=== WooCommerce Grid / List toggle ===
|
2 |
Contributors: jameskoster
|
3 |
Tags: woocommerce, grid, list, products, ecommerce
|
4 |
+
Requires at least: 4.0
|
5 |
+
Tested up to: 4.6
|
6 |
+
Stable tag: 1.0.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
WooCommerce Grid / List toggle is a simple plugin which adds a grid / list toggle button to your product archives allowing users to toggle between grid / list views of your products on your WooCommerce store.
|
15 |
|
16 |
The list view arranges products in a vertical list and pulls in the excerpt to give a more detailed overview.
|
17 |
|
61 |
|
62 |
== Screenshots ==
|
63 |
|
64 |
+
1. List view.
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.0.0 - 19/06/2015 =
|
69 |
+
* Revamped button styles.
|
70 |
+
* Updated textdomain to 'woocommerce-grid-list-toggle'.
|
71 |
+
* Code tidy up.
|
72 |
+
|
73 |
= 0.4.0 - 04/02/2013 =
|
74 |
* WooCommerce 2.1 compatibility.
|
75 |
|
117 |
* Removed toggle button styling - this should be done in your theme
|
118 |
|
119 |
= 0.1 =
|
120 |
+
Initial release.
|
screenshot-1.jpg
DELETED
Binary file
|
grid-list-toggle.php → woocommerce-grid-list-toggle.php
RENAMED
@@ -3,13 +3,14 @@
|
|
3 |
Plugin Name: WooCommerce Grid / List toggle
|
4 |
Plugin URI: http://jameskoster.co.uk/tag/grid-list-toggle/
|
5 |
Description: Adds a grid/list view toggle to product archives
|
6 |
-
Version: 0.
|
7 |
Author: jameskoster
|
8 |
Author URI: http://jameskoster.co.uk
|
9 |
-
Requires at least:
|
|
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
-
Text Domain:
|
13 |
Domain Path: /languages/
|
14 |
*/
|
15 |
|
@@ -21,12 +22,12 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
21 |
/**
|
22 |
* Localisation
|
23 |
**/
|
24 |
-
load_plugin_textdomain( '
|
25 |
|
26 |
/**
|
27 |
* WC_List_Grid class
|
28 |
**/
|
29 |
-
if (!class_exists('WC_List_Grid')) {
|
30 |
|
31 |
class WC_List_Grid {
|
32 |
|
@@ -37,18 +38,18 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
37 |
// Init settings
|
38 |
$this->settings = array(
|
39 |
array(
|
40 |
-
'name'
|
41 |
-
'type'
|
42 |
-
'id'
|
43 |
),
|
44 |
array(
|
45 |
-
'name' => __( 'Default catalog view', '
|
46 |
-
'desc_tip' => __( 'Display products in grid or list view by default', '
|
47 |
'id' => 'wc_glt_default',
|
48 |
'type' => 'select',
|
49 |
'options' => array(
|
50 |
-
'grid' => __('Grid', '
|
51 |
-
'list' => __('List', '
|
52 |
)
|
53 |
),
|
54 |
array( 'type' => 'sectionend', 'id' => 'wc_glt_options' ),
|
@@ -91,24 +92,22 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
91 |
|
92 |
// Scripts & styles
|
93 |
function setup_scripts_styles() {
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
}
|
98 |
}
|
|
|
99 |
function setup_scripts_script() {
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
add_action( 'wp_footer', array(&$this, 'gridlist_set_default_view') );
|
104 |
-
}
|
105 |
}
|
106 |
|
107 |
// Toggle button
|
108 |
function gridlist_toggle_button() {
|
109 |
?>
|
110 |
<nav class="gridlist-toggle">
|
111 |
-
<a href="#" id="grid" title="<?php _e('Grid view', '
|
112 |
</nav>
|
113 |
<?php
|
114 |
}
|
@@ -136,9 +135,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
136 |
$default = get_option( 'wc_glt_default' );
|
137 |
?>
|
138 |
<script>
|
139 |
-
if (jQuery.cookie('gridcookie') == null) {
|
140 |
-
jQuery('ul.products').addClass('<?php echo $default; ?>');
|
141 |
-
jQuery('.gridlist-toggle #<?php echo $default; ?>').addClass('active');
|
142 |
}
|
143 |
</script>
|
144 |
<?php
|
@@ -152,6 +151,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
152 |
|
153 |
}
|
154 |
}
|
|
|
155 |
$WC_List_Grid = new WC_List_Grid();
|
156 |
}
|
157 |
}
|
3 |
Plugin Name: WooCommerce Grid / List toggle
|
4 |
Plugin URI: http://jameskoster.co.uk/tag/grid-list-toggle/
|
5 |
Description: Adds a grid/list view toggle to product archives
|
6 |
+
Version: 1.0.0
|
7 |
Author: jameskoster
|
8 |
Author URI: http://jameskoster.co.uk
|
9 |
+
Requires at least: 4.0
|
10 |
+
Tested up to: 4.6
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
+
Text Domain: woocommerce-grid-list-toggle
|
14 |
Domain Path: /languages/
|
15 |
*/
|
16 |
|
22 |
/**
|
23 |
* Localisation
|
24 |
**/
|
25 |
+
load_plugin_textdomain( 'woocommerce-grid-list-toggle', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
26 |
|
27 |
/**
|
28 |
* WC_List_Grid class
|
29 |
**/
|
30 |
+
if ( ! class_exists( 'WC_List_Grid' ) ) {
|
31 |
|
32 |
class WC_List_Grid {
|
33 |
|
38 |
// Init settings
|
39 |
$this->settings = array(
|
40 |
array(
|
41 |
+
'name' => __( 'Default catalog view', 'woocommerce-grid-list-toggle' ),
|
42 |
+
'type' => 'title',
|
43 |
+
'id' => 'wc_glt_options'
|
44 |
),
|
45 |
array(
|
46 |
+
'name' => __( 'Default catalog view', 'woocommerce-grid-list-toggle' ),
|
47 |
+
'desc_tip' => __( 'Display products in grid or list view by default', 'woocommerce-grid-list-toggle' ),
|
48 |
'id' => 'wc_glt_default',
|
49 |
'type' => 'select',
|
50 |
'options' => array(
|
51 |
+
'grid' => __( 'Grid', 'woocommerce-grid-list-toggle' ),
|
52 |
+
'list' => __( 'List', 'woocommerce-grid-list-toggle' )
|
53 |
)
|
54 |
),
|
55 |
array( 'type' => 'sectionend', 'id' => 'wc_glt_options' ),
|
92 |
|
93 |
// Scripts & styles
|
94 |
function setup_scripts_styles() {
|
95 |
+
wp_enqueue_style( 'grid-list-layout', plugins_url( '/assets/css/style.css', __FILE__ ) );
|
96 |
+
wp_enqueue_style( 'grid-list-button', plugins_url( '/assets/css/button.css', __FILE__ ) );
|
97 |
+
wp_enqueue_style( 'dashicons' );
|
|
|
98 |
}
|
99 |
+
|
100 |
function setup_scripts_script() {
|
101 |
+
wp_enqueue_script( 'cookie', plugins_url( '/assets/js/jquery.cookie.min.js', __FILE__ ), array( 'jquery' ) );
|
102 |
+
wp_enqueue_script( 'grid-list-scripts', plugins_url( '/assets/js/jquery.gridlistview.min.js', __FILE__ ), array( 'jquery' ) );
|
103 |
+
add_action( 'wp_footer', array( $this, 'gridlist_set_default_view' ) );
|
|
|
|
|
104 |
}
|
105 |
|
106 |
// Toggle button
|
107 |
function gridlist_toggle_button() {
|
108 |
?>
|
109 |
<nav class="gridlist-toggle">
|
110 |
+
<a href="#" id="grid" title="<?php _e('Grid view', 'woocommerce-grid-list-toggle'); ?>"><span class="dashicons dashicons-grid-view"></span> <em><?php _e( 'Grid view', 'woocommerce-grid-list-toggle' ); ?></em></a><a href="#" id="list" title="<?php _e('List view', 'woocommerce-grid-list-toggle'); ?>"><span class="dashicons dashicons-exerpt-view"></span> <em><?php _e( 'List view', 'woocommerce-grid-list-toggle' ); ?></em></a>
|
111 |
</nav>
|
112 |
<?php
|
113 |
}
|
135 |
$default = get_option( 'wc_glt_default' );
|
136 |
?>
|
137 |
<script>
|
138 |
+
if (jQuery.cookie( 'gridcookie' ) == null) {
|
139 |
+
jQuery( 'ul.products' ).addClass( '<?php echo $default; ?>' );
|
140 |
+
jQuery( '.gridlist-toggle #<?php echo $default; ?>' ).addClass( 'active' );
|
141 |
}
|
142 |
</script>
|
143 |
<?php
|
151 |
|
152 |
}
|
153 |
}
|
154 |
+
|
155 |
$WC_List_Grid = new WC_List_Grid();
|
156 |
}
|
157 |
}
|