Created
July 13, 2016 04:30
-
-
Save mathetos/a01bc6643420cef9355ee7b6eed09748 to your computer and use it in GitHub Desktop.
Generating dynamic Editor Styles for the WordPress editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Dynamic Editor Styles | |
* | |
* Add this file to your theme with the add_editor_style() function | |
* The header and Path information will force the file to be treated like a CSS stylesheet | |
* More info on this here: https://css-tricks.com/css-variables-with-php/ | |
*/ | |
header("Content-type: text/css; charset: UTF-8"); | |
header('Cache-control: must-revalidate'); | |
$absolute_path = explode('wp-content', $_SERVER['SCRIPT_FILENAME']); | |
$wp_load = $absolute_path[0] . 'wp-load.php'; | |
require_once($wp_load); | |
$backgroundcolor = get_theme_mod( 'page_background_color' ); | |
$maincolor = get_theme_mod( 'main_text_color' ); | |
$contentcolor = get_theme_mod( 'content_title_color' ); | |
?> | |
body#tinymce { | |
background-color: <?php echo $backgroundcolor; ?> | |
} | |
p.block-text { | |
color: <?php echo $maincolor; ?>; | |
border-color: <?php echo $contentcolor; ?>; | |
} | |
<?php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment