__( 'Primary Menu', 'abhasa' ), ) ); // Sets up background defaults and registers support for WordPress features. add_theme_support( 'custom-background', array( 'default-color' => '000000', 'default-image' => '', 'default-repeat' => 'repeat', 'default-position-x' => 'left', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-attachment' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ) ); } } // Get all necessary theme files get_template_part( 'inc/header' ); get_template_part( 'inc/defaults' ); get_template_part( 'inc/class-tgm-plugin', 'activation' ); if ( ! function_exists( 'abhasa_main_scripts' ) ) { add_action( 'wp_enqueue_scripts', 'abhasa_main_scripts' ); /** * Enqueue scripts and styles */ function abhasa_main_scripts() { wp_enqueue_style( 'abhasa-defaults', get_template_directory_uri() . '/css/defaults.css', '', ABHASA_VERSION, 'all' ); wp_enqueue_style( 'abhasa-style', get_template_directory_uri() . '/style.min.css', array( 'wp-block-library' ), ABHASA_VERSION, 'all' ); if ( is_child_theme() ) { wp_enqueue_style( 'abhasa-child', get_stylesheet_uri(), array( 'abhasa-style' ), filemtime( get_stylesheet_directory() . '/style.min.css' ), 'all' ); } } } if ( ! function_exists( 'abhasa_enqueue_editor_styles' ) ) { // Enqueue editor styles. function abhasa_enqueue_editor_styles() { // Add styles $abhasa_defaults = esc_url( get_template_directory_uri() ) . '/css/defaults.css'; $abhasa_style = esc_url( get_template_directory_uri() ) . '/style.min.css'; add_editor_style( $abhasa_defaults ); add_editor_style( $abhasa_style ); // Get the custom background settings $background_color = get_theme_mod( 'background_color', 'ffffff' ); $background_image = get_theme_mod( 'background_image', '' ); $background_repeat = get_theme_mod( 'background_repeat', 'repeat' ); $background_position_x = get_theme_mod( 'background_position_x', 'left' ); $background_position_y = get_theme_mod( 'background_position_y', 'top' ); $background_size = get_theme_mod( 'background_size', 'auto' ); $getdefaults = abhasa_get_defaults(); // Prepare the CSS $editor_css = " body { background-color: #" . esc_attr( $background_color ) . "; background-image: url('" . esc_url( $background_image ) . "'); background-repeat: " . esc_attr( $background_repeat ) . "; background-position: " . esc_attr( $background_position_x ) . " " . esc_attr( $background_position_y ) . "; background-size: " . esc_attr( $background_size ) . "; } "; // Inject the CSS into the block editor wp_add_inline_style( 'wp-block-editor', $editor_css ); } } add_action( 'admin_init', 'abhasa_enqueue_editor_styles', 8 );