Custom/Dynamic CSS in TinyMCE
-
I’m trying to add custom CSS (set via theme options) to the TinyMCE visual editor in WordPress. On the front end, the theme generates this CSS and outputs it on the
wp_head
hook. The problem I’m running into is being able to add that CSS output to the editor.This can’t be done with
add_editor_style( 'editor-style.css' )
. It’s output via PHP.As an example of how it works on the front end:
add_action( 'wp_head', 'my_custom_colors' ); function my_custom_colors() { $color_1 = get_theme_mod( 'color_1', 'cc4a00' ); echo "<style type='text/css'>a { color: #{$color_1}; }"; }
I need a method for inserting that into the visual editor. Any help would be greatly appreciated.
- The topic ‘Custom/Dynamic CSS in TinyMCE’ is closed to new replies.