-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
52 lines (47 loc) · 1.37 KB
/
Copy pathindex.php
File metadata and controls
52 lines (47 loc) · 1.37 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
<?php
/**
* Plugin name: Box e Olho.
* Description: Gera marcarção no editor para estilizar <div> com as classes "olho" e "box" .
* Version: 1.0
* Plugin URI: https://github.com/andrekeher/wp-box-e-olho
* Author: André Keher
* Author URI: https://github.com/andrekeher
*/
class CustomTinyMCE
{
public function __construct()
{
$file = 'editor-style.css';
if (file_exists($editorStyle))
{
add_editor_style(get_template_directory_uri() . '/' . $file);
}
add_filter('mce_buttons_2', array($this, 'tinymce_buttons'));
add_filter('tiny_mce_before_init', array($this, 'tinymce_settings'));
}
function tinymce_buttons($buttons)
{
array_unshift($buttons, 'styleselect');
return $buttons;
}
public function tinymce_settings($settings)
{
$style_formats = array(
array(
'title' => 'Box',
'block' => 'div',
'classes' => array('box'),
'wrapper' => true,
),
array(
'title' => 'Olho',
'block' => 'div',
'classes' => array('olho'),
'wrapper' => true,
),
);
$settings['style_formats'] = json_encode($style_formats);
return $settings;
}
}
$objCTMCE = new CustomTinyMCE();