0
我使用強制摘錄代碼自動生成摘錄的內容,而無需使用多個標籤或摘錄編輯器對話框中的functions.php如下:的WordPress如何添加TinyMCE的格式排功能後> ID摘錄過濾
function mytheme_excerpt_read_more_link($output) {
global $post;
return $output . ' <div class="more-link">
<a href="' . get_permalink($post->ID) . '>Read More</a></div>';
}
add_filter('the_excerpt', 'mytheme_excerpt_read_more_link');
但是,我需要添加TinyMCE函數,以便如果某人在編輯器中添加斜體(例如),<em>
將在摘錄代碼中選取。
這是我定製TinyMCE的:
add_filter('mce_buttons', 'mrw_mce_buttons_1');
function mrw_mce_buttons_1($buttons) {
$buttons = array('styleselect', 'bold', 'italic',
'link', 'unlink', 'bullist', 'numlist', 'indent',
'outdent', 'pastetext', 'removeformat', 'charmap',
'undo', 'redo', 'wp_more','wp_help', );
return $buttons;
}
怎樣上述過濾器添加到後> ID?我試過,但沒有奏效:
function my_theme_add_tinymce_styles() {
global $post;
$post_type = get_post_type($post->ID);
$tinymce_style = 'mrw_mce_buttons_1';
add_editor_style($tinymce_style);
}
add_action('pre_get_posts', 'my_theme_add_tinymce_styles');
感謝 查爾斯