forked from movablebrains/recommendwp-widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathra-widgets-bundle.php
50 lines (40 loc) · 1.6 KB
/
ra-widgets-bundle.php
1
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
<?php
/*
Plugin Name: RA Widgets Bundle
Plugin URI: https://github.com/webdevsuperfast/ra-widgets-bundle
Description: A collection of widgets for WordPress built using the SiteOrigin Widgets API.
Version: 1.0.3
Author: Rotsen Mark Acob
Author URI: https://webdevsuperfast.github.io
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ra-widgets-bundle
Domain Path: /languages
*/
defined( 'ABSPATH' ) or die( esc_html_e( 'With great power comes great responsibility.', 'ra-widgets-bundle' ) );
class RAWB_Widgets_Bundle {
public function __construct() {
// Enqueue Scripts
add_action( 'wp_enqueue_scripts', array( $this, 'rawb_enqueue_scripts' ) );
// Add widgets folder to SiteOrigin Widgets
add_filter( 'siteorigin_widgets_widget_folders', array( $this, 'rawb_widget_folders' ) );
//* Require if mr_image_resize function exists
require_once( plugin_dir_path( __FILE__ ) . 'lib/misc.php' );
}
public function rawb_enqueue_scripts() {
if ( ! is_admin() ) {
// Widget CSS
wp_register_style( 'rawb-css', plugin_dir_url( __FILE__ ) . 'public/css/widget.css' );
wp_enqueue_style( 'rawb-css' );
// Owl Carousel JS
wp_register_script( 'rawb-owl-carousel-js', plugin_dir_url( __FILE__ ) . 'public/js/owl.carousel.min.js', array( 'jquery' ), null, true );
// Widget JS
wp_register_script( 'rawb-widgets-js', plugin_dir_url( __FILE__ ) . 'public/js/widget.min.js', array( 'jquery' ), null, true );
}
}
public function rawb_widget_folders( $folders ) {
$folders[] = plugin_dir_path( __FILE__ ) . 'widgets/';
return $folders;
}
}
new RAWB_Widgets_Bundle();