如何应用自己的css(以匹配editor-style.css
) 到wp_editor
在前端用于评论?
目前我正在使用code from here 启用注释的可视化编辑器。
我的实际代码functions.php
:
add_filter( \'comment_form_defaults\', \'custom_comment_form_defaults\' );
function custom_comment_form_defaults( $args ) {
if ( is_user_logged_in() ) {
$mce_plugins = \'inlinepopups, wordpress, wplink, wpdialogs\';
} else {
$mce_plugins = \'fullscreen, wordpress\';
}
add_filter( \'wp_default_editor\', create_function(\'\', \'return "tinymce";\') );
ob_start();
wp_editor( \'\', \'comment\', array(
\'media_buttons\' => false,
\'teeny\' => true,
\'textarea_rows\' => \'7\',
\'tinymce\' => array( \'plugins\' => $mce_plugins ),
\'editor_css\' => \'<style> p { font-family: Arial } </style>\'
) );
$args[\'comment_field\'] = ob_get_clean();
return $args;
}
正如你在代码中看到的,我将css样式传递到wp_editor
使用editor_css
param,但是它在iframe
所以它没有影响。您可以看到样式声明和iframein the source here.