Skip to content

Commit

Permalink
Fix: fix use of the add_editor_style wp function : needs relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
eri-trabiccolo committed Jun 9, 2017
1 parent 203b36c commit 532297c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
20 changes: 13 additions & 7 deletions core/_back/class-fire-admin_init.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function __construct () {
//enqueue additional styling for admin screens
add_action( 'admin_init' , array( $this, 'czr_fn_admin_style' ) );

//Load the editor-style specific (post formats and RTL), the active skin, the user style.css
//Load the editor-style specific (post formats and RTL), the user style.css, the active skin
//add user defined fonts in the editor style (@see the query args add_editor_style below)
add_action( 'after_setup_theme' , array( $this, 'czr_fn_add_editor_style') );

Expand Down Expand Up @@ -205,13 +205,19 @@ function czr_fn_extract_changelog() {
*
*/
function czr_fn_add_editor_style() {

$_stylesheets = array_filter( array(
CZR_BASE_URL . CZR_ASSETS_PREFIX . 'back/css/editor-style.css',
//array_filter to remove empty array items is not needed as wp function get_editor_stylesheets() (since WP 4.0)
//will do that for us

$_stylesheets = array(
//we need only the relative path, otherwise get_editor_stylesheets() will treat this as external CSS
//which means:
//a) child-themes cannot override it
//b) no check on the file existence will be made (producing the rtl error, for instance : https://github.com/presscustomizr/customizr/issues/926)
CZR_ASSETS_PREFIX . 'back/css/editor-style.css',
'style.css',
//backward compat
! ( defined( 'CZR_IS_MODERN_STYLE' ) && CZR_IS_MODERN_STYLE ) ? CZR_init::$instance -> czr_fn_get_style_src() : '',
get_stylesheet_uri()
) );
! ( defined( 'CZR_IS_MODERN_STYLE' ) && CZR_IS_MODERN_STYLE ) ? 'inc/assets/css/' . esc_attr( czr_fn_opt( 'tc_skin' ) ) : '',
);


if ( apply_filters( 'czr_add_custom_fonts_to_editor' , false != $this -> czr_fn_maybe_add_gfonts_to_editor() ) )
Expand Down
20 changes: 13 additions & 7 deletions core/czr-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function __construct () {
//enqueue additional styling for admin screens
add_action( 'admin_init' , array( $this, 'czr_fn_admin_style' ) );

//Load the editor-style specific (post formats and RTL), the active skin, the user style.css
//Load the editor-style specific (post formats and RTL), the user style.css, the active skin
//add user defined fonts in the editor style (@see the query args add_editor_style below)
add_action( 'after_setup_theme' , array( $this, 'czr_fn_add_editor_style') );

Expand Down Expand Up @@ -205,13 +205,19 @@ function czr_fn_extract_changelog() {
*
*/
function czr_fn_add_editor_style() {

$_stylesheets = array_filter( array(
CZR_BASE_URL . CZR_ASSETS_PREFIX . 'back/css/editor-style.css',
//array_filter to remove empty array items is not needed as wp function get_editor_stylesheets() (since WP 4.0)
//will do that for us

$_stylesheets = array(
//we need only the relative path, otherwise get_editor_stylesheets() will treat this as external CSS
//which means:
//a) child-themes cannot override it
//b) no check on the file existence will be made (producing the rtl error, for instance : https://github.com/presscustomizr/customizr/issues/926)
CZR_ASSETS_PREFIX . 'back/css/editor-style.css',
'style.css',
//backward compat
! ( defined( 'CZR_IS_MODERN_STYLE' ) && CZR_IS_MODERN_STYLE ) ? CZR_init::$instance -> czr_fn_get_style_src() : '',
get_stylesheet_uri()
) );
! ( defined( 'CZR_IS_MODERN_STYLE' ) && CZR_IS_MODERN_STYLE ) ? 'inc/assets/css/' . esc_attr( czr_fn_opt( 'tc_skin' ) ) : '',
);


if ( apply_filters( 'czr_add_custom_fonts_to_editor' , false != $this -> czr_fn_maybe_add_gfonts_to_editor() ) )
Expand Down

0 comments on commit 532297c

Please sign in to comment.