forked from movablebrains/recommendwp-widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathra-widgets-bundle.php
More file actions
82 lines (71 loc) · 2.07 KB
/
ra-widgets-bundle.php
File metadata and controls
82 lines (71 loc) · 2.07 KB
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
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
<?php
/**
* RA Widgets Bundle
*
* @package RA_Widgets_Bundle
* @author Rotsen Mark Acob
* @copyright Copyright (c) 2026 Rotsen Mark Acob
* @license GPL-2.0-or-later
*
* 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: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: ra-widgets-bundle
* Domain Path: /languages
*/
/**
* RA Widgets Bundle
*
* Main plugin bootstrap for RA Widgets Bundle.
*
* @package RA_Widgets_Bundle
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Main plugin class.
*/
class RAWB_Widgets_Bundle {
/**
* RAWB_Widgets_Bundle constructor.
*/
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 misc helpers.
require_once plugin_dir_path( __FILE__ ) . 'lib/misc.php';
}
/**
* Register/enqueue frontend assets.
*/
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 );
}
}
/**
* Add widget folder to SiteOrigin registered folders.
*
* @param array $folders Existing folders.
* @return array
*/
public function rawb_widget_folders( $folders ) {
$folders[] = plugin_dir_path( __FILE__ ) . 'widgets/';
return $folders;
}
}
new RAWB_Widgets_Bundle();