',
'after_title' => '
tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); $black_magazine_theme_info = wp_get_theme(); $GLOBALS['black_magazine_version'] = $black_magazine_theme_info->get( 'Version' ); } endif; add_action( 'after_setup_theme', 'black_magazine_setup' ); /** * Enqueue child theme styles and scripts */ function black_magazine_scripts() { global $black_magazine_version; wp_dequeue_style( "spidermag-style" ); wp_enqueue_style( 'spidermag-parent-style', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'style.css', array(), esc_attr( $black_magazine_version ) ); wp_enqueue_style( 'black-magazine-style', get_stylesheet_uri(), esc_attr( $black_magazine_version ) ); wp_add_inline_style( 'black-magazine-style', black_magazine_strip_whitespace(black_magazine_dynamic_css()) ); wp_enqueue_style( 'spidermag-responsive', get_template_directory_uri().'/assets/css/responsive.css' ); } add_action( 'wp_enqueue_scripts', 'black_magazine_scripts', 20 ); if ( ! function_exists( 'black_magazine_child_options' ) ) { function black_magazine_child_options( $wp_customize ) { // Primary Color. $wp_customize->add_setting('black_mag_primary_color', array( 'default' => '#e74c3c', 'sanitize_callback' => 'sanitize_hex_color', )); $wp_customize->add_control('black_mag_primary_color', array( 'type' => 'color', 'label' => esc_html__('Primary Color', 'black-magazine'), 'section' => 'colors', )); $wp_customize->add_setting('black_mag_enable_dark_mode', array( 'default' => true, 'sanitize_callback' => 'spidermag_checkbox_sanitize', //done )); $wp_customize->add_control('black_mag_enable_dark_mode', array( 'type' => 'checkbox', 'label' => esc_html__('Dark Mode', 'black-magazine'), 'section' => 'colors' )); } } add_action( 'customize_register' , 'black_magazine_child_options', 11 ); /** * Dynamic Style from parent */ // add_filter( 'spidermag_dynamic_css', 'black_magazine_dynamic_css', 100 ); function black_magazine_dynamic_css(){ $dynamic_css = ''; $primary_color = get_theme_mod('black_mag_primary_color'); if($primary_color){ $dynamic_css .= " input[type=\"submit\"], .lSAction>a, .search-container, .scrollup, .title-icon, .box-header-nav .main-menu .children>.page_item.current_page_item>a, .box-header-nav .main-menu .sub-menu>.menu-item.current-menu-item>a, .box-header-nav .main-menu .children>.page_item:hover>a, .box-header-nav .main-menu .children>.page_item.focus>a, .box-header-nav .main-menu .sub-menu>.menu-item:hover>a, .box-header-nav .main-menu .sub-menu>.menu-item.focus>a, .spider-home.spider-home-active.ion-home, .navbar-inverse .main-nav li.current-menu-item a, .woocommerce-account .woocommerce-MyAccount-navigation ul li a, a:hover .thumb-box span, .toggle-btn-header, .post-box-wrapper::before, .post-box-wrapper::after, .color-switcher ul li a.active, .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .toggle-search{ background-color: $primary_color; } a, .author-info h4, .color-switcher ul li a, .read-more:hover, a:hover, a:focus, .woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a, .woocommerce-account .woocommerce-MyAccount-navigation ul li:hover a, .woocommerce-MyAccount-content a:hover, .woocommerce-MyAccount-content a:hover, .widget a:hover, .widget a:hover::before, .widget li:hover::before, .text-danger,.icon-news,.ticker-content, .ticker-content a, .read-more, .read-more:focus, .widget_archive a::before, .widget_categories a::before, .widget_recent_entries a::before, .widget_meta a::before, .widget_recent_comments li::before, .widget_rss li:before, .widget_pages li:before, .widget_nav_menu li:before, .widget_product_categories a:before{ color: $primary_color; } .color-switcher ul li a, .color-switcher ul li a.active, .masonry-item:hover, .post-box-wrapper, blockquote, footer, input[type=\"submit\"], .lSGallery li a::before, .woocommerce-account .woocommerce-MyAccount-navigation ul li a, .woocommerce #respond input#submit, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a, .woocommerce-account .woocommerce-MyAccount-navigation ul li:hover a, .woocommerce-account .woocommerce-MyAccount-content, .navbar-inverse{ border-color: $primary_color; } .read-more svg path{ fill: $primary_color; } "; } return $dynamic_css; } function black_magazine_strip_whitespace($css) { $replace = array( "#/\*.*?\*/#s" => "", // Strip C style comments. "#\s\s+#" => " ", // Strip excess whitespace. ); $search = array_keys($replace); $css = preg_replace($search, $replace, $css); $replace = array( ": " => ":", "; " => ";", " {" => "{", " }" => "}", ", " => ",", "{ " => "{", ";}" => "}", // Strip optional semicolons. ",\n" => ",", // Don't wrap multiple selectors. "\n}" => "}", // Don't wrap closing braces. "} " => "}", // Put each rule on it's own line. ); $search = array_keys($replace); $css = str_replace($search, $replace, $css); return trim($css); } /** * Enqueue required scripts/styles for customizer panel * * @since 1.0.0 * */ function black_magazine_customize_scripts(){ wp_enqueue_script('black-magazine-customizer', get_stylesheet_directory_uri( ). '/js/admin.js', array('jquery', 'customize-controls'), true); } add_action('customize_controls_enqueue_scripts', 'black_magazine_customize_scripts'); add_filter( 'body_class', 'black_magzaine_remove_body_class', 100 ); function black_magzaine_remove_body_class( $classes ) { if( get_theme_mod('black_mag_enable_dark_mode', true) == false ){ $remove_classes = ['sp-blackmode']; $classes = array_diff($classes, $remove_classes); } return $classes; } /********************************************************************************** * Register widget area. ********************************************************************************** * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ if ( ! function_exists( 'black_magazine_widgets_init' ) ) { function black_magazine_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Right Sidebar Widget', 'black-magazine' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => '