-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext-wrapper.php
More file actions
36 lines (33 loc) · 811 Bytes
/
text-wrapper.php
File metadata and controls
36 lines (33 loc) · 811 Bytes
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
<?php
/**
* Plugin Name: Text Wrapper
* Description: Adds a custom button to WordPress and ACF WYSIWYG editors to wrap selected text with a customizable tag and class.
* Version: 1.0
* Author: JD Ahir
* Text Domain: text-wrapper
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
* @package Text_Wrapper
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
spl_autoload_register(
function ( $class ) {
if ( strpos( $class, 'Text_Wrapper' ) === 0 ) {
$filename = plugin_dir_path( __FILE__ ) . 'includes/class-' . strtolower( str_replace( '_', '-', $class ) ) . '.php';
if ( file_exists( $filename ) ) {
include $filename;
}
}
}
);
add_action(
'plugins_loaded',
function () {
if ( class_exists( 'Text_Wrapper' ) ) {
new Text_Wrapper();
}
}
);