Version Description
12/06/2015 =
Improvement - Structural changes to the plugin
NOTE - Due to the structural changes please check compatibility IF you have implemented a custom code
Improvement - Move the settings page to WooCommerce -> Settings -> Products -> Display
Add - Brazilian translation
Download this release
Release Info
Developer | sormano |
Plugin | WooCommerce Products Per Page |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.7 to 1.2.0
- includes/admin/class-wppp-admin-settings.php +144 -0
- includes/class-wppp-dropdown.php +6 -103
- includes/class-wppp-front-end.php +214 -0
- includes/class-wppp-settings.php +0 -293
- languages/woocommerce-products-per-page-pt_BR.mo +0 -0
- languages/woocommerce-products-per-page-pt_BR.po +88 -0
- readme.txt +11 -3
- screenshot-3.png +0 -0
- woocommerce-products-per-page.php +85 -128
includes/admin/class-wppp-admin-settings.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?PHP
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class WPPP_Admin_Settings.
|
6 |
+
*
|
7 |
+
* WooCommerce Products Per Page Admin settings class.
|
8 |
+
*
|
9 |
+
* @class WPPP_Admin_Settings
|
10 |
+
* @version 1.2.0
|
11 |
+
* @author Jeroen Sormani
|
12 |
+
*/
|
13 |
+
class WPPP_Admin_Settings {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Constructor.
|
18 |
+
*
|
19 |
+
* @since 1.2.0
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
|
23 |
+
// Add settings to the settings array
|
24 |
+
add_filter( 'woocommerce_product_settings', array( $this, 'add_settings' ) );
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Add settings.
|
31 |
+
*
|
32 |
+
* Add setting to the 'WoooCommerce' -> 'Settings' -> 'Products' -> 'Display'
|
33 |
+
* section.
|
34 |
+
*
|
35 |
+
* @since 1.2.0
|
36 |
+
*
|
37 |
+
* @param array $settings List of existing display settings.
|
38 |
+
* @return array List of modified display settings.
|
39 |
+
*/
|
40 |
+
public function add_settings( $settings ) {
|
41 |
+
|
42 |
+
// Set default options to (3|6|9|All) rows
|
43 |
+
$dropdown_options_default =
|
44 |
+
( apply_filters( 'loop_shop_columns', 4 ) * 3 ) . ' ' .
|
45 |
+
( apply_filters( 'loop_shop_columns', 4 ) * 6 ) . ' ' .
|
46 |
+
( apply_filters( 'loop_shop_columns', 4 ) * 9 ) . ' ' .
|
47 |
+
'-1';
|
48 |
+
|
49 |
+
$new_settings = array(
|
50 |
+
|
51 |
+
array(
|
52 |
+
'type' => 'sectionend',
|
53 |
+
'id' => 'wppp_start'
|
54 |
+
),
|
55 |
+
|
56 |
+
array(
|
57 |
+
'title' => 'WooCommerce Products Per Page',
|
58 |
+
'type' => 'title',
|
59 |
+
'desc' => '',
|
60 |
+
'id' => 'wppp_title'
|
61 |
+
),
|
62 |
+
|
63 |
+
array(
|
64 |
+
'title' => __( 'Drop-down location', 'woocommerce-products-per-page' ),
|
65 |
+
'desc' => __( '', 'woocommerce-products-per-page' ),
|
66 |
+
'id' => 'wppp_dropdown_location',
|
67 |
+
'class' => 'wc-enhanced-select',
|
68 |
+
'css' => 'min-width:300px;',
|
69 |
+
'default' => 'topbottom',
|
70 |
+
'type' => 'select',
|
71 |
+
'options' => array(
|
72 |
+
'top' => __( 'Top', 'woocommerce-products-per-page' ),
|
73 |
+
'bottom' => __( 'Bottom', 'woocommerce-products-per-page' ),
|
74 |
+
'topbottom' => __( 'Top/Bottom', 'woocommerce-products-per-page' ),
|
75 |
+
'none' => __( 'None', 'woocommerce-products-per-page' ),
|
76 |
+
),
|
77 |
+
'desc_tip' => true,
|
78 |
+
),
|
79 |
+
|
80 |
+
array(
|
81 |
+
'title' => __( 'List of dropdown options', 'woocommerce-products-per-page' ),
|
82 |
+
'desc' => __( 'Seperated by spaces <em>(-1 for all products)</em>', 'woocommerce-products-per-page' ),
|
83 |
+
'id' => 'wppp_dropdown_options',
|
84 |
+
'default' => $dropdown_options_default,
|
85 |
+
'type' => 'text',
|
86 |
+
),
|
87 |
+
|
88 |
+
array(
|
89 |
+
'title' => __( 'Default products per page', 'woocommerce-products-per-page' ),
|
90 |
+
'desc' => __( '-1 for all products', 'woocommerce-products-per-page' ),
|
91 |
+
'id' => 'wppp_default_ppp',
|
92 |
+
'default' => apply_filters( 'loop_shop_per_page', get_option( 'posts_per_page' ) ),
|
93 |
+
'css' => 'width:50px;',
|
94 |
+
'type' => 'number',
|
95 |
+
),
|
96 |
+
|
97 |
+
array(
|
98 |
+
'title' => __( 'Shop columns', 'woocommerce-products-per-page' ),
|
99 |
+
'desc' => __( '', 'woocommerce-products-per-page' ),
|
100 |
+
'id' => 'wppp_shop_columns',
|
101 |
+
'default' => apply_filters( 'loop_shop_columns', 4 ),
|
102 |
+
'css' => 'width:50px;',
|
103 |
+
'custom_attributes' => array(
|
104 |
+
'min' => 0,
|
105 |
+
'step' => 1,
|
106 |
+
),
|
107 |
+
'type' => 'number',
|
108 |
+
),
|
109 |
+
|
110 |
+
array(
|
111 |
+
'title' => __( 'First category page', 'woocommerce-products-per-page' ),
|
112 |
+
'desc' => __( 'When checked and a new number of PPP is selected, the visitor will be send to the first page of the product category', 'woocommerce-products-per-page' ),
|
113 |
+
'id' => 'wppp_return_to_first',
|
114 |
+
'default' => 'no',
|
115 |
+
'type' => 'checkbox',
|
116 |
+
),
|
117 |
+
|
118 |
+
array(
|
119 |
+
'title' => __( 'HTTP method', 'woocommerce-products-per-page' ),
|
120 |
+
'desc' => __( 'GET sends the products per page via the url, POST does this on the background', 'woocommerce-products-per-page' ),
|
121 |
+
'id' => 'wppp_method',
|
122 |
+
'class' => 'wc-enhanced-select',
|
123 |
+
'default' => 'post',
|
124 |
+
'type' => 'select',
|
125 |
+
'options' => array(
|
126 |
+
'post' => __( 'POST', 'woocommerce-products-per-page' ),
|
127 |
+
'get' => __( 'GET', 'woocommerce-products-per-page' ),
|
128 |
+
),
|
129 |
+
'desc_tip' => true,
|
130 |
+
),
|
131 |
+
|
132 |
+
array(
|
133 |
+
'type' => 'sectionend',
|
134 |
+
'id' => 'wppp_options'
|
135 |
+
),
|
136 |
+
|
137 |
+
);
|
138 |
+
|
139 |
+
return array_merge( $settings, $new_settings );
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
}
|
includes/class-wppp-dropdown.php
CHANGED
@@ -13,30 +13,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
13 |
class WPPP_Dropdown {
|
14 |
|
15 |
|
16 |
-
/**
|
17 |
-
* Product per page option array.
|
18 |
-
*
|
19 |
-
* @since 1.0.0
|
20 |
-
* @access public
|
21 |
-
*
|
22 |
-
* @var array $product_per_page_options Array of options.
|
23 |
-
*/
|
24 |
-
public $products_per_page_options;
|
25 |
-
|
26 |
-
|
27 |
/**
|
28 |
* Construct.
|
29 |
*
|
30 |
* @since 1.0.0
|
31 |
*/
|
32 |
public function __construct() {
|
33 |
-
|
34 |
-
|
35 |
-
$this->settings = WooCommerce_Products_Per_page()->settings;
|
36 |
-
|
37 |
-
// Create the dropdown
|
38 |
-
$this->wppp_dropdown();
|
39 |
-
|
40 |
}
|
41 |
|
42 |
|
@@ -49,7 +33,8 @@ class WPPP_Dropdown {
|
|
49 |
* @deprecated 1.1.0 Use wppp_dropdown() instead (rename).
|
50 |
*/
|
51 |
public function wppp_create_object() {
|
52 |
-
$this->
|
|
|
53 |
}
|
54 |
|
55 |
|
@@ -63,91 +48,9 @@ class WPPP_Dropdown {
|
|
63 |
* @global object $wp_query.
|
64 |
*/
|
65 |
public function wppp_dropdown() {
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
$action = '';
|
70 |
-
$cat = '';
|
71 |
-
$cat = $wp_query->get_queried_object();
|
72 |
-
|
73 |
-
// Set the products per page options (e.g. 4, 8, 12)
|
74 |
-
$products_per_page_options = $this->wppp_prep_ppp( apply_filters( 'wppp_products_per_page', $this->settings['productsPerPage'] ) );
|
75 |
-
|
76 |
-
// Set action url if option behaviour is true
|
77 |
-
// Paste QUERY string after for filter and orderby support
|
78 |
-
$query_string = ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . add_query_arg( array( 'wppp_ppp' => false ), $_SERVER['QUERY_STRING'] ) : null;
|
79 |
-
|
80 |
-
if ( isset( $cat->term_id ) && isset( $cat->taxonomy ) && isset( $this->settings['behaviour'] ) && true == $this->settings['behaviour'] ) :
|
81 |
-
$action = get_term_link( $cat->term_id, $cat->taxonomy ) . $query_string;
|
82 |
-
elseif ( isset( $this->settings['behaviour'] ) && true == $this->settings['behaviour'] ) :
|
83 |
-
$action = get_permalink( woocommerce_get_page_id( 'shop' ) ) . $query_string;
|
84 |
-
endif;
|
85 |
-
|
86 |
-
$method = 'post'; // default
|
87 |
-
if ( isset( $this->settings['method'] ) && $this->settings['method'] == 'get' ) :
|
88 |
-
$method = 'get';
|
89 |
-
endif;
|
90 |
-
|
91 |
-
// Only show on product categories
|
92 |
-
if ( woocommerce_products_will_display() ) :
|
93 |
-
|
94 |
-
do_action( 'wppp_before_dropdown_form' );
|
95 |
-
|
96 |
-
?><form method="<?php echo esc_attr( $method ); ?>" action="<?php echo esc_url( $action ); ?>" style='float: right; margin-left: 5px;' class="form-wppp-select products-per-page"><?php
|
97 |
-
|
98 |
-
do_action( 'wppp_before_dropdown' );
|
99 |
-
|
100 |
-
?><select name="wppp_ppp" onchange="this.form.submit()" class="select wppp-select"><?php
|
101 |
-
|
102 |
-
foreach( $products_per_page_options as $key => $value ) :
|
103 |
-
|
104 |
-
// Get the right match for the selected option
|
105 |
-
$ppp_session = WC()->session->get( 'products_per_page' );
|
106 |
-
if ( isset( $_POST['wppp_ppp'] ) ) :
|
107 |
-
$selected_match = $_POST['wppp_ppp'];
|
108 |
-
elseif ( isset( $_GET['wppp_ppp'] ) ):
|
109 |
-
$selected_match = $_GET['wppp_ppp'];
|
110 |
-
elseif ( ! empty( $ppp_session ) ) :
|
111 |
-
$selected_match = $ppp_session;
|
112 |
-
else :
|
113 |
-
$selected_match = $this->settings['default_ppp'];
|
114 |
-
endif;
|
115 |
-
|
116 |
-
?><option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $selected_match ); ?>><?php
|
117 |
-
|
118 |
-
$ppp_text = apply_filters( 'wppp_ppp_text', __( '%s products per page', 'woocommerce-products-per-page' ), $value );
|
119 |
-
printf( $ppp_text, $value == -1 ? __( 'All', 'woocommerce-products-per-page' ) : $value ); // Set to 'All' when value is -1
|
120 |
-
|
121 |
-
?></option><?php
|
122 |
-
|
123 |
-
endforeach;
|
124 |
-
|
125 |
-
?></select><?php
|
126 |
-
|
127 |
-
do_action( 'wppp_after_dropdown' );
|
128 |
-
|
129 |
-
?></form><?php
|
130 |
-
|
131 |
-
do_action( 'wppp_after_dropdown_form' );
|
132 |
-
|
133 |
-
endif;
|
134 |
-
|
135 |
}
|
136 |
|
137 |
|
138 |
-
/**
|
139 |
-
* Prepare dropdown options.
|
140 |
-
*
|
141 |
-
* Prepare the options for the products per page dropdown.
|
142 |
-
*
|
143 |
-
* @since 1.0.0
|
144 |
-
*
|
145 |
-
* @return array of options.
|
146 |
-
*/
|
147 |
-
public function wppp_prep_ppp( $products_per_page ) {
|
148 |
-
|
149 |
-
return explode( ' ', $products_per_page );
|
150 |
-
|
151 |
-
}
|
152 |
-
|
153 |
}
|
13 |
class WPPP_Dropdown {
|
14 |
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Construct.
|
18 |
*
|
19 |
* @since 1.0.0
|
20 |
*/
|
21 |
public function __construct() {
|
22 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->products_per_page_dropdown()' );
|
23 |
+
return $this->front_end->products_per_page_dropdown();
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
|
33 |
* @deprecated 1.1.0 Use wppp_dropdown() instead (rename).
|
34 |
*/
|
35 |
public function wppp_create_object() {
|
36 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->products_per_page_dropdown()' );
|
37 |
+
return $this->front_end->products_per_page_dropdown();
|
38 |
}
|
39 |
|
40 |
|
48 |
* @global object $wp_query.
|
49 |
*/
|
50 |
public function wppp_dropdown() {
|
51 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->products_per_page_dropdown()' );
|
52 |
+
return $this->front_end->products_per_page_dropdown();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
includes/class-wppp-front-end.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?PHP
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class WPPP_Front_End.
|
6 |
+
*
|
7 |
+
* Handles all front end related business.
|
8 |
+
*
|
9 |
+
* @class WPPP_Front_End
|
10 |
+
* @version 1.2.0
|
11 |
+
* @author Jeroen Sormani
|
12 |
+
*/
|
13 |
+
class WPPP_Front_End {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Constructor.
|
18 |
+
*
|
19 |
+
* @since 1.2.0
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
|
23 |
+
// Set dropdowns
|
24 |
+
$location = get_option( 'wppp_dropdown_location', 'none' );
|
25 |
+
if ( $location == 'top' ) :
|
26 |
+
add_action( 'woocommerce_before_shop_loop', array( $this, 'products_per_page_dropdown' ), 25 );
|
27 |
+
elseif ( $location == 'bottom' ) :
|
28 |
+
add_action( 'woocommerce_after_shop_loop', array( $this, 'products_per_page_dropdown' ), 25 );
|
29 |
+
elseif ( $location == 'topbottom' ):
|
30 |
+
add_action( 'woocommerce_before_shop_loop', array( $this, 'products_per_page_dropdown' ), 25 );
|
31 |
+
add_action( 'woocommerce_after_shop_loop', array( $this, 'products_per_page_dropdown' ), 25 );
|
32 |
+
endif;
|
33 |
+
|
34 |
+
// Add filter for product columns
|
35 |
+
add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ) );
|
36 |
+
|
37 |
+
// Custom number of products per page
|
38 |
+
add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ) );
|
39 |
+
|
40 |
+
// Get the right amount of products from the DB
|
41 |
+
add_action( 'woocommerce_product_query', array( $this, 'woocommerce_product_query' ), 2, 50 );
|
42 |
+
|
43 |
+
// Set cookie so PPP will be saved
|
44 |
+
add_action( 'init', array( $this, 'set_customer_session' ), 10 );
|
45 |
+
|
46 |
+
// Check if ppp form is fired
|
47 |
+
add_action( 'init', array( $this, 'products_per_page_action' ) );
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Display drop down.
|
54 |
+
*
|
55 |
+
* Display the drop down front end to the user to choose
|
56 |
+
* the number of products per page.
|
57 |
+
*
|
58 |
+
* @since 1.2.0
|
59 |
+
*/
|
60 |
+
public function products_per_page_dropdown() {
|
61 |
+
|
62 |
+
global $wp_query;
|
63 |
+
|
64 |
+
$action = '';
|
65 |
+
$cat = '';
|
66 |
+
$cat = $wp_query->get_queried_object();
|
67 |
+
$method = in_array( get_option( 'wppp_method', 'post' ), array( 'post', 'get' ) ) ? get_option( 'wppp_method', 'post' ) : 'post';
|
68 |
+
|
69 |
+
// Set the products per page options (e.g. 4, 8, 12)
|
70 |
+
$products_per_page_options = explode( ' ', apply_filters( 'wppp_products_per_page', get_option( 'wppp_dropdown_options' ) ) );
|
71 |
+
|
72 |
+
// Set action url if option behaviour is true
|
73 |
+
// Paste QUERY string after for filter and orderby support
|
74 |
+
$query_string = ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . add_query_arg( array( 'wppp_ppp' => false ), $_SERVER['QUERY_STRING'] ) : null;
|
75 |
+
|
76 |
+
if ( isset( $cat->term_id ) && isset( $cat->taxonomy ) && 'yes' == get_option( 'wppp_return_to_first', 'no' ) ) :
|
77 |
+
$action = get_term_link( $cat->term_id, $cat->taxonomy ) . $query_string;
|
78 |
+
elseif ( 'yes' == get_option( 'wppp_return_to_first', 'no' ) ) :
|
79 |
+
$action = get_permalink( woocommerce_get_page_id( 'shop' ) ) . $query_string;
|
80 |
+
endif;
|
81 |
+
|
82 |
+
// Only show on product categories
|
83 |
+
if ( ! woocommerce_products_will_display() ) :
|
84 |
+
return;
|
85 |
+
endif;
|
86 |
+
|
87 |
+
do_action( 'wppp_before_dropdown_form' );
|
88 |
+
|
89 |
+
?><form method="<?php echo $method; ?>" action="<?php echo esc_url( $action ); ?>" style='float: right; margin-left: 5px;' class="form-wppp-select products-per-page"><?php
|
90 |
+
|
91 |
+
do_action( 'wppp_before_dropdown' );
|
92 |
+
|
93 |
+
?><select name="ppp" onchange="this.form.submit()" class="select wppp-select"><?php
|
94 |
+
|
95 |
+
foreach( $products_per_page_options as $key => $value ) :
|
96 |
+
|
97 |
+
?><option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->loop_shop_per_page() ); ?>><?php
|
98 |
+
$ppp_text = apply_filters( 'wppp_ppp_text', __( '%s products per page', 'woocommerce-products-per-page' ), $value );
|
99 |
+
esc_html( printf( $ppp_text, $value == -1 ? __( 'All', 'woocommerce-products-per-page' ) : $value ) ); // Set to 'All' when value is -1
|
100 |
+
?></option><?php
|
101 |
+
|
102 |
+
endforeach;
|
103 |
+
|
104 |
+
?></select><?php
|
105 |
+
|
106 |
+
do_action( 'wppp_after_dropdown' );
|
107 |
+
|
108 |
+
?></form><?php
|
109 |
+
|
110 |
+
do_action( 'wppp_after_dropdown_form' );
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Shop columns.
|
117 |
+
*
|
118 |
+
* Set number of columns (products per row).
|
119 |
+
*
|
120 |
+
* @since 1.2.0
|
121 |
+
*
|
122 |
+
* @return int Number of columns.
|
123 |
+
*/
|
124 |
+
public function loop_shop_columns( $columns ) {
|
125 |
+
|
126 |
+
if ( ( $shop_columns = get_option( 'wppp_shop_columns', 0 ) ) > 0 ) :
|
127 |
+
$columns = $shop_columns;
|
128 |
+
endif;
|
129 |
+
|
130 |
+
return $columns;
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Per page hook.
|
137 |
+
*
|
138 |
+
* Return the number of products per page to the hook
|
139 |
+
*
|
140 |
+
* @since 1.2.0
|
141 |
+
*
|
142 |
+
* @return int Products per page.
|
143 |
+
*/
|
144 |
+
public function loop_shop_per_page() {
|
145 |
+
|
146 |
+
if ( isset( $_REQUEST['wppp_ppp'] ) ) :
|
147 |
+
return intval( $_REQUEST['wppp_ppp'] );
|
148 |
+
elseif ( isset( $_REQUEST['ppp'] ) ) :
|
149 |
+
return intval( $_REQUEST['ppp'] );
|
150 |
+
elseif ( WC()->session->__isset( 'products_per_page' ) ) :
|
151 |
+
return intval( WC()->session->__get( 'products_per_page' ) );
|
152 |
+
else :
|
153 |
+
return intval( get_option( 'wppp_default_ppp', '12' ) );
|
154 |
+
endif;
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Posts per page.
|
161 |
+
*
|
162 |
+
* Set the number of posts per page on a hard way, build in fix for many themes who override the offical loop_shop_per_page filter.
|
163 |
+
*
|
164 |
+
* @since 1.2.0
|
165 |
+
*
|
166 |
+
* @param object $q Existing query object.
|
167 |
+
* @param object $class Class object.
|
168 |
+
* @return object Modified query object.
|
169 |
+
*/
|
170 |
+
public function woocommerce_product_query( $q, $class ) {
|
171 |
+
|
172 |
+
if ( function_exists( 'woocommerce_products_will_display' ) && woocommerce_products_will_display() && $q->is_main_query() ) :
|
173 |
+
$q->set( 'posts_per_page', $this->loop_shop_per_page() );
|
174 |
+
endif;
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Initilize session.
|
181 |
+
*
|
182 |
+
* Set an initial session for WC 2.1.X users. Cookies are set automatically prior 2.1.X.
|
183 |
+
*
|
184 |
+
* @since 1.2.0
|
185 |
+
*/
|
186 |
+
public function set_customer_session() {
|
187 |
+
|
188 |
+
if ( WC()->version > '2.1' && ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) ) :
|
189 |
+
WC()->session->set_customer_session_cookie( true );
|
190 |
+
endif;
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
/**
|
196 |
+
* PPP action.
|
197 |
+
*
|
198 |
+
* Set the number of products per page when the customer
|
199 |
+
* changes the amount in the drop down.
|
200 |
+
*
|
201 |
+
* @since 1.2.0
|
202 |
+
*/
|
203 |
+
public function products_per_page_action() {
|
204 |
+
|
205 |
+
if ( isset( $_REQUEST['wppp_ppp'] ) ) :
|
206 |
+
WC()->session->set( 'products_per_page', intval( $_REQUEST['wppp_ppp'] ) );
|
207 |
+
elseif ( isset( $_REQUEST['ppp'] ) ) :
|
208 |
+
WC()->session->set( 'products_per_page', intval( $_REQUEST['ppp'] ) );
|
209 |
+
endif;
|
210 |
+
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
}
|
includes/class-wppp-settings.php
DELETED
@@ -1,293 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Class WPPP_Settings
|
6 |
-
*
|
7 |
-
* Initialize settings page
|
8 |
-
*
|
9 |
-
* @class WPPP_Settings
|
10 |
-
* @version 1.1.0
|
11 |
-
* @author Jeroen Sormani
|
12 |
-
*/
|
13 |
-
|
14 |
-
class WPPP_Settings {
|
15 |
-
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Constructor.
|
19 |
-
*
|
20 |
-
* @since 1.0.0
|
21 |
-
*/
|
22 |
-
public function __construct() {
|
23 |
-
|
24 |
-
// Init settings
|
25 |
-
add_action( 'admin_init', array( $this, 'wppp_settings_init' ) );
|
26 |
-
|
27 |
-
}
|
28 |
-
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Register settings.
|
32 |
-
*
|
33 |
-
* Register setting, sections and settings fields.
|
34 |
-
*
|
35 |
-
* @since 1.0.0
|
36 |
-
*/
|
37 |
-
public function wppp_settings_init() {
|
38 |
-
|
39 |
-
// Get all the settings
|
40 |
-
WooCommerce_Products_Per_page()->settings = WooCommerce_Products_Per_page()->settings;
|
41 |
-
|
42 |
-
|
43 |
-
register_setting( 'wppp_settings', 'wppp_settings' );
|
44 |
-
|
45 |
-
add_settings_section(
|
46 |
-
'wppp_settings',
|
47 |
-
'WooCommerce Products Per Page',
|
48 |
-
array( $this, 'wppp_section_callback' ),
|
49 |
-
'wppp_settings'
|
50 |
-
);
|
51 |
-
|
52 |
-
|
53 |
-
add_settings_field(
|
54 |
-
'wppp_location',
|
55 |
-
__( 'Dropdown location', 'woocommerce-products-per-page' ),
|
56 |
-
array( $this, 'wppp_settings_field_location' ),
|
57 |
-
'wppp_settings',
|
58 |
-
'wppp_settings'
|
59 |
-
);
|
60 |
-
|
61 |
-
add_settings_field(
|
62 |
-
'wppp_products_per_page_list',
|
63 |
-
__( 'List of dropdown options', 'woocommerce-products-per-page' ),
|
64 |
-
array( $this, 'wppp_settings_field_ppp_list' ),
|
65 |
-
'wppp_settings',
|
66 |
-
'wppp_settings'
|
67 |
-
);
|
68 |
-
|
69 |
-
add_settings_field(
|
70 |
-
'wppp_default_ppp',
|
71 |
-
__( 'Default products per page', 'woocommerce-products-per-page' ),
|
72 |
-
array( $this, 'wppp_settings_field_default_ppp' ),
|
73 |
-
'wppp_settings',
|
74 |
-
'wppp_settings'
|
75 |
-
);
|
76 |
-
|
77 |
-
add_settings_field(
|
78 |
-
'wppp_shop_columns',
|
79 |
-
__( 'Shop columns', 'woocommerce-products-per-page' ),
|
80 |
-
array( $this, 'wppp_settings_field_shop_columns' ),
|
81 |
-
'wppp_settings',
|
82 |
-
'wppp_settings'
|
83 |
-
);
|
84 |
-
|
85 |
-
add_settings_field(
|
86 |
-
'wppp_ppp_behaviour',
|
87 |
-
__( 'First category page', 'woocommerce-products-per-page' ),
|
88 |
-
array( $this, 'wppp_settings_field_behaviour' ),
|
89 |
-
'wppp_settings',
|
90 |
-
'wppp_settings'
|
91 |
-
);
|
92 |
-
|
93 |
-
add_settings_field(
|
94 |
-
'wppp_method',
|
95 |
-
__( 'HTTP method', 'woocommerce-products-per-page' ),
|
96 |
-
array( $this, 'wppp_settings_field_method' ),
|
97 |
-
'wppp_settings',
|
98 |
-
'wppp_settings'
|
99 |
-
);
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Settings page render.
|
106 |
-
*
|
107 |
-
* Load settings fields, sections and submit button.
|
108 |
-
*
|
109 |
-
* @since 1.0.0
|
110 |
-
*/
|
111 |
-
public function wppp_render_settings_page() {
|
112 |
-
|
113 |
-
?><div class="wrap">
|
114 |
-
|
115 |
-
<h2><?php _e( 'WooCommerce Products Per Page', 'woocommerce-products-per-page' ); ?></h2>
|
116 |
-
|
117 |
-
<form method="POST" action="options.php"><?php
|
118 |
-
|
119 |
-
settings_fields( 'wppp_settings' );
|
120 |
-
do_settings_sections( 'wppp_settings' );
|
121 |
-
submit_button();
|
122 |
-
|
123 |
-
?></form>
|
124 |
-
|
125 |
-
</div><?php
|
126 |
-
|
127 |
-
}
|
128 |
-
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Location setting.
|
132 |
-
*
|
133 |
-
* Settings dropdown to select the location of the dropdown.
|
134 |
-
*
|
135 |
-
* @since 1.0.0
|
136 |
-
*/
|
137 |
-
public function wppp_settings_field_location() {
|
138 |
-
|
139 |
-
?><select name="wppp_settings[location]" class="">
|
140 |
-
|
141 |
-
<option value="top" <?php selected( WooCommerce_Products_Per_page()->settings['location'], 'top' ); ?>><?php
|
142 |
-
_e( 'Top', 'woocommerce-products-per-page' );
|
143 |
-
?></option>
|
144 |
-
<option value="bottom" <?php selected( WooCommerce_Products_Per_page()->settings['location'], 'bottom' ); ?>><?php
|
145 |
-
_e( 'Bottom', 'woocommerce-products-per-page' );
|
146 |
-
?></option>
|
147 |
-
<option value="topbottom" <?php selected( WooCommerce_Products_Per_page()->settings['location'], 'topbottom' ); ?>><?php
|
148 |
-
_e( 'Top/Bottom', 'woocommerce-products-per-page' );
|
149 |
-
?></option>
|
150 |
-
<option value="none" <?php selected( WooCommerce_Products_Per_page()->settings['location'], 'none' ); ?>><?php
|
151 |
-
_e( 'None', 'woocommerce-products-per-page' );
|
152 |
-
?></option>
|
153 |
-
|
154 |
-
</select><?php
|
155 |
-
|
156 |
-
}
|
157 |
-
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Dropdown options input.
|
161 |
-
*
|
162 |
-
* Settings input to set the options for the dropdown. Seperate with space.
|
163 |
-
*
|
164 |
-
* @since 1.0.0
|
165 |
-
*/
|
166 |
-
public function wppp_settings_field_ppp_list() {
|
167 |
-
|
168 |
-
?><label for="products_per_page">
|
169 |
-
<input type="text" id="products_per_page" name="wppp_settings[productsPerPage]" value="<?php echo WooCommerce_Products_Per_page()->settings['productsPerPage']; ?>"><?php
|
170 |
-
_e( 'Seperated by spaces <em>(-1 for all products)</em>', 'woocommerce-products-per-page' ); ?></label><?php
|
171 |
-
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Default ppp input.
|
177 |
-
*
|
178 |
-
* Settings input to set the default products per page.
|
179 |
-
*
|
180 |
-
* @since 1.0.0
|
181 |
-
*/
|
182 |
-
public function wppp_settings_field_default_ppp() {
|
183 |
-
|
184 |
-
?><label for="default_ppp">
|
185 |
-
<input type="number" id="default_ppp" name="wppp_settings[default_ppp]" value="<?php echo WooCommerce_Products_Per_page()->settings['default_ppp']; ?>">
|
186 |
-
<em><?php _e( '-1 for all products', 'woocommerce-products-per-page' ); ?></em>
|
187 |
-
</label><?php
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Shop columns input.
|
194 |
-
*
|
195 |
-
* Settings input to set the shop columns per row.
|
196 |
-
*
|
197 |
-
* @since 1.0.0
|
198 |
-
*/
|
199 |
-
public function wppp_settings_field_shop_columns() {
|
200 |
-
|
201 |
-
?><label for="shop_columns">
|
202 |
-
<input type="number" id="shop_columns" name="wppp_settings[shop_columns]" value="<?php echo WooCommerce_Products_Per_page()->settings['shop_columns']; ?>">
|
203 |
-
</label><?php
|
204 |
-
|
205 |
-
}
|
206 |
-
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Behaviour checkbox.
|
210 |
-
*
|
211 |
-
* Rendering method for behaviour checkbox.
|
212 |
-
*
|
213 |
-
* @since 1.0.0
|
214 |
-
*/
|
215 |
-
public function wppp_settings_field_behaviour() {
|
216 |
-
|
217 |
-
?><label for="behaviour">
|
218 |
-
<input type="checkbox" id="behaviour" name="wppp_settings[behaviour]" value="1" <?php @checked( WooCommerce_Products_Per_page()->settings['behaviour'], 1 ); ?>>
|
219 |
-
<?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', 'woocommerce-products-per-page' ); ?>
|
220 |
-
</label>
|
221 |
-
<style>
|
222 |
-
.tooltip {
|
223 |
-
width: 200px;
|
224 |
-
height: auto;
|
225 |
-
background-color: rgba( 0,0,0,0.8 );
|
226 |
-
color: #f1f1f1;
|
227 |
-
padding: 10px;
|
228 |
-
border-radius: 10px;
|
229 |
-
display: block;
|
230 |
-
font-family: 'Open Sans', sans-serif;
|
231 |
-
font-size: 14px;
|
232 |
-
display: none;
|
233 |
-
position: relative;
|
234 |
-
top: 15px;
|
235 |
-
left: -12px;
|
236 |
-
}
|
237 |
-
.tooltip:before {
|
238 |
-
border-left: 10px solid transparent;
|
239 |
-
border-right: 10px solid transparent;
|
240 |
-
border-bottom: 10px solid rgba( 0,0,0,0.8 );
|
241 |
-
border-top: 10px solid transparent;
|
242 |
-
content: " ";
|
243 |
-
position: absolute;
|
244 |
-
top: -20px;
|
245 |
-
|
246 |
-
}
|
247 |
-
.tooltip a {
|
248 |
-
color: #f1f1f1;
|
249 |
-
text-decoration: none;
|
250 |
-
}
|
251 |
-
.tooltip a:hover {
|
252 |
-
text-decoration: underline;
|
253 |
-
}
|
254 |
-
*:hover > .tooltip {
|
255 |
-
display: block;
|
256 |
-
}
|
257 |
-
</style><?php
|
258 |
-
|
259 |
-
}
|
260 |
-
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Method checkbox.
|
264 |
-
*
|
265 |
-
* Rendering method for method checkbox.
|
266 |
-
*
|
267 |
-
* @since 1.0.0
|
268 |
-
*/
|
269 |
-
public function wppp_settings_field_method() {
|
270 |
-
|
271 |
-
?><label for="method">
|
272 |
-
<select name="wppp_settings[method]" class="">
|
273 |
-
<option value="post" <?php @selected( WooCommerce_Products_Per_page()->settings['method'], 'post' ); ?>> <?php _e( 'POST', 'woocommerce-products-per-page' ); ?></option>
|
274 |
-
<option value="get" <?php @selected( WooCommerce_Products_Per_page()->settings['method'], 'get' ); ?>> <?php _e( 'GET', 'woocommerce-products-per-page' ); ?></option>
|
275 |
-
</select>
|
276 |
-
<?php _e( 'GET sends the products per page via the url, POST does this on the background', 'woocommerce-products-per-page' ); ?>
|
277 |
-
</label><?php
|
278 |
-
|
279 |
-
}
|
280 |
-
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Settings page description.
|
284 |
-
*
|
285 |
-
* @since 1.0.0
|
286 |
-
*/
|
287 |
-
public function wppp_section_callback() {
|
288 |
-
|
289 |
-
echo __( 'Configure the WooCommerce Product Per Page settings here.', 'woocommerce-products-per-page' );
|
290 |
-
|
291 |
-
}
|
292 |
-
|
293 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/woocommerce-products-per-page-pt_BR.mo
ADDED
Binary file
|
languages/woocommerce-products-per-page-pt_BR.po
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: Michel Taumaturgo Rocha <mitarodigital@gmail.com>\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.8.1\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
+
"X-Poedit-Basepath: /Users/Jeroen/plugins/woocommerce-products-per-page/"
|
14 |
+
"trunk/\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"Language: pt_BR\n"
|
18 |
+
"X-Poedit-SearchPath-0: /Users/Jeroen/plugins/woocommerce-products-per-page/"
|
19 |
+
"trunk\n"
|
20 |
+
|
21 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:27
|
22 |
+
msgid "Dropdown location"
|
23 |
+
msgstr "Localização do menu"
|
24 |
+
|
25 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:35
|
26 |
+
msgid "List of dropdown options"
|
27 |
+
msgstr "Opções da lista"
|
28 |
+
|
29 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:43
|
30 |
+
msgid "Default products per page"
|
31 |
+
msgstr "Produtos por página (padrão)"
|
32 |
+
|
33 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:51
|
34 |
+
msgid "Shop columns"
|
35 |
+
msgstr "Colunas de vendas"
|
36 |
+
|
37 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:59
|
38 |
+
msgid "First category page"
|
39 |
+
msgstr "Primera página do categoria"
|
40 |
+
|
41 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:73
|
42 |
+
msgid "WooCommerce Products Per Page"
|
43 |
+
msgstr "Produtos por página do Woocommerce"
|
44 |
+
|
45 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:92
|
46 |
+
msgid "Top"
|
47 |
+
msgstr "Topo"
|
48 |
+
|
49 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:93
|
50 |
+
msgid "Bottom"
|
51 |
+
msgstr "Abaixo"
|
52 |
+
|
53 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:94
|
54 |
+
msgid "Top/Bottom"
|
55 |
+
msgstr "Topo/Abaixo"
|
56 |
+
|
57 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:95
|
58 |
+
msgid "None"
|
59 |
+
msgstr "Nenhum"
|
60 |
+
|
61 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107
|
62 |
+
msgid "Seperated by spaces <em>(-1 for all products)</em>"
|
63 |
+
msgstr "Separado por espaços <em>(-1 para todos os produtos)</em>"
|
64 |
+
|
65 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118
|
66 |
+
msgid "-1 for all products"
|
67 |
+
msgstr "-1 para todos os produtos"
|
68 |
+
|
69 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:140
|
70 |
+
msgid ""
|
71 |
+
"When checked and a new number of PPP is selected, the visitor will be send "
|
72 |
+
"to the first page of the product category"
|
73 |
+
msgstr ""
|
74 |
+
"Quando selecionado e modificado o número de produtos por página, enviará o "
|
75 |
+
"visitante a primeira página da categoria de produtos"
|
76 |
+
|
77 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:187
|
78 |
+
msgid "Configure the WooCommerce Product Per Page settings here."
|
79 |
+
msgstr "Configure os ajustes de Product Per Page para Woocommerce aqui."
|
80 |
+
|
81 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:49
|
82 |
+
#, php-format
|
83 |
+
msgid "%s products per page"
|
84 |
+
msgstr "%s produtos por página"
|
85 |
+
|
86 |
+
#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/objects/wppp-dropdown.php:50
|
87 |
+
msgid "All"
|
88 |
+
msgstr "Todos"
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: sormano
|
3 |
Donate link: http://www.jeroensormani.com/donate/
|
4 |
Tags: Products per page, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to: 4.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -29,6 +29,7 @@ Options like:
|
|
29 |
- Deutsch [(Michael)](http://profiles.wordpress.org/blogprofis/)
|
30 |
- Danish [(Keld)](https://profiles.wordpress.org/kelderkold/)
|
31 |
- Spanish
|
|
|
32 |
|
33 |
|
34 |
== Installation ==
|
@@ -46,6 +47,13 @@ Options like:
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
= 1.1.7 - 25/04/2015 =
|
50 |
|
51 |
* Improvement - Add url escaping
|
2 |
Contributors: sormano
|
3 |
Donate link: http://www.jeroensormani.com/donate/
|
4 |
Tags: Products per page, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
|
5 |
+
Requires at least: 3.7.0
|
6 |
+
Tested up to: 4.2.2
|
7 |
+
Stable tag: 1.2.0
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
29 |
- Deutsch [(Michael)](http://profiles.wordpress.org/blogprofis/)
|
30 |
- Danish [(Keld)](https://profiles.wordpress.org/kelderkold/)
|
31 |
- Spanish
|
32 |
+
- Brazilian
|
33 |
|
34 |
|
35 |
== Installation ==
|
47 |
|
48 |
== Changelog ==
|
49 |
|
50 |
+
= 1.2.0 - 12/06/2015 =
|
51 |
+
|
52 |
+
* Improvement - Structural changes to the plugin
|
53 |
+
* NOTE - Due to the structural changes please check compatibility IF you have implemented a custom code
|
54 |
+
* Improvement - Move the settings page to WooCommerce -> Settings -> Products -> Display
|
55 |
+
* Add - Brazilian translation
|
56 |
+
|
57 |
= 1.1.7 - 25/04/2015 =
|
58 |
|
59 |
* Improvement - Add url escaping
|
screenshot-3.png
CHANGED
Binary file
|
woocommerce-products-per-page.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Woocommerce Products Per Page
|
4 |
* Plugin URI: http://www.jeroensormani.com/
|
5 |
* Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
|
6 |
-
* Version: 1.
|
7 |
* Author: Jeroen Sormani
|
8 |
* Author URI: http://www.jeroensormani.com
|
9 |
|
@@ -40,15 +40,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
40 |
*/
|
41 |
class Woocommerce_Products_Per_Page {
|
42 |
|
|
|
43 |
/**
|
44 |
-
*
|
45 |
-
*
|
46 |
-
* @since 1.1.0
|
47 |
-
* @access public
|
48 |
*
|
49 |
-
* @
|
|
|
50 |
*/
|
51 |
-
public $
|
52 |
|
53 |
|
54 |
/**
|
@@ -83,34 +82,6 @@ class Woocommerce_Products_Per_Page {
|
|
83 |
}
|
84 |
|
85 |
|
86 |
-
/**
|
87 |
-
* Add all actions and filters.
|
88 |
-
*
|
89 |
-
* @since 1.0.0
|
90 |
-
*
|
91 |
-
* @return int number of columns.
|
92 |
-
*/
|
93 |
-
public function wppp_hooks() {
|
94 |
-
|
95 |
-
// Add admin settings page
|
96 |
-
add_action( 'admin_menu', array( $this, 'wppp_settings_page_menu' ) );
|
97 |
-
|
98 |
-
// Add filter for product columns
|
99 |
-
add_filter( 'loop_shop_columns', array( $this, 'wppp_loop_shop_columns' ) );
|
100 |
-
|
101 |
-
// Customer number of products per page
|
102 |
-
add_filter( 'loop_shop_per_page', array( $this, 'wppp_loop_shop_per_page' ) );
|
103 |
-
add_action( 'woocommerce_product_query', array( $this, 'wppp_pre_get_posts' ), 2, 50 );
|
104 |
-
|
105 |
-
// Set cookie so PPP will be saved
|
106 |
-
add_action( 'init', array( $this, 'wppp_set_customer_session' ), 10 );
|
107 |
-
|
108 |
-
// Check if ppp form is submit
|
109 |
-
add_action( 'init', array( $this, 'wppp_submit_check' ) );
|
110 |
-
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
/**
|
115 |
* Instance.
|
116 |
*
|
@@ -143,36 +114,88 @@ class Woocommerce_Products_Per_Page {
|
|
143 |
if ( is_admin() ) :
|
144 |
|
145 |
/**
|
146 |
-
* Settings
|
147 |
*/
|
148 |
-
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wppp-settings.php';
|
149 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
endif;
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
-
|
158 |
-
$this->wppp_hooks();
|
159 |
|
160 |
// Load textdomain
|
|
|
161 |
load_plugin_textdomain( 'woocommerce-products-per-page', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
162 |
|
163 |
}
|
164 |
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
/**
|
167 |
* Initialize admin settings page.
|
168 |
*
|
169 |
* @since 1.1.0
|
170 |
*/
|
171 |
public function wppp_settings_page_menu() {
|
172 |
-
|
173 |
-
$this->wppp_settings,
|
174 |
-
'wppp_render_settings_page'
|
175 |
-
) );
|
176 |
}
|
177 |
|
178 |
|
@@ -186,13 +209,7 @@ class Woocommerce_Products_Per_Page {
|
|
186 |
* @return int number of columns.
|
187 |
*/
|
188 |
public function wppp_init_settings() {
|
189 |
-
|
190 |
-
if ( ! get_option( 'wppp_settings' ) ) :
|
191 |
-
add_option( 'wppp_settings', $this->wppp_settings_defaults() );
|
192 |
-
endif;
|
193 |
-
|
194 |
-
$this->settings = get_option( 'wppp_settings' );
|
195 |
-
|
196 |
}
|
197 |
|
198 |
|
@@ -206,26 +223,7 @@ class Woocommerce_Products_Per_Page {
|
|
206 |
* @return array default settings.
|
207 |
*/
|
208 |
public function wppp_settings_defaults() {
|
209 |
-
|
210 |
-
// Set default options to (3|6|9|All) rows
|
211 |
-
$ppp_default =
|
212 |
-
( apply_filters( 'loop_shop_columns', 4 ) * 3) . ' ' .
|
213 |
-
( apply_filters( 'loop_shop_columns', 4 ) * 6) . ' ' .
|
214 |
-
( apply_filters( 'loop_shop_columns', 4 ) * 9) . ' ' .
|
215 |
-
'-1';
|
216 |
-
|
217 |
-
// Set default settings
|
218 |
-
$settings = apply_filters( 'wppp_settings_defaults', array(
|
219 |
-
'location' => 'topbottom',
|
220 |
-
'productsPerPage' => $ppp_default,
|
221 |
-
'default_ppp' => apply_filters( 'loop_shop_per_page', get_option( 'posts_per_page' ) ),
|
222 |
-
'shop_columns' => apply_filters( 'loop_shop_columns', 4 ),
|
223 |
-
'behaviour' => '0',
|
224 |
-
'method' => 'post',
|
225 |
-
) );
|
226 |
-
|
227 |
-
return $settings;
|
228 |
-
|
229 |
}
|
230 |
|
231 |
|
@@ -239,13 +237,8 @@ class Woocommerce_Products_Per_Page {
|
|
239 |
* @return int Number of columns.
|
240 |
*/
|
241 |
public function wppp_loop_shop_columns( $columns ) {
|
242 |
-
|
243 |
-
|
244 |
-
$columns = $this->settings['shop_columns'];
|
245 |
-
endif;
|
246 |
-
|
247 |
-
return $columns;
|
248 |
-
|
249 |
}
|
250 |
|
251 |
|
@@ -259,19 +252,8 @@ class Woocommerce_Products_Per_Page {
|
|
259 |
* @return int Products per page.
|
260 |
*/
|
261 |
public function wppp_loop_shop_per_page() {
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
if ( isset( $_POST['wppp_ppp'] ) ) :
|
266 |
-
return $_POST['wppp_ppp'];
|
267 |
-
elseif ( isset( $_GET['wppp_ppp'] ) ) :
|
268 |
-
return $_GET['wppp_ppp'];
|
269 |
-
elseif ( WC()->session->__isset( 'products_per_page' ) ) :
|
270 |
-
return WC()->session->__get( 'products_per_page' );
|
271 |
-
else :
|
272 |
-
return $this->settings['default_ppp'];
|
273 |
-
endif;
|
274 |
-
|
275 |
}
|
276 |
|
277 |
|
@@ -285,11 +267,8 @@ class Woocommerce_Products_Per_Page {
|
|
285 |
* @return object Query object
|
286 |
*/
|
287 |
public function wppp_pre_get_posts( $q, $class ) {
|
288 |
-
|
289 |
-
|
290 |
-
$q->set( 'posts_per_page', $this->wppp_loop_shop_per_page() );
|
291 |
-
endif;
|
292 |
-
|
293 |
}
|
294 |
|
295 |
|
@@ -301,16 +280,7 @@ class Woocommerce_Products_Per_Page {
|
|
301 |
* @since 1.0.0
|
302 |
*/
|
303 |
public function wppp_shop_hooks() {
|
304 |
-
|
305 |
-
if ( $this->settings['location'] == 'top' ) :
|
306 |
-
add_action( 'woocommerce_before_shop_loop', array( $this, 'wppp_dropdown' ), 25 );
|
307 |
-
elseif ( $this->settings['location'] == 'bottom' ) :
|
308 |
-
add_action( 'woocommerce_after_shop_loop', array( $this, 'wppp_dropdown' ), 25 );
|
309 |
-
elseif ( $this->settings['location'] == 'topbottom' ):
|
310 |
-
add_action( 'woocommerce_before_shop_loop', array( $this, 'wppp_dropdown' ), 25 );
|
311 |
-
add_action( 'woocommerce_after_shop_loop', array( $this, 'wppp_dropdown' ), 25 );
|
312 |
-
endif;
|
313 |
-
|
314 |
}
|
315 |
|
316 |
|
@@ -321,6 +291,7 @@ class Woocommerce_Products_Per_Page {
|
|
321 |
* @deprecated 1.1.0 Use wppp_dropdown() instead.
|
322 |
*/
|
323 |
public function wppp_dropdown_object() {
|
|
|
324 |
$this->wppp_dropdown();
|
325 |
}
|
326 |
|
@@ -333,13 +304,8 @@ class Woocommerce_Products_Per_Page {
|
|
333 |
* @since 1.0.0
|
334 |
*/
|
335 |
public function wppp_dropdown() {
|
336 |
-
|
337 |
-
|
338 |
-
* Products per page dropdown
|
339 |
-
*/
|
340 |
-
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wppp-dropdown.php';
|
341 |
-
new wppp_dropdown();
|
342 |
-
|
343 |
}
|
344 |
|
345 |
|
@@ -351,11 +317,8 @@ class Woocommerce_Products_Per_Page {
|
|
351 |
* @since 1.0.0
|
352 |
*/
|
353 |
public function wppp_set_customer_session() {
|
354 |
-
|
355 |
-
|
356 |
-
WC()->session->set_customer_session_cookie( true );
|
357 |
-
endif;
|
358 |
-
|
359 |
}
|
360 |
|
361 |
|
@@ -367,13 +330,8 @@ class Woocommerce_Products_Per_Page {
|
|
367 |
* @since 1.1.0
|
368 |
*/
|
369 |
public function wppp_submit_check() {
|
370 |
-
|
371 |
-
|
372 |
-
WC()->session->set( 'products_per_page', $_POST['wppp_ppp'] );
|
373 |
-
elseif ( isset( $_GET['wppp_ppp'] ) ) :
|
374 |
-
WC()->session->set( 'products_per_page', $_GET['wppp_ppp'] );
|
375 |
-
endif;
|
376 |
-
|
377 |
}
|
378 |
|
379 |
|
@@ -400,7 +358,6 @@ if ( ! function_exists( 'Woocommerce_Products_Per_Page' ) ) :
|
|
400 |
endif;
|
401 |
|
402 |
Woocommerce_Products_Per_Page();
|
403 |
-
Woocommerce_Products_Per_Page()->wppp_shop_hooks();
|
404 |
|
405 |
|
406 |
// Backwards compatibility
|
3 |
* Plugin Name: Woocommerce Products Per Page
|
4 |
* Plugin URI: http://www.jeroensormani.com/
|
5 |
* Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
|
6 |
+
* Version: 1.2.0
|
7 |
* Author: Jeroen Sormani
|
8 |
* Author URI: http://www.jeroensormani.com
|
9 |
|
40 |
*/
|
41 |
class Woocommerce_Products_Per_Page {
|
42 |
|
43 |
+
|
44 |
/**
|
45 |
+
* Plugin version.
|
|
|
|
|
|
|
46 |
*
|
47 |
+
* @since 1.2.0
|
48 |
+
* @var string $version Plugin version number.
|
49 |
*/
|
50 |
+
public $version = '1.2.0';
|
51 |
|
52 |
|
53 |
/**
|
82 |
}
|
83 |
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
/**
|
86 |
* Instance.
|
87 |
*
|
114 |
if ( is_admin() ) :
|
115 |
|
116 |
/**
|
117 |
+
* Settings
|
118 |
*/
|
119 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-wppp-admin-settings.php';
|
120 |
+
$this->admin_settings = new WPPP_Admin_Settings();
|
121 |
+
|
122 |
+
else :
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Front end
|
126 |
+
*/
|
127 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wppp-front-end.php';
|
128 |
+
$this->front_end = new WPPP_Front_End();
|
129 |
|
130 |
endif;
|
131 |
|
132 |
+
// Plugin update function
|
133 |
+
add_action( 'admin_init', array( $this, 'plugin_update' ) );
|
134 |
+
|
135 |
+
// Load textdomain
|
136 |
+
$this->load_textdomain();
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
|
141 |
+
/**
|
142 |
+
* Textdomain.
|
143 |
+
*
|
144 |
+
* Load the textdomain based on WP language.
|
145 |
+
*
|
146 |
+
* @since 1.2.0
|
147 |
+
*/
|
148 |
+
public function load_textdomain() {
|
149 |
|
150 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-products-per-page' );
|
|
|
151 |
|
152 |
// Load textdomain
|
153 |
+
load_textdomain( 'woocommerce-products-per-page', WP_LANG_DIR . '/woocommerce-products-per-page/woocommerce-products-per-page-' . $locale . '.mo' );
|
154 |
load_plugin_textdomain( 'woocommerce-products-per-page', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
155 |
|
156 |
}
|
157 |
|
158 |
|
159 |
+
/**
|
160 |
+
* Update plugin.
|
161 |
+
*
|
162 |
+
* Plugin update function, update data when required.
|
163 |
+
*
|
164 |
+
* @since 1.2.0
|
165 |
+
*/
|
166 |
+
public function plugin_update() {
|
167 |
+
|
168 |
+
if ( version_compare( get_option( 'wppp_version', '0' ), $this->version, '<' ) ) :
|
169 |
+
|
170 |
+
// Updating to 1.2.0
|
171 |
+
if ( version_compare( get_option( 'wppp_version', '0' ), '1.2.0', '<' ) ) :
|
172 |
+
$settings = get_option( 'wppp_settings', array() );
|
173 |
+
update_option( 'wppp_dropdown_location', isset( $settings['location'] ) ? $settings['location'] : 'topbottom' );
|
174 |
+
update_option( 'wppp_dropdown_options', isset( $settings['productsPerPage'] ) ? $settings['productsPerPage'] : null );
|
175 |
+
update_option( 'wppp_default_ppp', isset( $settings['default_ppp'] ) ? $settings['default_ppp'] : '12' );
|
176 |
+
update_option( 'wppp_shop_columns', isset( $settings['shop_columns'] ) ? $settings['shop_columns'] : '4' );
|
177 |
+
update_option( 'wppp_return_to_first', isset( $settings['behaviour'] ) && '1' == $settings['behaviour'] ? 'yes' : 'no' );
|
178 |
+
update_option( 'wppp_method', isset( $settings['method'] ) ? $settings['method'] : 'post' );
|
179 |
+
endif;
|
180 |
+
|
181 |
+
// Updating to 1.3.0 - for the future, delete the old settings.
|
182 |
+
if ( version_compare( get_option( 'wppp_version', '0' ), '1.3.0', '<' ) ) :
|
183 |
+
// delete_option( 'wppp_settings' );
|
184 |
+
endif;
|
185 |
+
|
186 |
+
update_option( 'wppp_version', $this->version );
|
187 |
+
endif;
|
188 |
+
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
/**
|
193 |
* Initialize admin settings page.
|
194 |
*
|
195 |
* @since 1.1.0
|
196 |
*/
|
197 |
public function wppp_settings_page_menu() {
|
198 |
+
return _deprecated_function( array( $this, __FUNCTION__ ), '1.2.0' );
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
|
209 |
* @return int number of columns.
|
210 |
*/
|
211 |
public function wppp_init_settings() {
|
212 |
+
return _deprecated_function( array( $this, __FUNCTION__ ), '1.2.0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
|
215 |
|
223 |
* @return array default settings.
|
224 |
*/
|
225 |
public function wppp_settings_defaults() {
|
226 |
+
return _deprecated_function( array( $this, __FUNCTION__ ), '1.2.0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
}
|
228 |
|
229 |
|
237 |
* @return int Number of columns.
|
238 |
*/
|
239 |
public function wppp_loop_shop_columns( $columns ) {
|
240 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->loop_shop_columns()' );
|
241 |
+
return $this->front_end->loop_shop_columns();
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
|
244 |
|
252 |
* @return int Products per page.
|
253 |
*/
|
254 |
public function wppp_loop_shop_per_page() {
|
255 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->loop_shop_per_page()' );
|
256 |
+
return $this->front_end->loop_shop_per_page();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
|
259 |
|
267 |
* @return object Query object
|
268 |
*/
|
269 |
public function wppp_pre_get_posts( $q, $class ) {
|
270 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->woocommerce_product_query()' );
|
271 |
+
return $this->front_end->woocommerce_product_query();
|
|
|
|
|
|
|
272 |
}
|
273 |
|
274 |
|
280 |
* @since 1.0.0
|
281 |
*/
|
282 |
public function wppp_shop_hooks() {
|
283 |
+
return _deprecated_function( array( $this, __FUNCTION__ ), '1.2.0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
285 |
|
286 |
|
291 |
* @deprecated 1.1.0 Use wppp_dropdown() instead.
|
292 |
*/
|
293 |
public function wppp_dropdown_object() {
|
294 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.1.0', '$this->wppp_dropdown()' );
|
295 |
$this->wppp_dropdown();
|
296 |
}
|
297 |
|
304 |
* @since 1.0.0
|
305 |
*/
|
306 |
public function wppp_dropdown() {
|
307 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->products_per_page_dropdown()' );
|
308 |
+
return $this->front_end->products_per_page_dropdown();
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
|
317 |
* @since 1.0.0
|
318 |
*/
|
319 |
public function wppp_set_customer_session() {
|
320 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->set_customer_session()' );
|
321 |
+
return $this->front_end->set_customer_session();
|
|
|
|
|
|
|
322 |
}
|
323 |
|
324 |
|
330 |
* @since 1.1.0
|
331 |
*/
|
332 |
public function wppp_submit_check() {
|
333 |
+
_deprecated_function( array( $this, __FUNCTION__ ), '1.2.0', 'Woocommerce_Products_Per_Page()->front_end->products_per_page_action()' );
|
334 |
+
return $this->front_end->products_per_page_dropdown();
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
336 |
|
337 |
|
358 |
endif;
|
359 |
|
360 |
Woocommerce_Products_Per_Page();
|
|
|
361 |
|
362 |
|
363 |
// Backwards compatibility
|