-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmce-editor-dropdown.php
52 lines (37 loc) · 1.29 KB
/
mce-editor-dropdown.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
// Adding more options to MCE Editor in Wordpress (for example adding another style to the headings drop down)
<?php
function my_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );
function my_tiny_mce_before_init( $mceInit ) {
$style_formats = array(
array(
'title' => 'Text Options',
'items' => array(
array(
'title' => 'H2-Header',
'block' => 'span',
'classes' => 'h2-header',
'wrapper' => true,
),
array(
'title' => 'Paragraph - Big',
'block' => 'span',
'classes' => 'paragraph-big',
'wrapper' => true,
),
array(
'title' => 'Unordered list - Big',
'block' => 'span',
'classes' => 'list-big',
'wrapper' => true,
)
)
)
);
$mceInit['style_formats'] = json_encode( $style_formats );
return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'my_tiny_mce_before_init' );