Version Description
- 2017-09-29
Download this release
Release Info
| Developer | themeisle |
| Plugin | |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4 to 1.1.0
- CHANGELOG.md +14 -0
- README.md +68 -69
- css/eaw.css +63 -63
- eaw-class.php +111 -109
- elementor-addon-widgets.php +86 -63
- readme.md +85 -0
- readme.txt +85 -81
- widgets/woo/best-products.php +49 -43
- widgets/woo/featured-products.php +49 -42
- widgets/woo/popular-products.php +46 -40
- widgets/woo/products-categories.php +49 -42
- widgets/woo/recent-products.php +45 -38
- widgets/woo/sale-products.php +45 -38
- widgets/wp/eaw-posts-widget-plus.php +78 -62
- widgets/wp/eaw-posts-widget.php +64 -50
CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
### v1.1.0 - 2017-09-29
|
| 3 |
+
**Changes:**
|
| 4 |
+
* Added Themeisle SDK.
|
| 5 |
+
* Added Continuous Integration.
|
| 6 |
+
* Changed contributors.
|
| 7 |
+
|
| 8 |
+
### v1.1.0 - 2017-09-29
|
| 9 |
+
**Changes:**
|
| 10 |
+
* Travis trigger.
|
| 11 |
+
* Added Themeisle SDK.
|
| 12 |
+
* Added Continuous Integration.
|
| 13 |
+
* Changed contributors.
|
| 14 |
+
|
README.md
CHANGED
|
@@ -1,70 +1,69 @@
|
|
| 1 |
-
# Elementor Addon Widgets
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
**Contributors:** [
|
| 5 |
-
**Tags:** elementor, pagebuilder, page builder, page builder template, page builder templates, woocommerce, template builder, builder templates
|
| 6 |
-
**Requires at least:** 4.4
|
| 7 |
-
**Tested up to:** 4.6.1
|
| 8 |
-
**
|
| 9 |
-
**License:**
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
-
|
| 19 |
-
-
|
| 20 |
-
-
|
| 21 |
-
-
|
| 22 |
-
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
4.
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
*
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
Copyright: WPDevHQ http://www.wpdevhq.com
|
| 1 |
+
# Elementor Addon Widgets
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
**Contributors:** [ThemeIsle](http://www.themeisle.com) [CodeinWP](http://codeinwp.com)
|
| 5 |
+
**Tags:** elementor, pagebuilder, page builder, page builder template, page builder templates, woocommerce, template builder, builder templates
|
| 6 |
+
**Requires at least:** 4.4
|
| 7 |
+
**Tested up to:** 4.6.1
|
| 8 |
+
**License:** GPLv3
|
| 9 |
+
**License URI:** https://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
+
|
| 11 |
+
Widgets that are specifically designed to be used in conjunction with the [Elementor Pagebuilder](https://github.com/pojome/elementor)
|
| 12 |
+
|
| 13 |
+
## Description ##
|
| 14 |
+
Native WordPress widgets specifically designed for use with the Elementor Page Builder
|
| 15 |
+
|
| 16 |
+
Initial version contains 8 widgets - more to come.
|
| 17 |
+
- 1: WooCommerce Product Categories
|
| 18 |
+
- 2: WooCommerce Recent Products
|
| 19 |
+
- 3: WooCommerce Best Selling Products
|
| 20 |
+
- 4: WooCommerce Featured Products
|
| 21 |
+
- 5: WooCommerce On Sale Products
|
| 22 |
+
- 6: WooCommerce Popular Products
|
| 23 |
+
|
| 24 |
+
- 7: New: EAW: Elementor Recent Posts
|
| 25 |
+
- 8: New: EAW: Elementor Posts By Category
|
| 26 |
+
|
| 27 |
+
## Themes ##
|
| 28 |
+
Minimal support is included for almost any theme therefore leaving most of the design to be carried out in the themes themselves.
|
| 29 |
+
The plugin does however inherit some design aspects of the current theme.
|
| 30 |
+
|
| 31 |
+
If you are a theme author you are encouraged to test the plugin making necessary adjustments and providing design options where necessary.
|
| 32 |
+
|
| 33 |
+
If you find any issues with your particular theme not playing nice with the templates please let us know so that we can do our best
|
| 34 |
+
to accommodate you.
|
| 35 |
+
|
| 36 |
+
## Installation ##
|
| 37 |
+
* These instructions assumes you already have a WordPress site and the Elementor plugin installed and activated.
|
| 38 |
+
|
| 39 |
+
1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
|
| 40 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
| 41 |
+
3. Go to Pages > Add New
|
| 42 |
+
4. Select the desired template from the Page Attributes section
|
| 43 |
+
4. Press the 'Edit with Elementor' button.
|
| 44 |
+
5. Scroll down the left pane to the WordPress section and you should see the new widgets that you can drag and drop on to your page.
|
| 45 |
+
|
| 46 |
+
## Frequently Asked Questions ##
|
| 47 |
+
|
| 48 |
+
**Why is it after draging the required widget, making the necessary adjustments to settings and save the layout goes all wonky?**
|
| 49 |
+
|
| 50 |
+
There is a known bug/conflict with WooCommerce assets not being loaded upon saving the edits, however refreshing the page puts things back to normal.
|
| 51 |
+
See this [issue #495](https://github.com/pojome/elementor/issues/495) for current status.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
## Changelog ##
|
| 55 |
+
|
| 56 |
+
### 1.0.3 ###
|
| 57 |
+
* FIXED: Fatal error clash with Storefront on checking if WooCommerce is active.
|
| 58 |
+
|
| 59 |
+
### 1.0.2 ###
|
| 60 |
+
* New: Recent Posts By Category
|
| 61 |
+
* Tweaks: CSS adjustments so that widget title when set does not break column layout
|
| 62 |
+
|
| 63 |
+
### 1.0.1 ###
|
| 64 |
+
* New: Recent Posts Widget
|
| 65 |
+
|
| 66 |
+
### 1.0.0 ###
|
| 67 |
+
* Initial release.
|
| 68 |
+
|
|
|
|
| 69 |
Copyright: WPDevHQ http://www.wpdevhq.com
|
css/eaw.css
CHANGED
|
@@ -1,64 +1,64 @@
|
|
| 1 |
-
/*
|
| 2 |
-
* Elementor CSS support
|
| 3 |
-
*/
|
| 4 |
-
|
| 5 |
-
.eaw-product-section .section-title {
|
| 6 |
-
margin-bottom: 20px;
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
-
.elementor-widget-wp-widget-eaw-recent-posts h5,
|
| 10 |
-
.elementor-widget-wp-widget-eaw-recent-posts-plus h5 {
|
| 11 |
-
font-size: 1.75rem;
|
| 12 |
-
line-height: 1.75;
|
| 13 |
-
text-align: center;
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
.eaw-recent-posts,
|
| 17 |
-
.eaw-recent-posts-plus {
|
| 18 |
-
width: 32.3333%;
|
| 19 |
-
padding: 0;
|
| 20 |
-
margin: 0;
|
| 21 |
-
margin-right: 1.3333%;
|
| 22 |
-
float: left;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
.eaw-recent-posts:last-child,
|
| 26 |
-
.eaw-recent-posts-plus:last-child {
|
| 27 |
-
margin-right: 0;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
.eaw-recent-posts img {
|
| 31 |
-
width: 100%;
|
| 32 |
-
height: 250px;
|
| 33 |
-
margin: 10px 0;
|
| 34 |
-
border-radius: 6px;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
.eaw-recent-posts .eaw-content {
|
| 38 |
-
padding: 1% 2%;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
@media screen and (max-width: 768px) {
|
| 42 |
-
.eaw-recent-posts {
|
| 43 |
-
width: 48%;
|
| 44 |
-
padding: 0;
|
| 45 |
-
margin: 0 1%;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
.eaw-recent-posts img {
|
| 49 |
-
height: 300px;
|
| 50 |
-
margin: 0 auto;
|
| 51 |
-
}
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
@media screen and (max-width: 667px) {
|
| 55 |
-
.eaw-recent-posts {
|
| 56 |
-
width: 100%;
|
| 57 |
-
margin: 0;
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
.eaw-recent-posts img {
|
| 61 |
-
height: 300px;
|
| 62 |
-
margin: 0 auto;
|
| 63 |
-
}
|
| 64 |
}
|
| 1 |
+
/*
|
| 2 |
+
* Elementor CSS support
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
.eaw-product-section .section-title {
|
| 6 |
+
margin-bottom: 20px;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
.elementor-widget-wp-widget-eaw-recent-posts h5,
|
| 10 |
+
.elementor-widget-wp-widget-eaw-recent-posts-plus h5 {
|
| 11 |
+
font-size: 1.75rem;
|
| 12 |
+
line-height: 1.75;
|
| 13 |
+
text-align: center;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.eaw-recent-posts,
|
| 17 |
+
.eaw-recent-posts-plus {
|
| 18 |
+
width: 32.3333%;
|
| 19 |
+
padding: 0;
|
| 20 |
+
margin: 0;
|
| 21 |
+
margin-right: 1.3333%;
|
| 22 |
+
float: left;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.eaw-recent-posts:last-child,
|
| 26 |
+
.eaw-recent-posts-plus:last-child {
|
| 27 |
+
margin-right: 0;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.eaw-recent-posts img {
|
| 31 |
+
width: 100%;
|
| 32 |
+
height: 250px;
|
| 33 |
+
margin: 10px 0;
|
| 34 |
+
border-radius: 6px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.eaw-recent-posts .eaw-content {
|
| 38 |
+
padding: 1% 2%;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
@media screen and (max-width: 768px) {
|
| 42 |
+
.eaw-recent-posts {
|
| 43 |
+
width: 48%;
|
| 44 |
+
padding: 0;
|
| 45 |
+
margin: 0 1%;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.eaw-recent-posts img {
|
| 49 |
+
height: 300px;
|
| 50 |
+
margin: 0 auto;
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
@media screen and (max-width: 667px) {
|
| 55 |
+
.eaw-recent-posts {
|
| 56 |
+
width: 100%;
|
| 57 |
+
margin: 0;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.eaw-recent-posts img {
|
| 61 |
+
height: 300px;
|
| 62 |
+
margin: 0 auto;
|
| 63 |
+
}
|
| 64 |
}
|
eaw-class.php
CHANGED
|
@@ -1,109 +1,111 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Elementor_Addon_Widgets {
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* A reference to an instance of this class.
|
| 7 |
+
*/
|
| 8 |
+
private static $instance;
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Returns an instance of this class.
|
| 12 |
+
*/
|
| 13 |
+
public static function get_instance() {
|
| 14 |
+
|
| 15 |
+
if ( null == self::$instance ) {
|
| 16 |
+
self::$instance = new Elementor_Addon_Widgets();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
return self::$instance;
|
| 20 |
+
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
public function eaw_load_plugin_textdomain() {
|
| 24 |
+
load_plugin_textdomain( 'elementor-addon-widgets' );
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Cloning is forbidden.
|
| 29 |
+
*
|
| 30 |
+
* @since 1.0.0
|
| 31 |
+
*/
|
| 32 |
+
public function __clone() {
|
| 33 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'elementor-addon-widgets' ), '1.0.0' );
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Unserializing instances of this class is forbidden.
|
| 38 |
+
*
|
| 39 |
+
* @since 1.0.0
|
| 40 |
+
*/
|
| 41 |
+
public function __wakeup() {
|
| 42 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'elementor-addon-widgets' ), '1.0.0' );
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Initializes the plugin by setting filters and administration functions.
|
| 47 |
+
*/
|
| 48 |
+
private function __construct() {
|
| 49 |
+
|
| 50 |
+
add_action( 'init', array( $this, 'eaw_load_plugin_textdomain' ) );
|
| 51 |
+
|
| 52 |
+
add_action( 'widgets_init', array( $this, 'eaw_addon_woo_widgets' ) );
|
| 53 |
+
|
| 54 |
+
add_action( 'widgets_init', array( $this, 'eaw_addon_posts_widgets' ) );
|
| 55 |
+
|
| 56 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'eaw_styles' ), 999 );
|
| 57 |
+
|
| 58 |
+
}
|
| 59 |
+
// public static function eaw_is_woocommerce_active() {
|
| 60 |
+
// return class_exists( 'woocommerce' ) ? true : false;
|
| 61 |
+
// }
|
| 62 |
+
/**
|
| 63 |
+
* WooCommerce Widget section
|
| 64 |
+
*
|
| 65 |
+
* @since 1.0.0
|
| 66 |
+
* @return void
|
| 67 |
+
*/
|
| 68 |
+
public static function eaw_addon_woo_widgets() {
|
| 69 |
+
if ( eaw_is_woocommerce_active() ) { // Lets not do anything unless WooCommerce is active!
|
| 70 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/products-categories.php' );
|
| 71 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/recent-products.php' );
|
| 72 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/featured-products.php' );
|
| 73 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/popular-products.php' );
|
| 74 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/sale-products.php' );
|
| 75 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/best-products.php' );
|
| 76 |
+
|
| 77 |
+
register_widget( 'Woo_Product_Categories' );
|
| 78 |
+
register_widget( 'Woo_Recent_Products' );
|
| 79 |
+
register_widget( 'Woo_Featured_Products' );
|
| 80 |
+
register_widget( 'Woo_Popular_Products' );
|
| 81 |
+
register_widget( 'Woo_Sale_Products' );
|
| 82 |
+
register_widget( 'Woo_Best_Products' );
|
| 83 |
+
}
|
| 84 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/wp/eaw-posts-widget.php' );
|
| 85 |
+
register_widget( 'EAW_Recent_Posts' );
|
| 86 |
+
|
| 87 |
+
include_once( plugin_dir_path( __FILE__ ) . 'widgets/wp/eaw-posts-widget-plus.php' );
|
| 88 |
+
register_widget( 'EAW_Recent_Posts_Plus' );
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Posts Widget section
|
| 93 |
+
*
|
| 94 |
+
* @since 1.0.0
|
| 95 |
+
* @return void
|
| 96 |
+
*/
|
| 97 |
+
public static function eaw_addon_posts_widgets() {
|
| 98 |
+
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Enqueue CSS and custom styles.
|
| 103 |
+
*
|
| 104 |
+
* @since 1.0.0
|
| 105 |
+
* @return void
|
| 106 |
+
*/
|
| 107 |
+
public function eaw_styles() {
|
| 108 |
+
wp_enqueue_style( 'eaw-styles', plugins_url( '/css/eaw.css', __FILE__ ) );
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
add_action( 'plugins_loaded', array( 'Elementor_Addon_Widgets', 'get_instance' ) );
|
elementor-addon-widgets.php
CHANGED
|
@@ -1,63 +1,86 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
* Plugin
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
* Author:
|
| 9 |
-
*
|
| 10 |
-
*
|
| 11 |
-
*
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
/*
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
*
|
| 48 |
-
*
|
| 49 |
-
* @
|
| 50 |
-
*
|
| 51 |
-
*
|
| 52 |
-
* @
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Plugin Name: Addon Widgets Elementor
|
| 4 |
+
* Plugin URI: https://themeisle.com/
|
| 5 |
+
* Description: A helper plugin for users of Elementor Page Builder.
|
| 6 |
+
* Version: 1.1.0
|
| 7 |
+
* Author: ThemeIsle
|
| 8 |
+
* Author URI: https://themeisle.com/
|
| 9 |
+
* Requires at least: 4.4
|
| 10 |
+
* Tested up to: 4.8
|
| 11 |
+
*
|
| 12 |
+
* Requires License: no
|
| 13 |
+
* WordPress Available: yes
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
/* Do not access this file directly */
|
| 17 |
+
if ( ! defined( 'WPINC' ) ) {
|
| 18 |
+
die; }
|
| 19 |
+
|
| 20 |
+
/*
|
| 21 |
+
Constants
|
| 22 |
+
------------------------------------------ */
|
| 23 |
+
|
| 24 |
+
/* Set plugin version constant. */
|
| 25 |
+
define( 'EA_VERSION', '1.1.0' );
|
| 26 |
+
|
| 27 |
+
/* Set constant path to the plugin directory. */
|
| 28 |
+
define( 'EA_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
| 29 |
+
|
| 30 |
+
/* Set the constant path to the plugin directory URI. */
|
| 31 |
+
define( 'EA_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
| 32 |
+
|
| 33 |
+
/* ElemenTemplater Class */
|
| 34 |
+
require_once( EA_PATH . 'eaw-class.php' );
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Query WooCommerce activation
|
| 38 |
+
*/
|
| 39 |
+
if ( ! function_exists( 'eaw_is_woocommerce_active' ) ) {
|
| 40 |
+
|
| 41 |
+
function eaw_is_woocommerce_active() {
|
| 42 |
+
return class_exists( 'woocommerce' ) ? true : false;
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Call a shortcode function by tag name.
|
| 48 |
+
*
|
| 49 |
+
* @since 1.0.0
|
| 50 |
+
*
|
| 51 |
+
* @param string $tag The shortcode whose function to call.
|
| 52 |
+
* @param array $atts The attributes to pass to the shortcode function. Optional.
|
| 53 |
+
* @param array $content The shortcode's content. Default is null (none).
|
| 54 |
+
*
|
| 55 |
+
* @return string|bool False on failure, the result of the shortcode on success.
|
| 56 |
+
*/
|
| 57 |
+
function eaw_do_shortcode( $tag, array $atts = array(), $content = null ) {
|
| 58 |
+
|
| 59 |
+
global $shortcode_tags;
|
| 60 |
+
|
| 61 |
+
if ( ! isset( $shortcode_tags[ $tag ] ) ) {
|
| 62 |
+
return false;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/* Require vendor file. */
|
| 69 |
+
$vendor_file = plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
|
| 70 |
+
if ( is_readable( $vendor_file ) ) {
|
| 71 |
+
require_once $vendor_file;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Register SDK.
|
| 76 |
+
*
|
| 77 |
+
* @param $products
|
| 78 |
+
*
|
| 79 |
+
* @return array
|
| 80 |
+
*/
|
| 81 |
+
function elementor_addon_widgets_register_sdk( $products ) {
|
| 82 |
+
$products[] = __FILE__;
|
| 83 |
+
return $products;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
add_filter( 'themeisle_sdk_products', 'elementor_addon_widgets_register_sdk', 10, 1 );
|
readme.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Addon Widgets For Elementor #
|
| 2 |
+
**Contributors:** [themeisle](https://profiles.wordpress.org/themeisle), [codeinwp](https://profiles.wordpress.org/codeinwp)
|
| 3 |
+
**Tags:** elementor, pagebuilder, page builder, page builder template, page builder templates, woocommerce, template builder, builder templates
|
| 4 |
+
**Requires at least:** 4.4
|
| 5 |
+
**Tested up to:** 4.7.2
|
| 6 |
+
**License:** GPLv3
|
| 7 |
+
**License URI:** https://www.gnu.org/licenses/gpl-3.0.html
|
| 8 |
+
|
| 9 |
+
Adds Native Custom Wordpress Widgets that are specifically designed to be used in conjunction with the Elementor Page Builder
|
| 10 |
+
|
| 11 |
+
## Description ##
|
| 12 |
+
Native WordPress widgets specifically designed for use with the [Elementor Page Builder](https://wordpress.org/plugins/elementor/)
|
| 13 |
+
|
| 14 |
+
Initial version contains 6(+2) widgets - more to come.
|
| 15 |
+
* 1: WooCommerce Product Categories
|
| 16 |
+
* 2: WooCommerce Recent Products
|
| 17 |
+
* 3: WooCommerce Best Selling Products
|
| 18 |
+
* 4: WooCommerce Featured Products
|
| 19 |
+
* 5: WooCommerce On Sale Products
|
| 20 |
+
* 6: WooCommerce Popular Products
|
| 21 |
+
|
| 22 |
+
* 7: New: EAW: Elementor Recent Posts
|
| 23 |
+
* 8: New: EAW: Elementor Posts By Category
|
| 24 |
+
|
| 25 |
+
## Themes ##
|
| 26 |
+
Minimal support is included for almost any theme therefore leaving most of the design to be carried out in the themes themselves.
|
| 27 |
+
The plugin does however inherit some design aspects of the current theme.
|
| 28 |
+
|
| 29 |
+
If you are a theme author you are encouraged to test the plugin making necessary adjustments and providing design options where necessary.
|
| 30 |
+
|
| 31 |
+
If you find any issues with your particular theme not playing nice with the templates please let us know so that we can do our best
|
| 32 |
+
to accommodate you.
|
| 33 |
+
|
| 34 |
+
## Installation ##
|
| 35 |
+
* These instructions assumes you already have a WordPress site and the Elementor plugin installed and activated.
|
| 36 |
+
|
| 37 |
+
1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
|
| 38 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
| 39 |
+
3. Go to Pages > Add New
|
| 40 |
+
4. Select the desired template from the Page Attributes section
|
| 41 |
+
4. Press the 'Edit with Elementor' button.
|
| 42 |
+
5. Scroll down the left pane to the WordPress section and you should see the new widgets that you can drag and drop on to your page.
|
| 43 |
+
|
| 44 |
+
## Frequently Asked Questions ##
|
| 45 |
+
|
| 46 |
+
Why is it after dragging the required widget, making the necessary adjustments to settings and save the layout goes all wonky?
|
| 47 |
+
|
| 48 |
+
There is a known bug/conflict with WooCommerce assets not being loaded upon saving the edits, however refreshing the page puts things back to normal.
|
| 49 |
+
See this [issue #495](https://github.com/pojome/elementor/issues/495) for current status.
|
| 50 |
+
|
| 51 |
+
## Screenshots ##
|
| 52 |
+
|
| 53 |
+
1. Widgets Panel
|
| 54 |
+
|
| 55 |
+
2. Editor View
|
| 56 |
+
|
| 57 |
+
3. Frontend View Products And Posts
|
| 58 |
+
|
| 59 |
+
4. Frontend view posts with custom title.
|
| 60 |
+
|
| 61 |
+
## Changelog ##
|
| 62 |
+
### 1.1.0 - 2017-09-29 ###
|
| 63 |
+
|
| 64 |
+
* Travis trigger.
|
| 65 |
+
* Added Themeisle SDK.
|
| 66 |
+
* Added Continuous Integration.
|
| 67 |
+
* Changed contributors.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
### 1.0.4 ###
|
| 71 |
+
* Name change due to stipulation on Elementor's Terms and Conditions
|
| 72 |
+
* Adjustments made to plugin and author urls
|
| 73 |
+
|
| 74 |
+
### 1.0.3 ###
|
| 75 |
+
* FIXED: Fatal error clash with Storefront on checking if WooCommerce is active.
|
| 76 |
+
|
| 77 |
+
### 1.0.2 ###
|
| 78 |
+
* New: Recent Posts By Category
|
| 79 |
+
* Tweaks: CSS adjustments so that widget title when set does not break column layout
|
| 80 |
+
|
| 81 |
+
### 1.0.1 ###
|
| 82 |
+
* New: Recent Posts Widget
|
| 83 |
+
|
| 84 |
+
### 1.0.0 ###
|
| 85 |
+
* Initial release.
|
readme.txt
CHANGED
|
@@ -1,81 +1,85 @@
|
|
| 1 |
-
=== Addon Widgets For Elementor ===
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
*
|
| 18 |
-
*
|
| 19 |
-
*
|
| 20 |
-
*
|
| 21 |
-
|
| 22 |
-
*
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
If you
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
*
|
| 66 |
-
*
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
*
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
*
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== Addon Widgets For Elementor ===
|
| 2 |
+
Contributors: themeisle, codeinwp
|
| 3 |
+
Tags: elementor, pagebuilder, page builder, page builder template, page builder templates, woocommerce, template builder, builder templates
|
| 4 |
+
Requires at least: 4.4
|
| 5 |
+
Tested up to: 4.7.2
|
| 6 |
+
License: GPLv3
|
| 7 |
+
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 8 |
+
|
| 9 |
+
Adds Native Custom Wordpress Widgets that are specifically designed to be used in conjunction with the Elementor Page Builder
|
| 10 |
+
|
| 11 |
+
== Description ==
|
| 12 |
+
Native WordPress widgets specifically designed for use with the [Elementor Page Builder](https://wordpress.org/plugins/elementor/)
|
| 13 |
+
|
| 14 |
+
Initial version contains 6(+2) widgets - more to come.
|
| 15 |
+
* 1: WooCommerce Product Categories
|
| 16 |
+
* 2: WooCommerce Recent Products
|
| 17 |
+
* 3: WooCommerce Best Selling Products
|
| 18 |
+
* 4: WooCommerce Featured Products
|
| 19 |
+
* 5: WooCommerce On Sale Products
|
| 20 |
+
* 6: WooCommerce Popular Products
|
| 21 |
+
|
| 22 |
+
* 7: New: EAW: Elementor Recent Posts
|
| 23 |
+
* 8: New: EAW: Elementor Posts By Category
|
| 24 |
+
|
| 25 |
+
== Themes ==
|
| 26 |
+
Minimal support is included for almost any theme therefore leaving most of the design to be carried out in the themes themselves.
|
| 27 |
+
The plugin does however inherit some design aspects of the current theme.
|
| 28 |
+
|
| 29 |
+
If you are a theme author you are encouraged to test the plugin making necessary adjustments and providing design options where necessary.
|
| 30 |
+
|
| 31 |
+
If you find any issues with your particular theme not playing nice with the templates please let us know so that we can do our best
|
| 32 |
+
to accommodate you.
|
| 33 |
+
|
| 34 |
+
== Installation ==
|
| 35 |
+
* These instructions assumes you already have a WordPress site and the Elementor plugin installed and activated.
|
| 36 |
+
|
| 37 |
+
1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
|
| 38 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
| 39 |
+
3. Go to Pages > Add New
|
| 40 |
+
4. Select the desired template from the Page Attributes section
|
| 41 |
+
4. Press the 'Edit with Elementor' button.
|
| 42 |
+
5. Scroll down the left pane to the WordPress section and you should see the new widgets that you can drag and drop on to your page.
|
| 43 |
+
|
| 44 |
+
== Frequently Asked Questions ==
|
| 45 |
+
|
| 46 |
+
Why is it after dragging the required widget, making the necessary adjustments to settings and save the layout goes all wonky?
|
| 47 |
+
|
| 48 |
+
There is a known bug/conflict with WooCommerce assets not being loaded upon saving the edits, however refreshing the page puts things back to normal.
|
| 49 |
+
See this [issue #495](https://github.com/pojome/elementor/issues/495) for current status.
|
| 50 |
+
|
| 51 |
+
== Screenshots ==
|
| 52 |
+
|
| 53 |
+
1. Widgets Panel
|
| 54 |
+
|
| 55 |
+
2. Editor View
|
| 56 |
+
|
| 57 |
+
3. Frontend View Products And Posts
|
| 58 |
+
|
| 59 |
+
4. Frontend view posts with custom title.
|
| 60 |
+
|
| 61 |
+
== Changelog ==
|
| 62 |
+
= 1.1.0 - 2017-09-29 =
|
| 63 |
+
|
| 64 |
+
* Travis trigger.
|
| 65 |
+
* Added Themeisle SDK.
|
| 66 |
+
* Added Continuous Integration.
|
| 67 |
+
* Changed contributors.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
= 1.0.4 =
|
| 71 |
+
* Name change due to stipulation on Elementor's Terms and Conditions
|
| 72 |
+
* Adjustments made to plugin and author urls
|
| 73 |
+
|
| 74 |
+
= 1.0.3 =
|
| 75 |
+
* FIXED: Fatal error clash with Storefront on checking if WooCommerce is active.
|
| 76 |
+
|
| 77 |
+
= 1.0.2 =
|
| 78 |
+
* New: Recent Posts By Category
|
| 79 |
+
* Tweaks: CSS adjustments so that widget title when set does not break column layout
|
| 80 |
+
|
| 81 |
+
= 1.0.1 =
|
| 82 |
+
* New: Recent Posts Widget
|
| 83 |
+
|
| 84 |
+
= 1.0.0 =
|
| 85 |
+
* Initial release.
|
widgets/woo/best-products.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class Woo_Best_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Woo Best Selling Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('woo-best-products', __('Woo Best Selling Products', 'elementor-addon-widgets'), $widget_ops);
|
| 18 |
$this->alt_option_name = 'woo_best_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -49,43 +49,48 @@ class Woo_Best_Products extends WP_Widget {
|
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
-
|
| 53 |
-
if ( '' == $title
|
| 54 |
$title = __( 'Best Sellers', 'elementor-addon-widgets' );
|
|
|
|
| 55 |
|
| 56 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 57 |
-
if ( '' == $limit )
|
| 58 |
$limit = 4;
|
|
|
|
| 59 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 60 |
-
|
| 61 |
-
if ( '' == $columns )
|
| 62 |
-
$columns = 4;
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
'
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
|
| 72 |
echo $args['before_widget'];
|
| 73 |
-
//echo '<div class="woo-best-products">';
|
| 74 |
-
|
| 75 |
-
|
| 76 |
do_action( 'storepage_homepage_before_best_selling_products' );
|
| 77 |
echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
|
| 78 |
-
|
| 79 |
do_action( 'storepage_homepage_after_best_selling_products_title' );
|
| 80 |
-
echo eaw_do_shortcode(
|
| 81 |
-
'
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
do_action( 'storepage_homepage_after_best_selling_products' );
|
| 85 |
-
|
| 86 |
echo '</section>';
|
| 87 |
-
//echo '</div>';
|
| 88 |
-
|
| 89 |
echo $args['after_widget'];
|
| 90 |
|
| 91 |
if ( ! $this->is_preview() ) {
|
|
@@ -98,14 +103,15 @@ class Woo_Best_Products extends WP_Widget {
|
|
| 98 |
|
| 99 |
public function update( $new_instance, $old_instance ) {
|
| 100 |
$instance = $old_instance;
|
| 101 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 102 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 103 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 104 |
$this->flush_widget_cache();
|
| 105 |
|
| 106 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 107 |
-
if ( isset($alloptions['woo_best_products']) )
|
| 108 |
-
delete_option('woo_best_products');
|
|
|
|
| 109 |
|
| 110 |
return $instance;
|
| 111 |
}
|
|
@@ -114,7 +120,7 @@ class Woo_Best_Products extends WP_Widget {
|
|
| 114 |
* @access public
|
| 115 |
*/
|
| 116 |
public function flush_widget_cache() {
|
| 117 |
-
wp_cache_delete('woo_best_products', 'widget');
|
| 118 |
}
|
| 119 |
|
| 120 |
/**
|
|
@@ -124,17 +130,17 @@ class Woo_Best_Products extends WP_Widget {
|
|
| 124 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 125 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 126 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 127 |
-
|
| 128 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 129 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 130 |
|
| 131 |
-
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets'
|
| 132 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 133 |
|
| 134 |
-
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets'
|
| 135 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
}
|
| 140 |
-
}
|
| 8 |
class Woo_Best_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'woo_best_products',
|
| 13 |
+
'description' => __( 'Woo Best Selling Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'woo-best-products', __( 'Woo Best Selling Products', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'woo_best_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
+
|
| 53 |
+
if ( '' == $title ) {
|
| 54 |
$title = __( 'Best Sellers', 'elementor-addon-widgets' );
|
| 55 |
+
}
|
| 56 |
|
| 57 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 58 |
+
if ( '' == $limit ) {
|
| 59 |
$limit = 4;
|
| 60 |
+
}
|
| 61 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 62 |
+
|
| 63 |
+
if ( '' == $columns ) {
|
| 64 |
+
$columns = 4;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$args = apply_filters(
|
| 68 |
+
'elementor-addon-widgets_product_categories_args', array(
|
| 69 |
+
'limit' => $limit,
|
| 70 |
+
'columns' => $columns,
|
| 71 |
+
'title' => $title, 'orderby' => 'date',
|
| 72 |
+
'order' => 'desc',
|
| 73 |
+
)
|
| 74 |
+
);
|
| 75 |
|
| 76 |
echo $args['before_widget'];
|
| 77 |
+
// echo '<div class="woo-best-products">';
|
| 78 |
+
echo '<section class="eaw-product-section woo-best-products">';
|
| 79 |
+
|
| 80 |
do_action( 'storepage_homepage_before_best_selling_products' );
|
| 81 |
echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
|
| 82 |
+
|
| 83 |
do_action( 'storepage_homepage_after_best_selling_products_title' );
|
| 84 |
+
echo eaw_do_shortcode(
|
| 85 |
+
'best_selling_products', array(
|
| 86 |
+
'per_page' => intval( $args['limit'] ),
|
| 87 |
+
'columns' => intval( $args['columns'] ),
|
| 88 |
+
)
|
| 89 |
+
);
|
| 90 |
do_action( 'storepage_homepage_after_best_selling_products' );
|
| 91 |
+
|
| 92 |
echo '</section>';
|
| 93 |
+
// echo '</div>';
|
|
|
|
| 94 |
echo $args['after_widget'];
|
| 95 |
|
| 96 |
if ( ! $this->is_preview() ) {
|
| 103 |
|
| 104 |
public function update( $new_instance, $old_instance ) {
|
| 105 |
$instance = $old_instance;
|
| 106 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 107 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 108 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 109 |
$this->flush_widget_cache();
|
| 110 |
|
| 111 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 112 |
+
if ( isset( $alloptions['woo_best_products'] ) ) {
|
| 113 |
+
delete_option( 'woo_best_products' );
|
| 114 |
+
}
|
| 115 |
|
| 116 |
return $instance;
|
| 117 |
}
|
| 120 |
* @access public
|
| 121 |
*/
|
| 122 |
public function flush_widget_cache() {
|
| 123 |
+
wp_cache_delete( 'woo_best_products', 'widget' );
|
| 124 |
}
|
| 125 |
|
| 126 |
/**
|
| 130 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 131 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 132 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 133 |
+
?>
|
| 134 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 135 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 136 |
|
| 137 |
+
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
|
| 138 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 139 |
|
| 140 |
+
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
|
| 141 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
<?php
|
| 145 |
+
}
|
| 146 |
+
}
|
widgets/woo/featured-products.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class Woo_Featured_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Woo Featured Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('woo-featured-products', __('Woo Featured Products', 'elementor-addon-widgets'), $widget_ops);
|
| 18 |
$this->alt_option_name = 'woo_featured_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -49,28 +49,32 @@ class Woo_Featured_Products extends WP_Widget {
|
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
-
|
| 53 |
-
if ( '' == $title
|
| 54 |
$title = __( 'Recommended For You', 'elementor-addon-widgets' );
|
|
|
|
| 55 |
|
| 56 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 57 |
-
if ( '' == $limit )
|
| 58 |
$limit = 4;
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
'
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
echo $args['before_widget'];
|
| 73 |
-
|
| 74 |
|
| 75 |
do_action( 'storepage_homepage_before_featured_products' );
|
| 76 |
|
|
@@ -78,17 +82,19 @@ class Woo_Featured_Products extends WP_Widget {
|
|
| 78 |
|
| 79 |
do_action( 'storepage_homepage_after_featured_products_title' );
|
| 80 |
|
| 81 |
-
echo eaw_do_shortcode(
|
| 82 |
-
'
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
|
| 88 |
do_action( 'storepage_homepage_after_featured_products' );
|
| 89 |
|
| 90 |
-
echo '</section>';
|
| 91 |
-
|
| 92 |
echo $args['after_widget'];
|
| 93 |
|
| 94 |
if ( ! $this->is_preview() ) {
|
|
@@ -101,14 +107,15 @@ class Woo_Featured_Products extends WP_Widget {
|
|
| 101 |
|
| 102 |
public function update( $new_instance, $old_instance ) {
|
| 103 |
$instance = $old_instance;
|
| 104 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 105 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 106 |
$instance['columns'] = (int) $new_instance['columns'];
|
| 107 |
$this->flush_widget_cache();
|
| 108 |
|
| 109 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 110 |
-
if ( isset($alloptions['woo_featured_products']) )
|
| 111 |
-
delete_option('woo_featured_products');
|
|
|
|
| 112 |
|
| 113 |
return $instance;
|
| 114 |
}
|
|
@@ -117,7 +124,7 @@ class Woo_Featured_Products extends WP_Widget {
|
|
| 117 |
* @access public
|
| 118 |
*/
|
| 119 |
public function flush_widget_cache() {
|
| 120 |
-
wp_cache_delete('woo_featured_products', 'widget');
|
| 121 |
}
|
| 122 |
|
| 123 |
/**
|
|
@@ -127,17 +134,17 @@ class Woo_Featured_Products extends WP_Widget {
|
|
| 127 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 128 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 129 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 130 |
-
|
| 131 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 132 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 133 |
|
| 134 |
-
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets'
|
| 135 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 136 |
|
| 137 |
-
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets'
|
| 138 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
}
|
| 143 |
-
}
|
| 8 |
class Woo_Featured_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'woo_featured_products',
|
| 13 |
+
'description' => __( 'Woo Featured Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'woo-featured-products', __( 'Woo Featured Products', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'woo_featured_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
+
|
| 53 |
+
if ( '' == $title ) {
|
| 54 |
$title = __( 'Recommended For You', 'elementor-addon-widgets' );
|
| 55 |
+
}
|
| 56 |
|
| 57 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 58 |
+
if ( '' == $limit ) {
|
| 59 |
$limit = 4;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 63 |
+
if ( '' == $columns ) {
|
| 64 |
+
$columns = 4;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$args = apply_filters(
|
| 68 |
+
'elementor-addon-widgets_product_categories_args', array(
|
| 69 |
+
'limit' => $limit,
|
| 70 |
+
'columns' => $columns,
|
| 71 |
+
'title' => $title, 'orderby' => 'date',
|
| 72 |
+
'order' => 'desc',
|
| 73 |
+
)
|
| 74 |
+
);
|
| 75 |
|
| 76 |
echo $args['before_widget'];
|
| 77 |
+
echo '<section class="eaw-product-section woo-featured-products">';
|
| 78 |
|
| 79 |
do_action( 'storepage_homepage_before_featured_products' );
|
| 80 |
|
| 82 |
|
| 83 |
do_action( 'storepage_homepage_after_featured_products_title' );
|
| 84 |
|
| 85 |
+
echo eaw_do_shortcode(
|
| 86 |
+
'featured_products', array(
|
| 87 |
+
'per_page' => intval( $args['limit'] ),
|
| 88 |
+
'columns' => intval( $args['columns'] ),
|
| 89 |
+
'orderby' => esc_attr( $args['orderby'] ),
|
| 90 |
+
'order' => esc_attr( $args['order'] ),
|
| 91 |
+
)
|
| 92 |
+
);
|
| 93 |
|
| 94 |
do_action( 'storepage_homepage_after_featured_products' );
|
| 95 |
|
| 96 |
+
echo '</section>';
|
| 97 |
+
|
| 98 |
echo $args['after_widget'];
|
| 99 |
|
| 100 |
if ( ! $this->is_preview() ) {
|
| 107 |
|
| 108 |
public function update( $new_instance, $old_instance ) {
|
| 109 |
$instance = $old_instance;
|
| 110 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 111 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 112 |
$instance['columns'] = (int) $new_instance['columns'];
|
| 113 |
$this->flush_widget_cache();
|
| 114 |
|
| 115 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 116 |
+
if ( isset( $alloptions['woo_featured_products'] ) ) {
|
| 117 |
+
delete_option( 'woo_featured_products' );
|
| 118 |
+
}
|
| 119 |
|
| 120 |
return $instance;
|
| 121 |
}
|
| 124 |
* @access public
|
| 125 |
*/
|
| 126 |
public function flush_widget_cache() {
|
| 127 |
+
wp_cache_delete( 'woo_featured_products', 'widget' );
|
| 128 |
}
|
| 129 |
|
| 130 |
/**
|
| 134 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 135 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 136 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 137 |
+
?>
|
| 138 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 139 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 140 |
|
| 141 |
+
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
|
| 142 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 143 |
|
| 144 |
+
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
|
| 145 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
<?php
|
| 149 |
+
}
|
| 150 |
+
}
|
widgets/woo/popular-products.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class Woo_Popular_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Woo Popular Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('woo-popular-products', __('Woo Popular Products', 'elementor-addon-widgets'), $widget_ops);
|
| 18 |
$this->alt_option_name = 'woo_popular_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -49,29 +49,33 @@ class Woo_Popular_Products extends WP_Widget {
|
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
-
|
| 53 |
-
if ( '' == $title
|
| 54 |
$title = __( 'Fan Favorites', 'elementor-addon-widgets' );
|
|
|
|
| 55 |
|
| 56 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 57 |
-
if ( '' == $limit )
|
| 58 |
$limit = 4;
|
|
|
|
| 59 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 60 |
-
|
| 61 |
-
if ( '' == $columns )
|
| 62 |
-
$columns = 4;
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
'
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
|
| 72 |
echo $args['before_widget'];
|
| 73 |
-
//echo '<div class="woo-popular-products">';
|
| 74 |
-
|
| 75 |
|
| 76 |
do_action( 'storepage_homepage_before_popular_products' );
|
| 77 |
|
|
@@ -79,16 +83,17 @@ class Woo_Popular_Products extends WP_Widget {
|
|
| 79 |
|
| 80 |
do_action( 'storepage_homepage_after_popular_products_title' );
|
| 81 |
|
| 82 |
-
echo eaw_do_shortcode(
|
| 83 |
-
'
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
| 86 |
|
| 87 |
do_action( 'storepage_homepage_after_popular_products' );
|
| 88 |
|
| 89 |
echo '</section>';
|
| 90 |
-
//echo '</div>';
|
| 91 |
-
|
| 92 |
echo $args['after_widget'];
|
| 93 |
|
| 94 |
if ( ! $this->is_preview() ) {
|
|
@@ -101,14 +106,15 @@ class Woo_Popular_Products extends WP_Widget {
|
|
| 101 |
|
| 102 |
public function update( $new_instance, $old_instance ) {
|
| 103 |
$instance = $old_instance;
|
| 104 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 105 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 106 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 107 |
$this->flush_widget_cache();
|
| 108 |
|
| 109 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 110 |
-
if ( isset($alloptions['woo_popular_products']) )
|
| 111 |
-
delete_option('woo_popular_products');
|
|
|
|
| 112 |
|
| 113 |
return $instance;
|
| 114 |
}
|
|
@@ -117,7 +123,7 @@ class Woo_Popular_Products extends WP_Widget {
|
|
| 117 |
* @access public
|
| 118 |
*/
|
| 119 |
public function flush_widget_cache() {
|
| 120 |
-
wp_cache_delete('woo_popular_products', 'widget');
|
| 121 |
}
|
| 122 |
|
| 123 |
/**
|
|
@@ -127,17 +133,17 @@ class Woo_Popular_Products extends WP_Widget {
|
|
| 127 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 128 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 129 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 130 |
-
|
| 131 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 132 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 133 |
|
| 134 |
-
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets'
|
| 135 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 136 |
|
| 137 |
-
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets'
|
| 138 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
}
|
| 143 |
-
}
|
| 8 |
class Woo_Popular_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'woo_popular_products',
|
| 13 |
+
'description' => __( 'Woo Popular Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'woo-popular-products', __( 'Woo Popular Products', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'woo_popular_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
+
|
| 53 |
+
if ( '' == $title ) {
|
| 54 |
$title = __( 'Fan Favorites', 'elementor-addon-widgets' );
|
| 55 |
+
}
|
| 56 |
|
| 57 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 58 |
+
if ( '' == $limit ) {
|
| 59 |
$limit = 4;
|
| 60 |
+
}
|
| 61 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 62 |
+
|
| 63 |
+
if ( '' == $columns ) {
|
| 64 |
+
$columns = 4;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$args = apply_filters(
|
| 68 |
+
'elementor-addon-widgets_product_categories_args', array(
|
| 69 |
+
'limit' => $limit,
|
| 70 |
+
'columns' => $columns,
|
| 71 |
+
'title' => $title, 'orderby' => 'date',
|
| 72 |
+
'order' => 'desc',
|
| 73 |
+
)
|
| 74 |
+
);
|
| 75 |
|
| 76 |
echo $args['before_widget'];
|
| 77 |
+
// echo '<div class="woo-popular-products">';
|
| 78 |
+
echo '<section class="eaw-product-section woo-popular-products">';
|
| 79 |
|
| 80 |
do_action( 'storepage_homepage_before_popular_products' );
|
| 81 |
|
| 83 |
|
| 84 |
do_action( 'storepage_homepage_after_popular_products_title' );
|
| 85 |
|
| 86 |
+
echo eaw_do_shortcode(
|
| 87 |
+
'top_rated_products', array(
|
| 88 |
+
'per_page' => intval( $args['limit'] ),
|
| 89 |
+
'columns' => intval( $args['columns'] ),
|
| 90 |
+
)
|
| 91 |
+
);
|
| 92 |
|
| 93 |
do_action( 'storepage_homepage_after_popular_products' );
|
| 94 |
|
| 95 |
echo '</section>';
|
| 96 |
+
// echo '</div>';
|
|
|
|
| 97 |
echo $args['after_widget'];
|
| 98 |
|
| 99 |
if ( ! $this->is_preview() ) {
|
| 106 |
|
| 107 |
public function update( $new_instance, $old_instance ) {
|
| 108 |
$instance = $old_instance;
|
| 109 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 110 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 111 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 112 |
$this->flush_widget_cache();
|
| 113 |
|
| 114 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 115 |
+
if ( isset( $alloptions['woo_popular_products'] ) ) {
|
| 116 |
+
delete_option( 'woo_popular_products' );
|
| 117 |
+
}
|
| 118 |
|
| 119 |
return $instance;
|
| 120 |
}
|
| 123 |
* @access public
|
| 124 |
*/
|
| 125 |
public function flush_widget_cache() {
|
| 126 |
+
wp_cache_delete( 'woo_popular_products', 'widget' );
|
| 127 |
}
|
| 128 |
|
| 129 |
/**
|
| 133 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 134 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 135 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 136 |
+
?>
|
| 137 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 138 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 139 |
|
| 140 |
+
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
|
| 141 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 142 |
|
| 143 |
+
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
|
| 144 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
<?php
|
| 148 |
+
}
|
| 149 |
+
}
|
widgets/woo/products-categories.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class Woo_Product_Categories extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Woo Product Categories - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('woo-product-categories', __('Woo Product Categories', 'elementor-addon-widgets'), $widget_ops);
|
| 18 |
$this->alt_option_name = 'woo_product_categories';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -49,29 +49,34 @@ class Woo_Product_Categories extends WP_Widget {
|
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
-
|
| 53 |
-
if ( '' == $title
|
| 54 |
$title = __( 'Shop By Categories', 'elementor-addon-widgets' );
|
|
|
|
| 55 |
|
| 56 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 3;
|
| 57 |
-
if ( '' == $limit )
|
| 58 |
$limit = 3;
|
|
|
|
| 59 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 3;
|
| 60 |
-
|
| 61 |
-
if ( '' == $columns )
|
| 62 |
-
$columns = 3;
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
'
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
echo $args['before_widget'];
|
| 73 |
-
//echo '<div class="widget-woo-categories">';
|
| 74 |
-
|
| 75 |
|
| 76 |
do_action( 'storepage_homepage_before_product_categories' );
|
| 77 |
|
|
@@ -79,18 +84,19 @@ class Woo_Product_Categories extends WP_Widget {
|
|
| 79 |
|
| 80 |
do_action( 'storepage_homepage_after_product_categories_title' );
|
| 81 |
|
| 82 |
-
echo eaw_do_shortcode(
|
| 83 |
-
'
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
| 88 |
|
| 89 |
do_action( 'storepage_homepage_after_product_categories' );
|
| 90 |
|
| 91 |
echo '</section>';
|
| 92 |
-
//echo '</div>';
|
| 93 |
-
|
| 94 |
echo $args['after_widget'];
|
| 95 |
|
| 96 |
if ( ! $this->is_preview() ) {
|
|
@@ -103,14 +109,15 @@ class Woo_Product_Categories extends WP_Widget {
|
|
| 103 |
|
| 104 |
public function update( $new_instance, $old_instance ) {
|
| 105 |
$instance = $old_instance;
|
| 106 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 107 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 108 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 109 |
$this->flush_widget_cache();
|
| 110 |
|
| 111 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 112 |
-
if ( isset($alloptions['woo_product_categories']) )
|
| 113 |
-
delete_option('woo_product_categories');
|
|
|
|
| 114 |
|
| 115 |
return $instance;
|
| 116 |
}
|
|
@@ -119,7 +126,7 @@ class Woo_Product_Categories extends WP_Widget {
|
|
| 119 |
* @access public
|
| 120 |
*/
|
| 121 |
public function flush_widget_cache() {
|
| 122 |
-
wp_cache_delete('woo_product_categories', 'widget');
|
| 123 |
}
|
| 124 |
|
| 125 |
/**
|
|
@@ -129,16 +136,16 @@ class Woo_Product_Categories extends WP_Widget {
|
|
| 129 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 130 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 3;
|
| 131 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 3;
|
| 132 |
-
|
| 133 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 134 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 135 |
|
| 136 |
-
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of categories to show:', 'elementor-addon-widgets'
|
| 137 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 138 |
|
| 139 |
-
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets'
|
| 140 |
-
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns ?>" size="3" /></p>
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
}
|
| 144 |
-
}
|
| 8 |
class Woo_Product_Categories extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'woo_product_categories',
|
| 13 |
+
'description' => __( 'Woo Product Categories - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'woo-product-categories', __( 'Woo Product Categories', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'woo_product_categories';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
+
|
| 53 |
+
if ( '' == $title ) {
|
| 54 |
$title = __( 'Shop By Categories', 'elementor-addon-widgets' );
|
| 55 |
+
}
|
| 56 |
|
| 57 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 3;
|
| 58 |
+
if ( '' == $limit ) {
|
| 59 |
$limit = 3;
|
| 60 |
+
}
|
| 61 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 3;
|
| 62 |
+
|
| 63 |
+
if ( '' == $columns ) {
|
| 64 |
+
$columns = 3;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$args = apply_filters(
|
| 68 |
+
'eaw_product_categories_args', array(
|
| 69 |
+
'limit' => $limit,
|
| 70 |
+
'columns' => $columns,
|
| 71 |
+
'child_categories' => 0,
|
| 72 |
+
'orderby' => 'name',
|
| 73 |
+
'title' => $title,
|
| 74 |
+
)
|
| 75 |
+
);
|
| 76 |
|
| 77 |
echo $args['before_widget'];
|
| 78 |
+
// echo '<div class="widget-woo-categories">';
|
| 79 |
+
echo '<section class="eaw-product-section widget-woo-categories">';
|
| 80 |
|
| 81 |
do_action( 'storepage_homepage_before_product_categories' );
|
| 82 |
|
| 84 |
|
| 85 |
do_action( 'storepage_homepage_after_product_categories_title' );
|
| 86 |
|
| 87 |
+
echo eaw_do_shortcode(
|
| 88 |
+
'product_categories', array(
|
| 89 |
+
'number' => intval( $args['limit'] ),
|
| 90 |
+
'columns' => intval( $args['columns'] ),
|
| 91 |
+
'orderby' => esc_attr( $args['orderby'] ),
|
| 92 |
+
'parent' => esc_attr( $args['child_categories'] ),
|
| 93 |
+
)
|
| 94 |
+
);
|
| 95 |
|
| 96 |
do_action( 'storepage_homepage_after_product_categories' );
|
| 97 |
|
| 98 |
echo '</section>';
|
| 99 |
+
// echo '</div>';
|
|
|
|
| 100 |
echo $args['after_widget'];
|
| 101 |
|
| 102 |
if ( ! $this->is_preview() ) {
|
| 109 |
|
| 110 |
public function update( $new_instance, $old_instance ) {
|
| 111 |
$instance = $old_instance;
|
| 112 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 113 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 114 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 115 |
$this->flush_widget_cache();
|
| 116 |
|
| 117 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 118 |
+
if ( isset( $alloptions['woo_product_categories'] ) ) {
|
| 119 |
+
delete_option( 'woo_product_categories' );
|
| 120 |
+
}
|
| 121 |
|
| 122 |
return $instance;
|
| 123 |
}
|
| 126 |
* @access public
|
| 127 |
*/
|
| 128 |
public function flush_widget_cache() {
|
| 129 |
+
wp_cache_delete( 'woo_product_categories', 'widget' );
|
| 130 |
}
|
| 131 |
|
| 132 |
/**
|
| 136 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 137 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 3;
|
| 138 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 3;
|
| 139 |
+
?>
|
| 140 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 141 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 142 |
|
| 143 |
+
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of categories to show:', 'elementor-addon-widgets' ); ?></label>
|
| 144 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 145 |
|
| 146 |
+
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
|
| 147 |
+
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 148 |
+
|
| 149 |
+
<?php
|
| 150 |
+
}
|
| 151 |
+
}
|
widgets/woo/recent-products.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class Woo_Recent_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Woo Recent Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('woo-recent-products', __('Woo Recent Products', 'elementor-addon-widgets'), $widget_ops);
|
| 18 |
$this->alt_option_name = 'woo_recent_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -49,27 +49,32 @@ class Woo_Recent_Products extends WP_Widget {
|
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
-
|
| 53 |
-
if ( '' == $title
|
| 54 |
$title = __( 'New In', 'elementor-addon-widgets' );
|
|
|
|
| 55 |
|
| 56 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 57 |
-
if ( '' == $limit )
|
| 58 |
$limit = 4;
|
|
|
|
| 59 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 60 |
-
|
| 61 |
-
if ( '' == $columns )
|
| 62 |
-
$columns = 4;
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
'
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
echo $args['before_widget'];
|
| 71 |
-
//echo '<div class="woo-recent-products">';
|
| 72 |
-
|
| 73 |
|
| 74 |
do_action( 'elementor-addon-widgets_homepage_before_recent_products' );
|
| 75 |
|
|
@@ -77,16 +82,17 @@ class Woo_Recent_Products extends WP_Widget {
|
|
| 77 |
|
| 78 |
do_action( 'elementor-addon-widgets_homepage_after_recent_products_title' );
|
| 79 |
|
| 80 |
-
echo eaw_do_shortcode(
|
| 81 |
-
'
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
|
| 85 |
do_action( 'elementor-addon-widgets_homepage_after_recent_products' );
|
| 86 |
|
| 87 |
echo '</section>';
|
| 88 |
-
//echo '</div>';
|
| 89 |
-
|
| 90 |
echo $args['after_widget'];
|
| 91 |
|
| 92 |
if ( ! $this->is_preview() ) {
|
|
@@ -99,14 +105,15 @@ class Woo_Recent_Products extends WP_Widget {
|
|
| 99 |
|
| 100 |
public function update( $new_instance, $old_instance ) {
|
| 101 |
$instance = $old_instance;
|
| 102 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 103 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 104 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 105 |
$this->flush_widget_cache();
|
| 106 |
|
| 107 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 108 |
-
if ( isset($alloptions['woo_recent_products']) )
|
| 109 |
-
delete_option('woo_recent_products');
|
|
|
|
| 110 |
|
| 111 |
return $instance;
|
| 112 |
}
|
|
@@ -115,7 +122,7 @@ class Woo_Recent_Products extends WP_Widget {
|
|
| 115 |
* @access public
|
| 116 |
*/
|
| 117 |
public function flush_widget_cache() {
|
| 118 |
-
wp_cache_delete('woo_recent_products', 'widget');
|
| 119 |
}
|
| 120 |
|
| 121 |
/**
|
|
@@ -125,17 +132,17 @@ class Woo_Recent_Products extends WP_Widget {
|
|
| 125 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 126 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 127 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 128 |
-
|
| 129 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 130 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 131 |
|
| 132 |
-
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets'
|
| 133 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 134 |
|
| 135 |
-
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets'
|
| 136 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
}
|
| 141 |
-
}
|
| 8 |
class Woo_Recent_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'woo_recent_products',
|
| 13 |
+
'description' => __( 'Woo Recent Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'woo-recent-products', __( 'Woo Recent Products', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'woo_recent_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
+
|
| 53 |
+
if ( '' == $title ) {
|
| 54 |
$title = __( 'New In', 'elementor-addon-widgets' );
|
| 55 |
+
}
|
| 56 |
|
| 57 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 58 |
+
if ( '' == $limit ) {
|
| 59 |
$limit = 4;
|
| 60 |
+
}
|
| 61 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 62 |
+
|
| 63 |
+
if ( '' == $columns ) {
|
| 64 |
+
$columns = 4;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$args = apply_filters(
|
| 68 |
+
'elementor-addon-widgets_product_categories_args', array(
|
| 69 |
+
'limit' => $limit,
|
| 70 |
+
'columns' => $columns,
|
| 71 |
+
'title' => $title,
|
| 72 |
+
)
|
| 73 |
+
);
|
| 74 |
|
| 75 |
echo $args['before_widget'];
|
| 76 |
+
// echo '<div class="woo-recent-products">';
|
| 77 |
+
echo '<section class="eaw-product-section woo-recent-products">';
|
| 78 |
|
| 79 |
do_action( 'elementor-addon-widgets_homepage_before_recent_products' );
|
| 80 |
|
| 82 |
|
| 83 |
do_action( 'elementor-addon-widgets_homepage_after_recent_products_title' );
|
| 84 |
|
| 85 |
+
echo eaw_do_shortcode(
|
| 86 |
+
'recent_products', array(
|
| 87 |
+
'per_page' => intval( $args['limit'] ),
|
| 88 |
+
'columns' => intval( $args['columns'] ),
|
| 89 |
+
)
|
| 90 |
+
);
|
| 91 |
|
| 92 |
do_action( 'elementor-addon-widgets_homepage_after_recent_products' );
|
| 93 |
|
| 94 |
echo '</section>';
|
| 95 |
+
// echo '</div>';
|
|
|
|
| 96 |
echo $args['after_widget'];
|
| 97 |
|
| 98 |
if ( ! $this->is_preview() ) {
|
| 105 |
|
| 106 |
public function update( $new_instance, $old_instance ) {
|
| 107 |
$instance = $old_instance;
|
| 108 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 109 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 110 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 111 |
$this->flush_widget_cache();
|
| 112 |
|
| 113 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 114 |
+
if ( isset( $alloptions['woo_recent_products'] ) ) {
|
| 115 |
+
delete_option( 'woo_recent_products' );
|
| 116 |
+
}
|
| 117 |
|
| 118 |
return $instance;
|
| 119 |
}
|
| 122 |
* @access public
|
| 123 |
*/
|
| 124 |
public function flush_widget_cache() {
|
| 125 |
+
wp_cache_delete( 'woo_recent_products', 'widget' );
|
| 126 |
}
|
| 127 |
|
| 128 |
/**
|
| 132 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 133 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 134 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 135 |
+
?>
|
| 136 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 137 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 138 |
|
| 139 |
+
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
|
| 140 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 141 |
|
| 142 |
+
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
|
| 143 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
<?php
|
| 147 |
+
}
|
| 148 |
+
}
|
widgets/woo/sale-products.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class Woo_Sale_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Woo On Sale Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('woo-sale-products', __('Woo On Sale Products', 'elementor-addon-widgets'), $widget_ops);
|
| 18 |
$this->alt_option_name = 'woo_sale_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -49,27 +49,32 @@ class Woo_Sale_Products extends WP_Widget {
|
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
-
|
| 53 |
-
if ( '' == $title
|
| 54 |
$title = __( 'On Sale', 'elementor-addon-widgets' );
|
|
|
|
| 55 |
|
| 56 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 57 |
-
if ( '' == $limit )
|
| 58 |
$limit = 4;
|
|
|
|
| 59 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 60 |
-
|
| 61 |
-
if ( '' == $columns )
|
| 62 |
-
$columns = 4;
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
'
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
echo $args['before_widget'];
|
| 71 |
-
//echo '<div class="woo-sale-products">';
|
| 72 |
-
|
| 73 |
|
| 74 |
do_action( 'storepage_homepage_before_on_sale_products' );
|
| 75 |
|
|
@@ -77,16 +82,17 @@ class Woo_Sale_Products extends WP_Widget {
|
|
| 77 |
|
| 78 |
do_action( 'storepage_homepage_after_on_sale_products_title' );
|
| 79 |
|
| 80 |
-
echo eaw_do_shortcode(
|
| 81 |
-
'
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
|
| 85 |
do_action( 'storepage_homepage_after_on_sale_products' );
|
| 86 |
|
| 87 |
echo '</section>';
|
| 88 |
-
//echo '</div>';
|
| 89 |
-
|
| 90 |
echo $args['after_widget'];
|
| 91 |
|
| 92 |
if ( ! $this->is_preview() ) {
|
|
@@ -99,14 +105,15 @@ class Woo_Sale_Products extends WP_Widget {
|
|
| 99 |
|
| 100 |
public function update( $new_instance, $old_instance ) {
|
| 101 |
$instance = $old_instance;
|
| 102 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 103 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 104 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 105 |
$this->flush_widget_cache();
|
| 106 |
|
| 107 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 108 |
-
if ( isset($alloptions['woo_sale_products']) )
|
| 109 |
-
delete_option('woo_sale_products');
|
|
|
|
| 110 |
|
| 111 |
return $instance;
|
| 112 |
}
|
|
@@ -115,7 +122,7 @@ class Woo_Sale_Products extends WP_Widget {
|
|
| 115 |
* @access public
|
| 116 |
*/
|
| 117 |
public function flush_widget_cache() {
|
| 118 |
-
wp_cache_delete('woo_sale_products', 'widget');
|
| 119 |
}
|
| 120 |
|
| 121 |
/**
|
|
@@ -125,17 +132,17 @@ class Woo_Sale_Products extends WP_Widget {
|
|
| 125 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 126 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 127 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 128 |
-
|
| 129 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 130 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 131 |
|
| 132 |
-
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets'
|
| 133 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 134 |
|
| 135 |
-
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets'
|
| 136 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
}
|
| 141 |
-
}
|
| 8 |
class Woo_Sale_Products extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'woo_sale_products',
|
| 13 |
+
'description' => __( 'Woo On Sale Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'woo-sale-products', __( 'Woo On Sale Products', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'woo_sale_products';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 49 |
|
| 50 |
$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
+
|
| 53 |
+
if ( '' == $title ) {
|
| 54 |
$title = __( 'On Sale', 'elementor-addon-widgets' );
|
| 55 |
+
}
|
| 56 |
|
| 57 |
$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
|
| 58 |
+
if ( '' == $limit ) {
|
| 59 |
$limit = 4;
|
| 60 |
+
}
|
| 61 |
$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
|
| 62 |
+
|
| 63 |
+
if ( '' == $columns ) {
|
| 64 |
+
$columns = 4;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$args = apply_filters(
|
| 68 |
+
'elementor-addon-widgets_product_categories_args', array(
|
| 69 |
+
'limit' => $limit,
|
| 70 |
+
'columns' => $columns,
|
| 71 |
+
'title' => $title,
|
| 72 |
+
)
|
| 73 |
+
);
|
| 74 |
|
| 75 |
echo $args['before_widget'];
|
| 76 |
+
// echo '<div class="woo-sale-products">';
|
| 77 |
+
echo '<section class="eaw-product-section woo-sale-products">';
|
| 78 |
|
| 79 |
do_action( 'storepage_homepage_before_on_sale_products' );
|
| 80 |
|
| 82 |
|
| 83 |
do_action( 'storepage_homepage_after_on_sale_products_title' );
|
| 84 |
|
| 85 |
+
echo eaw_do_shortcode(
|
| 86 |
+
'sale_products', array(
|
| 87 |
+
'per_page' => intval( $args['limit'] ),
|
| 88 |
+
'columns' => intval( $args['columns'] ),
|
| 89 |
+
)
|
| 90 |
+
);
|
| 91 |
|
| 92 |
do_action( 'storepage_homepage_after_on_sale_products' );
|
| 93 |
|
| 94 |
echo '</section>';
|
| 95 |
+
// echo '</div>';
|
|
|
|
| 96 |
echo $args['after_widget'];
|
| 97 |
|
| 98 |
if ( ! $this->is_preview() ) {
|
| 105 |
|
| 106 |
public function update( $new_instance, $old_instance ) {
|
| 107 |
$instance = $old_instance;
|
| 108 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 109 |
$instance['limit'] = (int) $new_instance['limit'];
|
| 110 |
$instance['columns'] = (int) ( $new_instance['columns'] );
|
| 111 |
$this->flush_widget_cache();
|
| 112 |
|
| 113 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 114 |
+
if ( isset( $alloptions['woo_sale_products'] ) ) {
|
| 115 |
+
delete_option( 'woo_sale_products' );
|
| 116 |
+
}
|
| 117 |
|
| 118 |
return $instance;
|
| 119 |
}
|
| 122 |
* @access public
|
| 123 |
*/
|
| 124 |
public function flush_widget_cache() {
|
| 125 |
+
wp_cache_delete( 'woo_sale_products', 'widget' );
|
| 126 |
}
|
| 127 |
|
| 128 |
/**
|
| 132 |
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
| 133 |
$limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
|
| 134 |
$columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
|
| 135 |
+
?>
|
| 136 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 137 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 138 |
|
| 139 |
+
<p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
|
| 140 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
|
| 141 |
|
| 142 |
+
<p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
|
| 143 |
<input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
<?php
|
| 147 |
+
}
|
| 148 |
+
}
|
widgets/wp/eaw-posts-widget-plus.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class EAW_Recent_Posts_Plus extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Recent posts with featured image - ideal for use with Elementor Page Builder plugin', '
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('eaw-recent-posts-plus', __('EAW: Elementor Posts By Category', '
|
| 18 |
$this->alt_option_name = 'widget_recent_entries_plus';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -51,49 +51,62 @@ class EAW_Recent_Posts_Plus extends WP_Widget {
|
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
|
| 53 |
$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 3;
|
| 54 |
-
if ( ! $number )
|
| 55 |
$number = 3;
|
| 56 |
-
|
|
|
|
| 57 |
$category = isset( $instance['category'] ) ? $instance['category'] : '';
|
| 58 |
-
|
| 59 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false;
|
| 60 |
$excerptcount = ( ! empty( $instance['excerptcount'] ) ) ? absint( $instance['excerptcount'] ) : 20;
|
| 61 |
-
|
| 62 |
-
if ( '' == $excerptcount || '0' == $excerptcount )
|
| 63 |
-
$excerptcount = 20;
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
</div>
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
}
|
| 99 |
|
|
@@ -107,7 +120,7 @@ class EAW_Recent_Posts_Plus extends WP_Widget {
|
|
| 107 |
|
| 108 |
public function update( $new_instance, $old_instance ) {
|
| 109 |
$instance = $old_instance;
|
| 110 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 111 |
$instance['number'] = (int) $new_instance['number'];
|
| 112 |
$instance['category'] = wp_strip_all_tags( $new_instance['category'] );
|
| 113 |
$instance['excerptcount'] = (int) ( $new_instance['excerptcount'] );
|
|
@@ -115,8 +128,9 @@ class EAW_Recent_Posts_Plus extends WP_Widget {
|
|
| 115 |
$this->flush_widget_cache();
|
| 116 |
|
| 117 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 118 |
-
if ( isset($alloptions['widget_recent_entries_plus']) )
|
| 119 |
-
delete_option('widget_recent_entries_plus');
|
|
|
|
| 120 |
|
| 121 |
return $instance;
|
| 122 |
}
|
|
@@ -125,7 +139,7 @@ class EAW_Recent_Posts_Plus extends WP_Widget {
|
|
| 125 |
* @access public
|
| 126 |
*/
|
| 127 |
public function flush_widget_cache() {
|
| 128 |
-
wp_cache_delete('widget_recent_posts_plus', 'widget');
|
| 129 |
}
|
| 130 |
|
| 131 |
/**
|
|
@@ -138,37 +152,39 @@ class EAW_Recent_Posts_Plus extends WP_Widget {
|
|
| 138 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false;
|
| 139 |
$category = isset( $instance['category'] ) ? $instance['category'] : '';
|
| 140 |
?>
|
| 141 |
-
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', '
|
| 142 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 143 |
|
| 144 |
-
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', '
|
| 145 |
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
| 146 |
|
| 147 |
<p>
|
| 148 |
-
<label for="rpjc_widget_cat_recent_posts_category"><?php _e( 'Category' ); ?>:</label>
|
| 149 |
|
| 150 |
<?php
|
| 151 |
|
| 152 |
-
wp_dropdown_categories(
|
|
|
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
|
|
|
| 162 |
|
| 163 |
?>
|
| 164 |
|
| 165 |
</p>
|
| 166 |
|
| 167 |
<p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
|
| 168 |
-
<label for="<?php echo $this->get_field_id( 'show_dexcerpt' ); ?>"><?php _e( 'Display post excerpt?', '
|
| 169 |
|
| 170 |
-
<p><label for="<?php echo $this->get_field_id( 'excerptcount' ); ?>"><?php _e( 'Excerpt length to show:', '
|
| 171 |
<input id="<?php echo $this->get_field_id( 'excerptcount' ); ?>" name="<?php echo $this->get_field_name( 'excerptcount' ); ?>" type="text" value="<?php echo $excerptcount; ?>" size="3" /></p>
|
| 172 |
<?php
|
| 173 |
-
}
|
| 174 |
-
}
|
| 8 |
class EAW_Recent_Posts_Plus extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'widget_recent_posts_plus',
|
| 13 |
+
'description' => __( 'Recent posts with featured image - ideal for use with Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'eaw-recent-posts-plus', __( 'EAW: Elementor Posts By Category', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'widget_recent_entries_plus';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
|
| 53 |
$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 3;
|
| 54 |
+
if ( ! $number ) {
|
| 55 |
$number = 3;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
$category = isset( $instance['category'] ) ? $instance['category'] : '';
|
| 59 |
+
|
| 60 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false;
|
| 61 |
$excerptcount = ( ! empty( $instance['excerptcount'] ) ) ? absint( $instance['excerptcount'] ) : 20;
|
| 62 |
+
|
| 63 |
+
if ( '' == $excerptcount || '0' == $excerptcount ) {
|
| 64 |
+
$excerptcount = 20;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
$eawp = new WP_Query(
|
| 68 |
+
apply_filters(
|
| 69 |
+
'eaw_widget_posts_plus_args', array(
|
| 70 |
+
'posts_per_page' => $number,
|
| 71 |
+
'cat' => $category,
|
| 72 |
+
'no_found_rows' => true,
|
| 73 |
+
'post_status' => 'publish',
|
| 74 |
+
'ignore_sticky_posts' => true,
|
| 75 |
+
)
|
| 76 |
+
)
|
| 77 |
+
);
|
| 78 |
+
|
| 79 |
+
if ( $eawp->have_posts() ) {
|
| 80 |
+
|
| 81 |
+
echo $args['before_widget'];
|
| 82 |
+
if ( $title ) {
|
| 83 |
+
echo $args['before_title'] . $title . $args['after_title'];
|
| 84 |
+
}
|
| 85 |
+
while ( $eawp->have_posts() ) :
|
| 86 |
+
$eawp->the_post(); ?>
|
| 87 |
+
<div class="eaw-recent-posts">
|
| 88 |
+
<?php
|
| 89 |
+
if ( has_post_thumbnail() ) {
|
| 90 |
+
the_post_thumbnail( 'medium' );
|
| 91 |
+
}
|
| 92 |
+
?>
|
| 93 |
+
<div class="eaw-content">
|
| 94 |
+
<h3><a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a></h3>
|
| 95 |
+
<p>
|
| 96 |
+
<?php
|
| 97 |
+
if ( $show_excerpt ) {
|
| 98 |
+
echo wp_trim_words( get_the_excerpt(), $excerptcount, ' …' );
|
| 99 |
+
}
|
| 100 |
+
?>
|
| 101 |
+
</p>
|
| 102 |
+
</div>
|
| 103 |
</div>
|
| 104 |
+
<?php
|
| 105 |
+
endwhile;
|
| 106 |
+
|
| 107 |
+
echo $args['after_widget'];
|
| 108 |
|
| 109 |
+
wp_reset_postdata();
|
| 110 |
|
| 111 |
}
|
| 112 |
|
| 120 |
|
| 121 |
public function update( $new_instance, $old_instance ) {
|
| 122 |
$instance = $old_instance;
|
| 123 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 124 |
$instance['number'] = (int) $new_instance['number'];
|
| 125 |
$instance['category'] = wp_strip_all_tags( $new_instance['category'] );
|
| 126 |
$instance['excerptcount'] = (int) ( $new_instance['excerptcount'] );
|
| 128 |
$this->flush_widget_cache();
|
| 129 |
|
| 130 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 131 |
+
if ( isset( $alloptions['widget_recent_entries_plus'] ) ) {
|
| 132 |
+
delete_option( 'widget_recent_entries_plus' );
|
| 133 |
+
}
|
| 134 |
|
| 135 |
return $instance;
|
| 136 |
}
|
| 139 |
* @access public
|
| 140 |
*/
|
| 141 |
public function flush_widget_cache() {
|
| 142 |
+
wp_cache_delete( 'widget_recent_posts_plus', 'widget' );
|
| 143 |
}
|
| 144 |
|
| 145 |
/**
|
| 152 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false;
|
| 153 |
$category = isset( $instance['category'] ) ? $instance['category'] : '';
|
| 154 |
?>
|
| 155 |
+
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 156 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 157 |
|
| 158 |
+
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'elementor-addon-widgets' ); ?></label>
|
| 159 |
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
| 160 |
|
| 161 |
<p>
|
| 162 |
+
<label for="rpjc_widget_cat_recent_posts_category"><?php _e( 'Category', 'elementor-addon-widgets' ); ?>:</label>
|
| 163 |
|
| 164 |
<?php
|
| 165 |
|
| 166 |
+
wp_dropdown_categories(
|
| 167 |
+
array(
|
| 168 |
|
| 169 |
+
'orderby' => 'title',
|
| 170 |
+
'hide_empty' => false,
|
| 171 |
+
'name' => $this->get_field_name( 'category' ),
|
| 172 |
+
'id' => 'rpjc_widget_cat_recent_posts_category',
|
| 173 |
+
'class' => 'widefat',
|
| 174 |
+
'selected' => $category,
|
| 175 |
|
| 176 |
+
)
|
| 177 |
+
);
|
| 178 |
|
| 179 |
?>
|
| 180 |
|
| 181 |
</p>
|
| 182 |
|
| 183 |
<p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
|
| 184 |
+
<label for="<?php echo $this->get_field_id( 'show_dexcerpt' ); ?>"><?php _e( 'Display post excerpt?', 'elementor-addon-widgets' ); ?></label></p>
|
| 185 |
|
| 186 |
+
<p><label for="<?php echo $this->get_field_id( 'excerptcount' ); ?>"><?php _e( 'Excerpt length to show:', 'elementor-addon-widgets' ); ?></label>
|
| 187 |
<input id="<?php echo $this->get_field_id( 'excerptcount' ); ?>" name="<?php echo $this->get_field_name( 'excerptcount' ); ?>" type="text" value="<?php echo $excerptcount; ?>" size="3" /></p>
|
| 188 |
<?php
|
| 189 |
+
}
|
| 190 |
+
}
|
widgets/wp/eaw-posts-widget.php
CHANGED
|
@@ -8,13 +8,13 @@
|
|
| 8 |
class EAW_Recent_Posts extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
-
$widget_ops = array(
|
| 12 |
-
|
| 13 |
-
'description' => __( 'Recent posts with featured image - ideal for use with Elementor Page Builder plugin', '
|
| 14 |
-
|
| 15 |
);
|
| 16 |
-
|
| 17 |
-
parent::__construct('eaw-recent-posts', __('EAW: Elementor Recent Posts', '
|
| 18 |
$this->alt_option_name = 'widget_recent_entries';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
|
@@ -51,45 +51,58 @@ class EAW_Recent_Posts extends WP_Widget {
|
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
|
| 53 |
$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 3;
|
| 54 |
-
if ( ! $number )
|
| 55 |
$number = 3;
|
|
|
|
| 56 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false;
|
| 57 |
$excerptcount = ( ! empty( $instance['excerptcount'] ) ) ? absint( $instance['excerptcount'] ) : 20;
|
| 58 |
-
|
| 59 |
-
if ( '' == $excerptcount || '0' == $excerptcount )
|
| 60 |
-
$excerptcount = 20;
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
</div>
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
echo $args['after_widget'];
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
| 93 |
|
| 94 |
}
|
| 95 |
|
|
@@ -103,15 +116,16 @@ class EAW_Recent_Posts extends WP_Widget {
|
|
| 103 |
|
| 104 |
public function update( $new_instance, $old_instance ) {
|
| 105 |
$instance = $old_instance;
|
| 106 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 107 |
$instance['number'] = (int) $new_instance['number'];
|
| 108 |
$instance['excerptcount'] = (int) ( $new_instance['excerptcount'] );
|
| 109 |
$instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? (bool) $new_instance['show_excerpt'] : false;
|
| 110 |
$this->flush_widget_cache();
|
| 111 |
|
| 112 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 113 |
-
if ( isset($alloptions['widget_recent_entries']) )
|
| 114 |
-
delete_option('widget_recent_entries');
|
|
|
|
| 115 |
|
| 116 |
return $instance;
|
| 117 |
}
|
|
@@ -120,7 +134,7 @@ class EAW_Recent_Posts extends WP_Widget {
|
|
| 120 |
* @access public
|
| 121 |
*/
|
| 122 |
public function flush_widget_cache() {
|
| 123 |
-
wp_cache_delete('widget_recent_posts', 'widget');
|
| 124 |
}
|
| 125 |
|
| 126 |
/**
|
|
@@ -132,17 +146,17 @@ class EAW_Recent_Posts extends WP_Widget {
|
|
| 132 |
$excerptcount = isset( $instance['excerptcount '] ) ? absint( $instance['excerptcount '] ) : 20;
|
| 133 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false;
|
| 134 |
?>
|
| 135 |
-
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', '
|
| 136 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 137 |
|
| 138 |
-
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', '
|
| 139 |
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
| 140 |
|
| 141 |
<p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
|
| 142 |
-
<label for="<?php echo $this->get_field_id( 'show_dexcerpt' ); ?>"><?php _e( 'Display post excerpt?', '
|
| 143 |
|
| 144 |
-
<p><label for="<?php echo $this->get_field_id( 'excerptcount' ); ?>"><?php _e( 'Excerpt length to show:', '
|
| 145 |
<input id="<?php echo $this->get_field_id( 'excerptcount' ); ?>" name="<?php echo $this->get_field_name( 'excerptcount' ); ?>" type="text" value="<?php echo $excerptcount; ?>" size="3" /></p>
|
| 146 |
<?php
|
| 147 |
-
}
|
| 148 |
-
}
|
| 8 |
class EAW_Recent_Posts extends WP_Widget {
|
| 9 |
|
| 10 |
public function __construct() {
|
| 11 |
+
$widget_ops = array(
|
| 12 |
+
'classname' => 'widget_recent_posts',
|
| 13 |
+
'description' => __( 'Recent posts with featured image - ideal for use with Elementor Page Builder plugin', 'elementor-addon-widgets' ),
|
| 14 |
+
'customize_selective_refresh' => true,
|
| 15 |
);
|
| 16 |
+
|
| 17 |
+
parent::__construct( 'eaw-recent-posts', __( 'EAW: Elementor Recent Posts', 'elementor-addon-widgets' ), $widget_ops );
|
| 18 |
$this->alt_option_name = 'widget_recent_entries';
|
| 19 |
|
| 20 |
add_action( 'save_post', array($this, 'flush_widget_cache') );
|
| 51 |
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
| 52 |
|
| 53 |
$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 3;
|
| 54 |
+
if ( ! $number ) {
|
| 55 |
$number = 3;
|
| 56 |
+
}
|
| 57 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false;
|
| 58 |
$excerptcount = ( ! empty( $instance['excerptcount'] ) ) ? absint( $instance['excerptcount'] ) : 20;
|
| 59 |
+
|
| 60 |
+
if ( '' == $excerptcount || '0' == $excerptcount ) {
|
| 61 |
+
$excerptcount = 20;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
$eawp = new WP_Query(
|
| 65 |
+
apply_filters(
|
| 66 |
+
'eaw_widget_posts_args', array(
|
| 67 |
+
'posts_per_page' => $number,
|
| 68 |
+
'no_found_rows' => true,
|
| 69 |
+
'post_status' => 'publish',
|
| 70 |
+
'ignore_sticky_posts' => true,
|
| 71 |
+
)
|
| 72 |
+
)
|
| 73 |
+
);
|
| 74 |
+
|
| 75 |
+
if ( $eawp->have_posts() ) {
|
| 76 |
+
|
| 77 |
+
echo $args['before_widget'];
|
| 78 |
+
if ( $title ) {
|
| 79 |
+
echo $args['before_title'] . $title . $args['after_title'];
|
| 80 |
+
}
|
| 81 |
+
while ( $eawp->have_posts() ) :
|
| 82 |
+
$eawp->the_post(); ?>
|
| 83 |
+
<div class="eaw-recent-posts">
|
| 84 |
+
<?php
|
| 85 |
+
if ( has_post_thumbnail() ) {
|
| 86 |
+
the_post_thumbnail( 'medium' );
|
| 87 |
+
}
|
| 88 |
+
?>
|
| 89 |
+
<div class="eaw-content">
|
| 90 |
+
<h3><a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a></h3>
|
| 91 |
+
<p>
|
| 92 |
+
<?php
|
| 93 |
+
if ( $show_excerpt ) {
|
| 94 |
+
echo wp_trim_words( get_the_excerpt(), $excerptcount, ' …' );
|
| 95 |
+
}
|
| 96 |
+
?>
|
| 97 |
+
</p>
|
| 98 |
+
</div>
|
| 99 |
</div>
|
| 100 |
+
<?php
|
| 101 |
+
endwhile;
|
|
|
|
|
|
|
| 102 |
|
| 103 |
+
echo $args['after_widget'];
|
| 104 |
+
|
| 105 |
+
wp_reset_postdata();
|
| 106 |
|
| 107 |
}
|
| 108 |
|
| 116 |
|
| 117 |
public function update( $new_instance, $old_instance ) {
|
| 118 |
$instance = $old_instance;
|
| 119 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 120 |
$instance['number'] = (int) $new_instance['number'];
|
| 121 |
$instance['excerptcount'] = (int) ( $new_instance['excerptcount'] );
|
| 122 |
$instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? (bool) $new_instance['show_excerpt'] : false;
|
| 123 |
$this->flush_widget_cache();
|
| 124 |
|
| 125 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
| 126 |
+
if ( isset( $alloptions['widget_recent_entries'] ) ) {
|
| 127 |
+
delete_option( 'widget_recent_entries' );
|
| 128 |
+
}
|
| 129 |
|
| 130 |
return $instance;
|
| 131 |
}
|
| 134 |
* @access public
|
| 135 |
*/
|
| 136 |
public function flush_widget_cache() {
|
| 137 |
+
wp_cache_delete( 'widget_recent_posts', 'widget' );
|
| 138 |
}
|
| 139 |
|
| 140 |
/**
|
| 146 |
$excerptcount = isset( $instance['excerptcount '] ) ? absint( $instance['excerptcount '] ) : 20;
|
| 147 |
$show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false;
|
| 148 |
?>
|
| 149 |
+
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
|
| 150 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
| 151 |
|
| 152 |
+
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'elementor-addon-widgets' ); ?></label>
|
| 153 |
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
|
| 154 |
|
| 155 |
<p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
|
| 156 |
+
<label for="<?php echo $this->get_field_id( 'show_dexcerpt' ); ?>"><?php _e( 'Display post excerpt?', 'elementor-addon-widgets' ); ?></label></p>
|
| 157 |
|
| 158 |
+
<p><label for="<?php echo $this->get_field_id( 'excerptcount' ); ?>"><?php _e( 'Excerpt length to show:', 'elementor-addon-widgets' ); ?></label>
|
| 159 |
<input id="<?php echo $this->get_field_id( 'excerptcount' ); ?>" name="<?php echo $this->get_field_name( 'excerptcount' ); ?>" type="text" value="<?php echo $excerptcount; ?>" size="3" /></p>
|
| 160 |
<?php
|
| 161 |
+
}
|
| 162 |
+
}
|
