Version Description
- - Added French translation (thanks to whoaloic)
- - Fixed WooCommerce 2.0.X compatibily
- - Now is capable for WooCommerce 2.0.X and 2.1.X
Download this release
Release Info
Developer | sormano |
Plugin | WooCommerce Products Per Page |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.5
- admin/options-page.php +193 -0
- assets/css/style.css +1 -1
- languages/wppp-nl_NL.mo +0 -0
- languages/wppp-nl_NL.po +34 -22
- objects/wppp-dropdown.php +25 -9
- readme.txt +19 -1
- views/options-page.php +0 -154
- woocommerce-products-per-page.php +138 -107
admin/options-page.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class wppp_options extends woocommerce_products_per_page {
|
4 |
+
|
5 |
+
|
6 |
+
public function __construct() {
|
7 |
+
|
8 |
+
parent::__construct();
|
9 |
+
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
public function wppp_settings_init() {
|
14 |
+
|
15 |
+
register_setting( 'wppp_settings', 'wppp_settings' );
|
16 |
+
|
17 |
+
add_settings_section(
|
18 |
+
'wppp_settings',
|
19 |
+
'WooCommerce Products Per Page',
|
20 |
+
array( $this, 'wppp_section_callback' ),
|
21 |
+
'wppp_settings'
|
22 |
+
);
|
23 |
+
|
24 |
+
|
25 |
+
add_settings_field(
|
26 |
+
'wppp_location',
|
27 |
+
__( 'Dropdown location', 'wppp' ),
|
28 |
+
array( $this, 'wppp_settings_field_location' ),
|
29 |
+
'wppp_settings',
|
30 |
+
'wppp_settings'
|
31 |
+
);
|
32 |
+
|
33 |
+
add_settings_field(
|
34 |
+
'wppp_products_per_page_list',
|
35 |
+
__( 'List of dropdown options', 'wppp' ),
|
36 |
+
array( $this, 'wppp_settings_field_ppp_list' ),
|
37 |
+
'wppp_settings',
|
38 |
+
'wppp_settings'
|
39 |
+
);
|
40 |
+
|
41 |
+
add_settings_field(
|
42 |
+
'wppp_default_ppp',
|
43 |
+
__( 'Default products per page', 'wppp' ),
|
44 |
+
array( $this, 'wppp_settings_field_default_ppp' ),
|
45 |
+
'wppp_settings',
|
46 |
+
'wppp_settings'
|
47 |
+
);
|
48 |
+
|
49 |
+
add_settings_field(
|
50 |
+
'wppp_shop_columns',
|
51 |
+
__( 'Shop columns', 'wppp' ),
|
52 |
+
array( $this, 'wppp_settings_field_shop_columns' ),
|
53 |
+
'wppp_settings',
|
54 |
+
'wppp_settings'
|
55 |
+
);
|
56 |
+
|
57 |
+
add_settings_field(
|
58 |
+
'wppp_ppp_behaviour',
|
59 |
+
__( 'First category page', 'wppp' ),
|
60 |
+
array( $this, 'wppp_settings_field_behaviour' ),
|
61 |
+
'wppp_settings',
|
62 |
+
'wppp_settings'
|
63 |
+
);
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
public function wppp_render_settings_page() {
|
69 |
+
|
70 |
+
?>
|
71 |
+
<div class="wrap">
|
72 |
+
|
73 |
+
<h2><?php _e( 'WooCommerce Products Per Page', 'wppp' ); ?></h2>
|
74 |
+
|
75 |
+
<form method="POST" action="options.php">
|
76 |
+
<?php
|
77 |
+
settings_fields( 'wppp_settings' );
|
78 |
+
do_settings_sections( 'wppp_settings' );
|
79 |
+
submit_button();
|
80 |
+
?>
|
81 |
+
</form>
|
82 |
+
|
83 |
+
</div>
|
84 |
+
<?php
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
public function wppp_settings_field_location() {
|
89 |
+
|
90 |
+
?>
|
91 |
+
<select name="wppp_settings[location]" class="">
|
92 |
+
<option value="top" <?php selected( $this->options['location'], 'top' ); ?>> <?php _e( 'Top', 'wppp' ); ?></option>
|
93 |
+
<option value="bottom" <?php selected( $this->options['location'], 'bottom' ); ?>> <?php _e( 'Bottom', 'wppp' ); ?></option>
|
94 |
+
<option value="topbottom" <?php selected( $this->options['location'], 'topbottom' ); ?>> <?php _e( 'Top/Bottom', 'wppp' ); ?></option>
|
95 |
+
<option value="none" <?php selected( $this->options['location'], 'none' ); ?>> <?php _e( 'None', 'wppp' ); ?></option>
|
96 |
+
</select>
|
97 |
+
<?php
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
public function wppp_settings_field_ppp_list() {
|
103 |
+
|
104 |
+
?>
|
105 |
+
<label for="productsPerPage">
|
106 |
+
<input type="text" id="productsPerPage" name="wppp_settings[productsPerPage]" value="<?php echo $this->options['productsPerPage']; ?>">
|
107 |
+
<?php _e( 'Seperated by spaces <em>(-1 for all products)</em>', 'wppp' ); ?></label>
|
108 |
+
<?php
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
+
public function wppp_settings_field_default_ppp() {
|
114 |
+
|
115 |
+
?>
|
116 |
+
<label for="default_ppp">
|
117 |
+
<input type="number" id="default_ppp" name="wppp_settings[default_ppp]" value="<?php echo $this->options['default_ppp']; ?>">
|
118 |
+
<em><?php _e( '-1 for all products', 'wppp' ); ?></em></label>
|
119 |
+
<?php
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
public function wppp_settings_field_shop_columns() {
|
125 |
+
|
126 |
+
?>
|
127 |
+
<label for="shop_columns">
|
128 |
+
<input type="number" id="shop_columns" name="wppp_settings[shop_columns]" value="<?php echo $this->options['shop_columns']; ?>">
|
129 |
+
</label>
|
130 |
+
<?php
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
public function wppp_settings_field_behaviour() {
|
136 |
+
|
137 |
+
?>
|
138 |
+
<label for="behaviour">
|
139 |
+
<input type="checkbox" id="behaviour" name="wppp_settings[behaviour]" value="1" <?php checked( $this->options['behaviour'], 1 ); ?>>
|
140 |
+
<?php _e( 'When checked and a new number of PPP is selected, the visitor will be send to the first page of the product category', 'wppp' ); ?>
|
141 |
+
</label>
|
142 |
+
<style>
|
143 |
+
.tooltip {
|
144 |
+
width: 200px;
|
145 |
+
height: auto;
|
146 |
+
background-color: rgba( 0,0,0,0.8 );
|
147 |
+
color: #f1f1f1;
|
148 |
+
padding: 10px;
|
149 |
+
border-radius: 10px;
|
150 |
+
display: block;
|
151 |
+
font-family: 'Open Sans', sans-serif;
|
152 |
+
font-size: 14px;
|
153 |
+
display: none;
|
154 |
+
position: relative;
|
155 |
+
top: 15px;
|
156 |
+
left: -12px;
|
157 |
+
}
|
158 |
+
.tooltip:before {
|
159 |
+
border-left: 10px solid transparent;
|
160 |
+
border-right: 10px solid transparent;
|
161 |
+
border-bottom: 10px solid rgba( 0,0,0,0.8 );
|
162 |
+
border-top: 10px solid transparent;
|
163 |
+
content: " ";
|
164 |
+
position: absolute;
|
165 |
+
top: -20px;
|
166 |
+
|
167 |
+
}
|
168 |
+
.tooltip a {
|
169 |
+
color: #f1f1f1;
|
170 |
+
text-decoration: none;
|
171 |
+
}
|
172 |
+
.tooltip a:hover {
|
173 |
+
text-decoration: underline;
|
174 |
+
}
|
175 |
+
*:hover > .tooltip {
|
176 |
+
display: block;
|
177 |
+
}
|
178 |
+
</style>
|
179 |
+
<!-- <div class="dashicons dashicons-info"><span class="tooltip"><a href="http://www.jeroensormani.nl">Read more why this function is in here</a></span></div> -->
|
180 |
+
<?php
|
181 |
+
|
182 |
+
}
|
183 |
+
|
184 |
+
|
185 |
+
public function wppp_section_callback() {
|
186 |
+
|
187 |
+
echo __( 'Configure the WooCommerce Product Per Page settings here.', 'wppp' );
|
188 |
+
|
189 |
+
}
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
?>
|
assets/css/style.css
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
.products-per-page {
|
2 |
float: right;
|
3 |
-
}
|
1 |
.products-per-page {
|
2 |
float: right;
|
3 |
+
}
|
languages/wppp-nl_NL.mo
CHANGED
Binary file
|
languages/wppp-nl_NL.po
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WooCommerce Products Per Page 1.0.1\n"
|
4 |
-
"POT-Creation-Date: 2014-03-
|
5 |
"PO-Revision-Date: \n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n"
|
@@ -16,59 +16,71 @@ msgstr ""
|
|
16 |
"X-Poedit-SearchPath-0: /Users/Jeroen/plugins/woocommerce-products-per-page/"
|
17 |
"trunk\n"
|
18 |
|
19 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
20 |
-
#, php-format
|
21 |
-
msgid "%s products per page"
|
22 |
-
msgstr "%s producten per pagina"
|
23 |
-
|
24 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:36
|
25 |
-
msgid "All"
|
26 |
-
msgstr "Alle"
|
27 |
-
|
28 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/views/options-page.php:43
|
29 |
msgid "Dropdown location"
|
30 |
msgstr "Dropdown locatie"
|
31 |
|
32 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
33 |
msgid "List of dropdown options"
|
34 |
msgstr "Lijst van dropdown opties"
|
35 |
|
36 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
37 |
msgid "Default products per page"
|
38 |
msgstr "Standaard aantal producten per pagina"
|
39 |
|
40 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
41 |
msgid "Shop columns"
|
42 |
msgstr "Webshop kolommen"
|
43 |
|
44 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
|
|
|
|
|
|
|
|
45 |
msgid "WooCommerce Products Per Page"
|
46 |
msgstr "WooCommerce Products Per Page"
|
47 |
|
48 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
49 |
msgid "Top"
|
50 |
msgstr "Boven"
|
51 |
|
52 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
53 |
msgid "Bottom"
|
54 |
msgstr "Onder"
|
55 |
|
56 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
57 |
msgid "Top/Bottom"
|
58 |
msgstr "Boven/Onder"
|
59 |
|
60 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
61 |
msgid "None"
|
62 |
msgstr "Geen"
|
63 |
|
64 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
65 |
msgid "Seperated by spaces <em>(-1 for all products)</em>"
|
66 |
msgstr "Gescheiden door spaties <em>(-1 voor alle producten)</em>"
|
67 |
|
68 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
69 |
msgid "-1 for all products"
|
70 |
msgstr "-1 voor alle producten"
|
71 |
|
72 |
-
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
msgid "Configure the WooCommerce Product Per Page settings here."
|
74 |
msgstr "Configureer WooCommerce Products Per Page instellingen hier."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WooCommerce Products Per Page 1.0.1\n"
|
4 |
+
"POT-Creation-Date: 2014-03-15 14:13+0100\n"
|
5 |
"PO-Revision-Date: \n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n"
|
16 |
"X-Poedit-SearchPath-0: /Users/Jeroen/plugins/woocommerce-products-per-page/"
|
17 |
"trunk\n"
|
18 |
|
19 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:27
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
msgid "Dropdown location"
|
21 |
msgstr "Dropdown locatie"
|
22 |
|
23 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:35
|
24 |
msgid "List of dropdown options"
|
25 |
msgstr "Lijst van dropdown opties"
|
26 |
|
27 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:43
|
28 |
msgid "Default products per page"
|
29 |
msgstr "Standaard aantal producten per pagina"
|
30 |
|
31 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:51
|
32 |
msgid "Shop columns"
|
33 |
msgstr "Webshop kolommen"
|
34 |
|
35 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:59
|
36 |
+
msgid "First category page"
|
37 |
+
msgstr "Eerste categorie pagina"
|
38 |
+
|
39 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:73
|
40 |
msgid "WooCommerce Products Per Page"
|
41 |
msgstr "WooCommerce Products Per Page"
|
42 |
|
43 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:92
|
44 |
msgid "Top"
|
45 |
msgstr "Boven"
|
46 |
|
47 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:93
|
48 |
msgid "Bottom"
|
49 |
msgstr "Onder"
|
50 |
|
51 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:94
|
52 |
msgid "Top/Bottom"
|
53 |
msgstr "Boven/Onder"
|
54 |
|
55 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:95
|
56 |
msgid "None"
|
57 |
msgstr "Geen"
|
58 |
|
59 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107
|
60 |
msgid "Seperated by spaces <em>(-1 for all products)</em>"
|
61 |
msgstr "Gescheiden door spaties <em>(-1 voor alle producten)</em>"
|
62 |
|
63 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118
|
64 |
msgid "-1 for all products"
|
65 |
msgstr "-1 voor alle producten"
|
66 |
|
67 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:140
|
68 |
+
msgid ""
|
69 |
+
"When checked and a new number of PPP is selected, the visitor will be send "
|
70 |
+
"to the first page of the product category"
|
71 |
+
msgstr ""
|
72 |
+
"Wanneer aangevinkt en er een nieuw nummer PPP gekozen wordt, zal de bezoeker "
|
73 |
+
"naar de eerste pagina van de category gestuurd worden"
|
74 |
+
|
75 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:187
|
76 |
msgid "Configure the WooCommerce Product Per Page settings here."
|
77 |
msgstr "Configureer WooCommerce Products Per Page instellingen hier."
|
78 |
+
|
79 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:49
|
80 |
+
#, php-format
|
81 |
+
msgid "%s products per page"
|
82 |
+
msgstr "%s producten per pagina"
|
83 |
+
|
84 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:50
|
85 |
+
msgid "All"
|
86 |
+
msgstr "Alle"
|
objects/wppp-dropdown.php
CHANGED
@@ -10,8 +10,8 @@ class wppp_dropdown extends woocommerce_products_per_page {
|
|
10 |
|
11 |
$this->productsPerPage = $this->wppp_prep_ppp( $productPerPage );
|
12 |
|
13 |
-
if(
|
14 |
-
$this->productsPerPage = $this->wppp_prep_ppp( apply_filters(
|
15 |
|
16 |
$this->wppp_create_object();
|
17 |
|
@@ -19,28 +19,44 @@ class wppp_dropdown extends woocommerce_products_per_page {
|
|
19 |
|
20 |
|
21 |
public function wppp_create_object() {
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
?>
|
24 |
-
<form method="post" class="form-wppp-select products-per-page">
|
25 |
<?php
|
26 |
-
do_action(
|
27 |
?>
|
28 |
<select name="wppp_ppp" onchange="this.form.submit()" class="select wppp-select">
|
29 |
|
30 |
<?php
|
31 |
global $woocommerce;
|
32 |
foreach( $this->productsPerPage as $key => $value ) :
|
33 |
-
|
|
|
34 |
?>
|
35 |
<option value="<?php echo $value; ?>" <?php selected( $value, $selectedMatch ); ?>>
|
36 |
-
<?php
|
|
|
|
|
|
|
37 |
</option>
|
38 |
<?php
|
|
|
39 |
endforeach;
|
40 |
?>
|
41 |
</select>
|
42 |
<?php
|
43 |
-
do_action(
|
44 |
?>
|
45 |
</form>
|
46 |
<?php
|
@@ -50,7 +66,7 @@ class wppp_dropdown extends woocommerce_products_per_page {
|
|
50 |
|
51 |
public function wppp_prep_ppp( $productPerPage ) {
|
52 |
|
53 |
-
return explode(
|
54 |
|
55 |
}
|
56 |
|
10 |
|
11 |
$this->productsPerPage = $this->wppp_prep_ppp( $productPerPage );
|
12 |
|
13 |
+
if ( false == $productPerPage )
|
14 |
+
$this->productsPerPage = $this->wppp_prep_ppp( apply_filters( 'wppp_products_per_page', $this->options['productsPerPage'] ) );
|
15 |
|
16 |
$this->wppp_create_object();
|
17 |
|
19 |
|
20 |
|
21 |
public function wppp_create_object() {
|
22 |
+
|
23 |
+
global $wp_query;
|
24 |
+
|
25 |
+
$cat = $wp_query->get_queried_object();
|
26 |
+
|
27 |
+
// Set action url if option behaviour is true
|
28 |
+
if ( true == $cat->term_id && true == $this->options['behaviour'] ) :
|
29 |
+
$action = ' action="' . get_term_link( $cat->term_id, 'product_cat' ) . '"';
|
30 |
+
elseif ( true == $this->options['behaviour'] ) :
|
31 |
+
$action = 'action="' . get_permalink( woocommerce_get_page_id( 'shop' ) ) . '"';
|
32 |
+
endif;
|
33 |
+
|
34 |
?>
|
35 |
+
<form method="post" <?php echo $action; ?> class="form-wppp-select products-per-page">
|
36 |
<?php
|
37 |
+
do_action( 'wppp_before_dropdown' );
|
38 |
?>
|
39 |
<select name="wppp_ppp" onchange="this.form.submit()" class="select wppp-select">
|
40 |
|
41 |
<?php
|
42 |
global $woocommerce;
|
43 |
foreach( $this->productsPerPage as $key => $value ) :
|
44 |
+
|
45 |
+
$selectedMatch = isset( $_POST['wppp_ppp'] ) ? $_POST['wppp_ppp'] : $woocommerce->session->get( 'products_per_page' );
|
46 |
?>
|
47 |
<option value="<?php echo $value; ?>" <?php selected( $value, $selectedMatch ); ?>>
|
48 |
+
<?php
|
49 |
+
$ppp_text = apply_filters( 'wppp_ppp_text', __( '%s products per page', 'wppp' ) );
|
50 |
+
printf( $ppp_text, $value == -1 ? __( 'All', 'wppp' ) : $value ); // Set to 'All' when value is -1
|
51 |
+
?>
|
52 |
</option>
|
53 |
<?php
|
54 |
+
|
55 |
endforeach;
|
56 |
?>
|
57 |
</select>
|
58 |
<?php
|
59 |
+
do_action( 'wppp_after_dropdown' );
|
60 |
?>
|
61 |
</form>
|
62 |
<?php
|
66 |
|
67 |
public function wppp_prep_ppp( $productPerPage ) {
|
68 |
|
69 |
+
return explode( ' ', $productPerPage );
|
70 |
|
71 |
}
|
72 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: sormano
|
|
3 |
Tags: Products per page, woocommerce, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.8.1
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -13,6 +13,7 @@ WooCommerce Products Per Page is a easy-to-setup plugin that integrates a 'produ
|
|
13 |
WooCommerce Products Per Page dropdown is easy to install and has several other product page configurations. When activated the plugin already works and has multiple settings you can set to your desire.
|
14 |
|
15 |
Options like:
|
|
|
16 |
- Dropdown position (top or bottom, top and bottom)
|
17 |
- List op options products per page to show to your visitors
|
18 |
- Default number of products per page
|
@@ -20,6 +21,10 @@ Options like:
|
|
20 |
|
21 |
**Look at the screenshots!**
|
22 |
|
|
|
|
|
|
|
|
|
23 |
|
24 |
== Installation ==
|
25 |
|
@@ -36,6 +41,19 @@ Options like:
|
|
36 |
|
37 |
== Changelog ==
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
= 1.0.2 =
|
40 |
* - Added Dutch translation*
|
41 |
* - Added 'None' to the dropdown locations*
|
3 |
Tags: Products per page, woocommerce, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 3.8.1
|
6 |
+
Stable tag: 1.0.5
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
13 |
WooCommerce Products Per Page dropdown is easy to install and has several other product page configurations. When activated the plugin already works and has multiple settings you can set to your desire.
|
14 |
|
15 |
Options like:
|
16 |
+
|
17 |
- Dropdown position (top or bottom, top and bottom)
|
18 |
- List op options products per page to show to your visitors
|
19 |
- Default number of products per page
|
21 |
|
22 |
**Look at the screenshots!**
|
23 |
|
24 |
+
### Translations ###
|
25 |
+
- Dutch
|
26 |
+
- French [whoaloic](http://profiles.wordpress.org/whoaloic)
|
27 |
+
|
28 |
|
29 |
== Installation ==
|
30 |
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 1.0.5 =
|
45 |
+
* - Added French translation (thanks to [whoaloic](http://profiles.wordpress.org/whoaloic))
|
46 |
+
* - Fixed WooCommerce 2.0.X compatibily
|
47 |
+
* - Now is capable for WooCommerce 2.0.X and 2.1.X
|
48 |
+
|
49 |
+
= 1.0.4 =
|
50 |
+
* - Added option to control behaviour of select*
|
51 |
+
* - Added filter on option text*
|
52 |
+
* - Improved coding to Wordpress coding standards
|
53 |
+
|
54 |
+
= 1.0.3 =
|
55 |
+
* - Fixed dutch translation*
|
56 |
+
|
57 |
= 1.0.2 =
|
58 |
* - Added Dutch translation*
|
59 |
* - Added 'None' to the dropdown locations*
|
views/options-page.php
DELETED
@@ -1,154 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class wppp_options extends woocommerce_products_per_page {
|
4 |
-
|
5 |
-
|
6 |
-
public function __construct() {
|
7 |
-
|
8 |
-
parent::__construct();
|
9 |
-
|
10 |
-
$this->wppp_settings_init();
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
public function wppp_register_setting() {
|
15 |
-
|
16 |
-
// 1. register_setting :: Done in parent
|
17 |
-
/* register_setting( "wppp_settings", "wppp_settings" ); */
|
18 |
-
|
19 |
-
}
|
20 |
-
|
21 |
-
public function wppp_settings_init() {
|
22 |
-
|
23 |
-
// 2. check if settings exist, false -> add_option :: Done in parent
|
24 |
-
/*
|
25 |
-
if( !get_option( "wppp_settings" ) ) :
|
26 |
-
$defaults = $this->wppp_settings_defaults();
|
27 |
-
add_option( "wppp_settings", $defaults );
|
28 |
-
endif;
|
29 |
-
*/
|
30 |
-
|
31 |
-
|
32 |
-
// 3. Add settings section
|
33 |
-
add_settings_section(
|
34 |
-
"wppp_settings", // ID of section
|
35 |
-
"WooCommerce Products Per Page", // Page title
|
36 |
-
array( $this, "wppp_section_callback" ), // Callback for page description
|
37 |
-
"wppp_settings" // Page to display settings
|
38 |
-
);
|
39 |
-
|
40 |
-
// 4. Add settings field
|
41 |
-
add_settings_field(
|
42 |
-
"wppp_location", // ID of setting
|
43 |
-
__( "Dropdown location", "wppp" ), // Settings label
|
44 |
-
array( $this, "wppp_settings_field_location" ), // Function to render dropdown
|
45 |
-
"wppp_settings", // ID of the settings page
|
46 |
-
"wppp_settings" // ID of the settings section
|
47 |
-
);
|
48 |
-
|
49 |
-
add_settings_field(
|
50 |
-
"wppp_products_per_page_list",
|
51 |
-
__( "List of dropdown options", "wppp" ),
|
52 |
-
array( $this, "wppp_settings_field_ppp_list" ),
|
53 |
-
"wppp_settings",
|
54 |
-
"wppp_settings"
|
55 |
-
);
|
56 |
-
|
57 |
-
add_settings_field(
|
58 |
-
"wppp_default_ppp",
|
59 |
-
__( "Default products per page", "wppp" ),
|
60 |
-
array( $this, "wppp_settings_field_default_ppp" ),
|
61 |
-
"wppp_settings",
|
62 |
-
"wppp_settings"
|
63 |
-
);
|
64 |
-
|
65 |
-
add_settings_field(
|
66 |
-
"wppp_shop_columns",
|
67 |
-
__( "Shop columns", "wppp" ),
|
68 |
-
array( $this, "wppp_settings_field_shop_columns" ),
|
69 |
-
"wppp_settings",
|
70 |
-
"wppp_settings"
|
71 |
-
);
|
72 |
-
|
73 |
-
// 5. Render options page
|
74 |
-
$this->wppp_render_settings_page();
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
public function wppp_render_settings_page() {
|
80 |
-
|
81 |
-
?>
|
82 |
-
<div class="wrap">
|
83 |
-
|
84 |
-
<h2><?php _e( "WooCommerce Products Per Page", "wppp" ); ?></h2>
|
85 |
-
|
86 |
-
<form method="POST" action="options.php">
|
87 |
-
<?php
|
88 |
-
settings_fields( "wppp_settings" );
|
89 |
-
do_settings_sections( "wppp_settings" );
|
90 |
-
submit_button();
|
91 |
-
?>
|
92 |
-
</form>
|
93 |
-
|
94 |
-
</div>
|
95 |
-
<?php
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
public function wppp_settings_field_location() {
|
100 |
-
|
101 |
-
?>
|
102 |
-
<select name="wppp_settings[location]" class="">
|
103 |
-
<option value="top" <?php selected( $this->options["location"], "top" ); ?>><?php _e( "Top", "wppp" ); ?></option>
|
104 |
-
<option value="bottom" <?php selected( $this->options["location"], "bottom" ); ?>><?php _e( "Bottom", "wppp" ); ?></option>
|
105 |
-
<option value="topbottom" <?php selected( $this->options["location"], "topbottom" ); ?>><?php _e( "Top/Bottom", "wppp" ); ?></option>
|
106 |
-
<option value="none" <?php selected( $this->options["location"], "none" ); ?>><?php _e( "None", "wppp" ); ?></option>
|
107 |
-
</select>
|
108 |
-
<?php
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
|
113 |
-
public function wppp_settings_field_ppp_list() {
|
114 |
-
|
115 |
-
?>
|
116 |
-
<label for="productsPerPage">
|
117 |
-
<input type="text" id="productsPerPage" name="wppp_settings[productsPerPage]" value="<?php echo $this->options["productsPerPage"]; ?>">
|
118 |
-
<?php _e( "Seperated by spaces <em>(-1 for all products)</em>", "wppp" ); ?></label>
|
119 |
-
<?php
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
|
124 |
-
public function wppp_settings_field_default_ppp() {
|
125 |
-
|
126 |
-
?>
|
127 |
-
<label for="default_ppp">
|
128 |
-
<input type="number" id="default_ppp" name="wppp_settings[default_ppp]" value="<?php echo $this->options["default_ppp"]; ?>">
|
129 |
-
<em><?php _e( "-1 for all products", "wppp" ); ?></em></label>
|
130 |
-
<?php
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
|
135 |
-
public function wppp_settings_field_shop_columns() {
|
136 |
-
|
137 |
-
?>
|
138 |
-
<label for="shop_columns">
|
139 |
-
<input type="number" id="shop_columns" name="wppp_settings[shop_columns]" value="<?php echo $this->options["shop_columns"]; ?>">
|
140 |
-
</label>
|
141 |
-
<?php
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
|
146 |
-
public function wppp_section_callback() {
|
147 |
-
|
148 |
-
echo __( "Configure the WooCommerce Product Per Page settings here.", "wppp" );
|
149 |
-
|
150 |
-
}
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
woocommerce-products-per-page.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
Plugin Name: Woocommerce Products Per Page
|
4 |
Plugin URI: http://www.jeroensormani.nl/
|
5 |
Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
|
6 |
-
Version: 1.0.
|
7 |
Author: Jeroen Sormani
|
8 |
Author URI: http://www.jeroensormani.nl
|
9 |
|
10 |
* Copyright Jeroen Sormani
|
11 |
-
*
|
12 |
* This file is part of Woocomerce Products Per Page,
|
13 |
* a plugin for WordPress.
|
14 |
*
|
@@ -28,169 +28,200 @@ Author URI: http://www.jeroensormani.nl
|
|
28 |
*/
|
29 |
|
30 |
class woocommerce_products_per_page {
|
31 |
-
|
32 |
public $options;
|
33 |
-
|
34 |
/* __construct()
|
35 |
-
*
|
36 |
-
*
|
37 |
*/
|
38 |
public function __construct() {
|
39 |
-
|
40 |
$this->wppp_load_options();
|
41 |
-
|
42 |
// Add an options page
|
43 |
-
add_action(
|
44 |
-
|
45 |
// Check if ppp form is submit
|
46 |
-
add_action(
|
47 |
-
|
|
|
|
|
|
|
48 |
// Add filter to products per page displayed
|
49 |
-
add_filter(
|
|
|
50 |
// Add filter for product columns
|
51 |
-
add_filter(
|
|
|
52 |
// Enqueue some scripts
|
53 |
-
add_action(
|
|
|
54 |
// Load textdomain
|
55 |
-
load_plugin_textdomain(
|
56 |
-
|
57 |
}
|
58 |
-
|
59 |
/* wppp_hook_locations()
|
60 |
-
*
|
61 |
* Hook into the right look positions of WooCommerce
|
62 |
*/
|
63 |
public function wppp_hook_locations() {
|
64 |
-
|
65 |
-
if( $this->options[
|
66 |
-
add_action(
|
67 |
-
elseif( $this->options[
|
68 |
-
add_action(
|
69 |
-
elseif( $this->options[
|
70 |
-
add_action(
|
71 |
-
add_action(
|
72 |
endif;
|
73 |
|
74 |
}
|
75 |
-
|
76 |
-
|
77 |
/* wppp_submit_intercept()
|
78 |
-
*
|
79 |
-
*
|
80 |
-
*/
|
81 |
public function wppp_submit_intercept() {
|
82 |
-
|
83 |
global $woocommerce;
|
84 |
-
|
85 |
-
if ( isset( $_POST[
|
86 |
-
$woocommerce->session->set(
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
public function wppp_products_per_page_hook() {
|
94 |
-
|
95 |
global $woocommerce;
|
96 |
|
97 |
-
if( isset( $_POST[
|
98 |
-
return $_POST[
|
99 |
-
elseif( $woocommerce->session->__isset(
|
100 |
-
return $woocommerce->session->__get(
|
101 |
-
else
|
102 |
-
return $this->options[
|
|
|
|
|
|
|
103 |
|
104 |
-
}
|
105 |
-
|
106 |
public function wppp_shop_columns_hook( $columns ) {
|
107 |
|
108 |
-
$settings = get_option(
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
112 |
return $columns;
|
113 |
-
|
114 |
}
|
115 |
-
|
116 |
-
|
117 |
/* wppp_add_options_menu()
|
118 |
-
*
|
119 |
-
*
|
120 |
*/
|
121 |
public function wppp_add_options_menu() {
|
122 |
-
|
123 |
-
add_options_page(
|
124 |
-
|
125 |
-
// 1. register_setting
|
126 |
-
register_setting( "wppp_settings", "wppp_settings" );
|
127 |
}
|
128 |
-
|
129 |
public function wppp_enqueue_scripts() {
|
130 |
-
|
131 |
-
wp_enqueue_style(
|
132 |
-
|
133 |
}
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
/* wppp_options_page()
|
137 |
-
*
|
138 |
* Render options page
|
139 |
*/
|
140 |
public function wppp_options_page() {
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
145 |
}
|
146 |
-
|
147 |
-
|
148 |
/* wppp_dropdown_object()
|
149 |
-
*
|
150 |
* Render dropdown object
|
151 |
-
*/
|
152 |
public function wppp_dropdown_object() {
|
153 |
-
|
154 |
-
require_once plugin_dir_path( __FILE__ ) .
|
155 |
new wppp_dropdown();
|
156 |
-
|
157 |
}
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
160 |
public function wppp_load_options() {
|
161 |
-
|
162 |
-
if( !get_option(
|
163 |
-
|
164 |
-
add_option( "wppp_settings", $defaults );
|
165 |
endif;
|
166 |
-
|
167 |
-
$this->options = get_option(
|
168 |
-
|
169 |
}
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
172 |
public function wppp_settings_defaults() {
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
( apply_filters( 'loop_shop_columns', 4 ) *
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
|
|
|
|
|
|
184 |
) );
|
185 |
-
|
186 |
return $settings;
|
187 |
-
|
188 |
}
|
189 |
|
190 |
-
|
191 |
}
|
192 |
$wppp = new woocommerce_products_per_page();
|
193 |
|
|
|
194 |
$wppp->wppp_hook_locations();
|
195 |
|
196 |
?>
|
3 |
Plugin Name: Woocommerce Products Per Page
|
4 |
Plugin URI: http://www.jeroensormani.nl/
|
5 |
Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
|
6 |
+
Version: 1.0.5
|
7 |
Author: Jeroen Sormani
|
8 |
Author URI: http://www.jeroensormani.nl
|
9 |
|
10 |
* Copyright Jeroen Sormani
|
11 |
+
*
|
12 |
* This file is part of Woocomerce Products Per Page,
|
13 |
* a plugin for WordPress.
|
14 |
*
|
28 |
*/
|
29 |
|
30 |
class woocommerce_products_per_page {
|
31 |
+
|
32 |
public $options;
|
33 |
+
|
34 |
/* __construct()
|
35 |
+
*
|
36 |
+
*
|
37 |
*/
|
38 |
public function __construct() {
|
39 |
+
|
40 |
$this->wppp_load_options();
|
41 |
+
|
42 |
// Add an options page
|
43 |
+
add_action( 'admin_menu', array( $this, 'wppp_add_options_menu' ) );
|
44 |
+
|
45 |
// Check if ppp form is submit
|
46 |
+
add_action( 'init', array( $this, 'wppp_submit_intercept' ) );
|
47 |
+
|
48 |
+
// Initialise the settings page
|
49 |
+
add_action( "admin_init", array( $this, "wppp_init_settings" ) );
|
50 |
+
|
51 |
// Add filter to products per page displayed
|
52 |
+
add_filter( 'loop_shop_per_page', array( $this, 'wppp_products_per_page_hook' ), 90 );
|
53 |
+
|
54 |
// Add filter for product columns
|
55 |
+
add_filter( 'loop_shop_columns', array( $this, 'wppp_shop_columns_hook' ) );
|
56 |
+
|
57 |
// Enqueue some scripts
|
58 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'wppp_enqueue_scripts' ) );
|
59 |
+
|
60 |
// Load textdomain
|
61 |
+
load_plugin_textdomain( 'wppp', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
62 |
+
|
63 |
}
|
64 |
+
|
65 |
/* wppp_hook_locations()
|
66 |
+
*
|
67 |
* Hook into the right look positions of WooCommerce
|
68 |
*/
|
69 |
public function wppp_hook_locations() {
|
70 |
+
|
71 |
+
if ( $this->options['location'] == 'top' ) :
|
72 |
+
add_action( 'woocommerce_before_shop_loop', array( $this, 'wppp_dropdown_object' ) );
|
73 |
+
elseif ( $this->options['location'] == 'bottom' ) :
|
74 |
+
add_action( 'woocommerce_after_shop_loop', array( $this, 'wppp_dropdown_object' ) );
|
75 |
+
elseif ( $this->options['location'] == 'topbottom' ):
|
76 |
+
add_action( 'woocommerce_before_shop_loop', array( $this, 'wppp_dropdown_object' ) );
|
77 |
+
add_action( 'woocommerce_after_shop_loop', array( $this, 'wppp_dropdown_object' ) );
|
78 |
endif;
|
79 |
|
80 |
}
|
81 |
+
|
82 |
+
|
83 |
/* wppp_submit_intercept()
|
84 |
+
*
|
85 |
+
*
|
86 |
+
*/
|
87 |
public function wppp_submit_intercept() {
|
88 |
+
|
89 |
global $woocommerce;
|
90 |
+
|
91 |
+
if ( isset( $_POST['wppp_ppp'] ) ) :
|
92 |
+
$woocommerce->session->set( 'products_per_page', $_POST['wppp_ppp'] );
|
93 |
+
endif;
|
94 |
+
|
|
|
95 |
}
|
96 |
+
|
97 |
+
|
98 |
public function wppp_products_per_page_hook() {
|
99 |
+
|
100 |
global $woocommerce;
|
101 |
|
102 |
+
if ( isset( $_POST['wppp_ppp'] ) ) :
|
103 |
+
return $_POST['wppp_ppp'];
|
104 |
+
elseif ( $woocommerce->session->__isset( 'products_per_page' ) ) :
|
105 |
+
return $woocommerce->session->__get( 'products_per_page' );
|
106 |
+
else :
|
107 |
+
return $this->options['default_ppp'];
|
108 |
+
endif;
|
109 |
+
|
110 |
+
}
|
111 |
|
|
|
|
|
112 |
public function wppp_shop_columns_hook( $columns ) {
|
113 |
|
114 |
+
$settings = get_option( 'wppp_settings' );
|
115 |
+
|
116 |
+
if ( $settings && $settings['shop_columns'] > 0 ) :
|
117 |
+
$columns = $settings['shop_columns'];
|
118 |
+
endif;
|
119 |
+
|
120 |
return $columns;
|
121 |
+
|
122 |
}
|
123 |
+
|
124 |
+
|
125 |
/* wppp_add_options_menu()
|
126 |
+
*
|
127 |
+
*
|
128 |
*/
|
129 |
public function wppp_add_options_menu() {
|
130 |
+
|
131 |
+
add_options_page( 'WooCommerce Products Per Page', 'Products Per Page', 'manage_options', 'wppp_settings', array( $this, 'wppp_options_page' ) );
|
132 |
+
|
|
|
|
|
133 |
}
|
134 |
+
|
135 |
public function wppp_enqueue_scripts() {
|
136 |
+
|
137 |
+
wp_enqueue_style( 'products-per-page', plugins_url( '/assets/css/style.css', __FILE__ ) );
|
138 |
+
|
139 |
}
|
140 |
+
|
141 |
+
/* wppp_init_settings()
|
142 |
+
*
|
143 |
+
* Initialize the settings
|
144 |
+
*/
|
145 |
+
public function wppp_init_settings() {
|
146 |
+
|
147 |
+
global $wppp_options;
|
148 |
+
|
149 |
+
require_once plugin_dir_path( __FILE__ ) . 'admin/options-page.php';
|
150 |
+
$wppp_options = new wppp_options();
|
151 |
+
$wppp_options->wppp_settings_init();
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
/* wppp_options_page()
|
156 |
+
*
|
157 |
* Render options page
|
158 |
*/
|
159 |
public function wppp_options_page() {
|
160 |
+
|
161 |
+
global $wppp_options;
|
162 |
+
|
163 |
+
$wppp_options->wppp_render_settings_page();
|
164 |
+
|
165 |
}
|
166 |
+
|
167 |
+
|
168 |
/* wppp_dropdown_object()
|
169 |
+
*
|
170 |
* Render dropdown object
|
171 |
+
*/
|
172 |
public function wppp_dropdown_object() {
|
173 |
+
|
174 |
+
require_once plugin_dir_path( __FILE__ ) . 'objects/wppp-dropdown.php';
|
175 |
new wppp_dropdown();
|
176 |
+
|
177 |
}
|
178 |
+
|
179 |
+
|
180 |
+
/* wppp_load_options()
|
181 |
+
*
|
182 |
+
* Load the configured settings
|
183 |
+
*/
|
184 |
public function wppp_load_options() {
|
185 |
+
|
186 |
+
if ( !get_option( 'wppp_settings' ) ) :
|
187 |
+
add_option( 'wppp_settings', $this->wppp_settings_defaults() );
|
|
|
188 |
endif;
|
189 |
+
|
190 |
+
$this->options = get_option( 'wppp_settings' );
|
191 |
+
|
192 |
}
|
193 |
+
|
194 |
+
|
195 |
+
/* wppp_settings_defaults()
|
196 |
+
*
|
197 |
+
* Set default settings when settings are not set yet.
|
198 |
+
*/
|
199 |
public function wppp_settings_defaults() {
|
200 |
+
|
201 |
+
// Set default options to (3x|6x|9x)current Products Per Page
|
202 |
+
$ppp_default =
|
203 |
+
( apply_filters( 'loop_shop_columns', 4 ) * 3) . ' ' .
|
204 |
+
( apply_filters( 'loop_shop_columns', 4 ) * 6) . ' ' .
|
205 |
+
( apply_filters( 'loop_shop_columns', 4 ) * 9) . ' ' .
|
206 |
+
'-1';
|
207 |
+
|
208 |
+
// Set default settings
|
209 |
+
$settings = apply_filters( 'wppp_settings_defaults', array(
|
210 |
+
'location' => 'topbottom',
|
211 |
+
'productsPerPage' => $ppp_default,
|
212 |
+
'default_ppp' => apply_filters( 'loop_shop_per_page', get_option( 'posts_per_page' ) ),
|
213 |
+
'shop_columns' => apply_filters( 'loop_shop_columns', 4 ),
|
214 |
) );
|
215 |
+
|
216 |
return $settings;
|
217 |
+
|
218 |
}
|
219 |
|
220 |
+
|
221 |
}
|
222 |
$wppp = new woocommerce_products_per_page();
|
223 |
|
224 |
+
// Call function to load dropdown objects
|
225 |
$wppp->wppp_hook_locations();
|
226 |
|
227 |
?>
|