'. str_replace( array( "\n", "\t", "\r" ), '', $css ) .''; echo trim( $css ); // WPCS: XSS ok. } } /** * Header style callback. * * @return string css */ public static function header_style() { $header_text_color = get_header_textcolor(); /* * If no custom options for text are set, let's bail. * get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ). */ if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { return; } // If we get this far, we have custom styles. Let's do this. $css = ''; if ( ! display_header_text() ) { $css .= ' .site-title, .site-description { position: absolute; clip: rect(1px, 1px, 1px, 1px); } '; } if ( ! empty( $css ) ) { return trim( $css ); } } /** * Dynamic inline CSS * * @return void */ public function get_inline_css() { $css = ''; $css .= self::header_style(); if( get_header_image() ) { $css .= '.site-header{background-image:url("'. esc_url( get_header_image() ) .'")}'; } if( Options::get_option( 'meta__date' ) === false ) { $css .='span.posted-on{display:none}'; } if( Options::get_option( 'meta__author' ) === false ) { $css .='span.byline{display:none}'; } if( Options::get_option( 'meta__comment' ) === false ) { $css .='span.comments-link{display:none}'; } if( Options::get_option( 'meta__categories' ) === false ) { $css .='span.cat-links{display:none}'; } if( Options::get_option( 'meta__tags' ) === false ) { $css .='span.tags-links{display:none}'; } $css = apply_filters( 'baltic_inline_style', $css ); $css = str_replace( array( "\n", "\t", "\r" ), '', $css ); return $css; } /** * Print inline style. * * @return void */ public function print_inline_style() { $rtl = ( is_rtl() ) ? '-rtl' : ''; $css = $this->get_inline_css(); if ( ! empty( $css ) ) { if ( class_exists( 'WooCommerce' ) ) { wp_add_inline_style( "baltic-woocommerce-style{$rtl}", trim( $css ) ); } else { wp_add_inline_style( "baltic-style{$rtl}", trim( $css ) ); } } } /** * Print dynamic style for the editor. * * @return string css */ public function editor_style( $mceInit ) { $styles = ''; $styles .= ' :root { --color__selection-background: '. Options::get_option( 'color__selection-background' ) .'; --color__selection-text: '. Options::get_option( 'color__selection-text' ) .'; --color__preloader:'. Options::get_option( 'color__preloader' ) .'; --color__preloader-background:'. Options::get_option( 'color__preloader-background' ) .'; --color__text-primary:'. Options::get_option( 'color__text-primary' ) .'; --color__text-secondary:'. Options::get_option( 'color__text-secondary' ) .'; --color__code:'. Options::get_option( 'color__code' ) .'; --color__mark:'. Options::get_option( 'color__mark' ) .'; --color__mark-background:'. Options::get_option( 'color__mark-background' ) .'; --color__blockquote:'. Options::get_option( 'color__blockquote' ) .'; --color__pre:'. Options::get_option( 'color__pre' ) .'; --color__pre-background:'. Options::get_option( 'color__pre-background' ) .'; --color__hr:'. Options::get_option( 'color__hr' ) .'; --color__link:'. Options::get_option( 'color__link' ) .'; --color__link-hover:'. Options::get_option( 'color__link-hover' ) .'; --color__button:'. Options::get_option( 'color__button' ) .'; --color__button-hover:'. Options::get_option( 'color__button-hover' ) .'; --color__button-border:'. Options::get_option( 'color__button-border' ) .'; --color__button-border-hover:'. Options::get_option( 'color__button-border-hover' ) .'; --color__button-text:'. Options::get_option( 'color__button-text' ) .'; --color__button-text-hover:'. Options::get_option( 'color__button-text-hover' ) .'; } '; $styles = str_replace( array( "\n", "\t", "\r" ), '', $styles ); if ( ! isset( $mceInit['content_style'] ) ) { $mceInit['content_style'] = trim( $styles ) . ' '; } else { $mceInit['content_style'] .= ' ' . trim( $styles ) . ' '; } return $mceInit; } }