-
Notifications
You must be signed in to change notification settings - Fork 0
/
adds to excerpt tiny emc editor
56 lines (52 loc) · 1.24 KB
/
adds to excerpt tiny emc editor
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
/**
* Replaces the default excerpt editor with TinyMCE.
*/
class T5_Richtext_Excerpt
{
public static function switch_boxes()
{
if ( ! post_type_supports( $GLOBALS['post']->post_type, 'excerpt' ) )
{
return;
}
remove_meta_box(
'postexcerpt'
, ''
, 'normal'
);
add_meta_box(
'postexcerpt2'
, __( 'Excerpt' )
, array ( __CLASS__, 'show' )
, null
, 'normal'
, 'core'
);
}
public static function show( $post )
{
?>
<label class="screen-reader-text" for="excerpt"><?php
_e( 'Excerpt' )
?></label>
<?php
wp_editor(
self::unescape( $post->post_excerpt ),
'excerpt',
array (
'textarea_rows' => 15
, 'media_buttons' => FALSE
, 'teeny' => TRUE
, 'tinymce' => TRUE
)
);
}
public static function unescape( $str )
{
return str_replace(
array ( '<', '>', '"', '&', ' ', '&nbsp;' )
, array ( '<', '>', '"', '&', ' ', ' ' )
, $str
);
}
}