✏️ 正在编辑: dynamic-css.php
路径:
/home/h359620/public_html/wp-content/themes/datis/inc/includes/dynamic-css.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * Theme settings management class for datis * This class uses the Redux Framework to create the theme settings page. * * @package Datis */ if (!defined('ABSPATH')) { exit; // Prevent direct access } if (!class_exists('Datis_Dynamic_Css')) { class Datis_Dynamic_Css { private static $instance; private function __construct() { $this->init_hooks(); } private function init_hooks() { add_action('wp_enqueue_scripts', [$this, 'dynamic_css'], 99); add_action('admin_enqueue_scripts', [$this, 'admin_typography_styles'], 99); add_action('elementor/editor/before_enqueue_styles', [$this, 'dynamic_css'], 99); add_action('elementor/editor/before_enqueue_styles', [$this, 'admin_typography_styles'], 99); add_action('elementor/editor/after_enqueue_styles', [$this, 'admin_typography_styles'], 99); add_action('elementor/editor/after_enqueue_styles', [$this, 'dynamic_css'], 99); add_action('elementor/frontend/after_enqueue_styles', [$this, 'admin_typography_styles'], 99); add_action('elementor/frontend/after_enqueue_styles', [$this, 'dynamic_css'], 99); } public function admin_typography_styles() { $options = get_option('datis_theme_options'); if (!empty($options['dashboard_typography']['font-family'])) { $font_family = $options['dashboard_typography']['font-family']; $css = " #wpwrap, #wpwrap button, #wpwrap input, #wpwrap select, #wpwrap textarea, #wpwrap .wp-core-ui, #wpwrap .wp-core-ui *, .rtl h1, .rtl h2, .rtl h3, .rtl h4, .rtl h5, .rtl h6, .e-notice__content, #e-admin-top-bar-root .e-admin-top-bar *, div#elementor-new-template-modal *, .e-view.e-con-shared-styles.e-con-select-type, .dialog-widget.dialog-simple-widget.elementor-context-menu, button,.elementor-panel *,#elementor-panel, .rtl .media-frame { font-family: '{$font_family}', 'FontAwesome', 'Font Awesome 5 Free', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, eicons, dashicons !important; } .block-editor__container .editor-styles-wrapper, .block-editor__container .editor-styles-wrapper *, .block-editor-default-block-appender .block-editor-default-block-appender__content, .editor-visual-editor__post-title-wrapper.edit-post-visual-editor__post-title-wrapper, .editor-styles-wrapper :where(:not(.is-layout-flex,.is-layout-grid))>.wp-block, .e-view.e-con-shared-styles.e-con-select-type, .dialog-widget.dialog-simple-widget.elementor-context-menu, button,.elementor-panel *,#elementor-panel, .rtl .media-frame { font-family: '{$font_family}', 'FontAwesome', 'Font Awesome 5 Free', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, eicons, dashicons !important; } .elementor-panel, .elementor-panel *, #elementor-loading *, .MuiPaper-root *, .e-view.e-con-shared-styles.e-con-select-type, .e-notice-bar *, aside#elementor-navigator *, .dialog-widget.dialog-simple-widget.elementor-context-menu, button,#elementor-panel, .rtl .media-frame{ font-family: '{$font_family}', 'FontAwesome', 'Font Awesome 5 Free', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, eicons, dashicons !important; } .elementor-editor-active .elementor-inner, #elementor-loading *, .MuiPaper-root *, button, .rtl .media-frame, .e-view.e-con-shared-styles.e-con-select-type, .e-notice-bar *,.elementor-panel *,#elementor-panel, aside#elementor-navigator *, .dialog-widget.dialog-simple-widget.elementor-context-menu { font-family: '{$font_family}', 'FontAwesome', 'Font Awesome 5 Free', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, eicons, dashicons !important; } body, .tipsy-inner, .elementor-button, .elementor-panel { font-family: '{$font_family}', 'FontAwesome', 'Font Awesome 5 Free', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, eicons, dashicons !important; } "; wp_add_inline_style('wp-admin', $css); wp_add_inline_style('wp-edit-blocks', $css); wp_add_inline_style('elementor-editor', $css); } } public function dynamic_css() { $options = get_option('datis_theme_options'); // $border_radius = isset($options['border_radius']) ? $options['border_radius'] : '20px'; $body_bg_color = isset($options['body_bg_color']) ? $options['body_bg_color'] : '#ffffff'; $preloader_bg_color = isset($options['preloader_bg_color']) ? $options['preloader_bg_color'] : '#ffffff'; $preloader_color = isset($options['preloader_color']) ? $options['preloader_color'] : '#ffffff'; $body_text_color = isset($options['body_text_color']) ? $options['body_text_color'] : '#333333'; $primary_color = isset($options['primary_color']) ? $options['primary_color'] : '#A4834E'; $secondary_color = isset($options['secondary_color']) ? $options['secondary_color'] : '#0B9444'; $partially_color = isset($options['partially_color']) ? $options['partially_color'] : '#FAF8F4'; $link_text_color = isset($options['link_text_color']) ? $options['link_text_color'] : '#676767'; $link_hover_text_color = isset($options['link_hover_text_color']) ? $options['link_hover_text_color'] : '#494949'; $container_size = isset($options['container_size']) ? $options['container_size'] : '1250px'; $font_family = isset($options['body_typography']['font-family']) ? $options['body_typography']['font-family'] : 'IRANSansX'; $css = " :root { --datis-body-bg-color : {$body_bg_color}; --datis-body-text-color : {$body_text_color}; --datis-primary-color : {$primary_color}; --datis-secondary-color : {$secondary_color}; --datis-partially-color : {$partially_color}; --datis-link-text-color : {$link_text_color}; --datis-link-hover-text-color : {$link_hover_text_color}; --datis-container : {$container_size}px; --loader-color: {$preloader_color}; --loader-bg-color: {$preloader_bg_color}; } body{ background : {$body_bg_color}; } button{ font-family : {$font_family}; } .container{ width: {$container_size}px !important; padding : 0px; margin: 0 auto; } @media screen and (max-width : {$container_size}px) { .container { width: 100% !important; max-width: 95%; } .blog-container,.podcast-container{ width: 100% !important; } } "; wp_add_inline_style('datis-main', $css); wp_add_inline_style('elementor-editor', $css); } public static function get_instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } } Datis_Dynamic_Css::get_instance(); }
💾 保存文件
← 返回文件管理器