-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickloop-carousel.php
More file actions
107 lines (97 loc) · 2.6 KB
/
quickloop-carousel.php
File metadata and controls
107 lines (97 loc) · 2.6 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
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
<?php
/**
* Plugin Name: QuickLoop Carousel
* Plugin URI: https://github.com/yourusername/quickloop-carousel
* Description: A lightweight, simple carousel plugin for WordPress. Display beautiful image carousels using an easy shortcode.
* Version: 1.2.0
* Author: Hrishikesh Das
* Author URI: https://yourwebsite.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: quickloop-carousel
* Domain Path: /languages
* Requires at least: 5.0
* Requires PHP: 7.0
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Define plugin constants
define( 'QLC_VERSION', '1.2.0' );
define( 'QLC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'QLC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'QLC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
/**
* Load plugin text domain for translations
*/
function qlc_load_textdomain() {
load_plugin_textdomain( 'quickloop-carousel', false, dirname( QLC_PLUGIN_BASENAME ) . '/languages' );
}
add_action( 'plugins_loaded', 'qlc_load_textdomain' );
/**
* Include required files
*/
require_once QLC_PLUGIN_DIR . 'includes/class-carousel-renderer.php';
require_once QLC_PLUGIN_DIR . 'includes/class-carousel-shortcode.php';
require_once QLC_PLUGIN_DIR . 'includes/class-carousel-settings.php';
require_once QLC_PLUGIN_DIR . 'includes/class-carousel-block.php';
/**
* Enqueue plugin styles
*/
function qlc_enqueue_styles() {
wp_enqueue_style(
'quickloop-carousel',
QLC_PLUGIN_URL . 'assets/css/carousel.css',
array(),
QLC_VERSION,
'all'
);
// Enqueue Swiper CSS from CDN
wp_enqueue_style(
'swiper',
'https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css',
array(),
'11.0.0',
'all'
);
}
add_action( 'wp_enqueue_scripts', 'qlc_enqueue_styles' );
/**
* Enqueue plugin scripts
*/
function qlc_enqueue_scripts() {
// Enqueue Swiper JS from CDN
wp_enqueue_script(
'swiper',
'https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js',
array(),
'11.0.0',
true
);
// Enqueue our carousel initialization script
wp_enqueue_script(
'quickloop-carousel',
QLC_PLUGIN_URL . 'assets/js/carousel.js',
array( 'swiper' ),
QLC_VERSION,
true
);
}
add_action( 'wp_enqueue_scripts', 'qlc_enqueue_scripts' );
/**
* Plugin activation hook
*/
function qlc_activate() {
// Flush rewrite rules on activation
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'qlc_activate' );
/**
* Plugin deactivation hook
*/
function qlc_deactivate() {
// Flush rewrite rules on deactivation
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'qlc_deactivate' );