forked from billerickson/EA-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtinymce.php
58 lines (55 loc) · 1.16 KB
/
tinymce.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
51
52
53
54
55
56
57
58
<?php
/**
* TinyMCE Customizations
*
* @package EAStarter
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
**/
/**
* Add "Styles" drop-down to TinyMCE
*
* @since 1.0.0
* @param array $buttons
* @return array
*/
function ea_mce_editor_buttons( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'mce_buttons_2', 'ea_mce_editor_buttons' );
/**
* Add styles/classes to the TinyMCE "Formats" drop-down
*
* @since 1.0.0
* @param array $settings
* @return array
*/
function ea_mce_before_init( $settings ) {
$style_formats = array(
array(
'title' => 'Button',
'selector' => 'a',
'classes' => 'button',
),
array(
'title' => 'Large Paragraph',
'selector' => 'p',
'classes' => 'large',
),
array(
'title' => 'Small Paragraph',
'selector' => 'p',
'classes' => 'small',
),
array(
'title' => 'Extra Margin Paragraph',
'selector' => 'p',
'classes' => 'extra-margin',
)
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}
add_filter( 'tiny_mce_before_init', 'ea_mce_before_init' );