2020-06-28 14:33:05 -04:00
|
|
|
<?php
|
|
|
|
|
2023-08-30 15:14:22 -04:00
|
|
|
# function file for Twenty Sixteen child theme
|
2020-06-28 14:33:05 -04:00
|
|
|
|
2020-11-10 16:10:41 -05:00
|
|
|
# Enqueue the css
|
|
|
|
|
|
|
|
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles');
|
2020-06-28 14:33:05 -04:00
|
|
|
function theme_enqueue_styles() {
|
|
|
|
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
|
2020-12-02 12:32:14 -05:00
|
|
|
# Dark Mode, pulled from Customizer settings, file style-(dark mode theme setting)
|
|
|
|
wp_enqueue_style( 'dark-style', get_stylesheet_directory_uri() . '/style-' . get_theme_mod("dark_mode_theme") . '.css' );
|
2020-06-28 14:33:05 -04:00
|
|
|
|
2020-11-10 16:10:41 -05:00
|
|
|
} # theme_enqueue_styles
|
2020-06-28 14:33:05 -04:00
|
|
|
|
2020-11-10 16:10:41 -05:00
|
|
|
# Remove the custom CSS from customizer.php
|
|
|
|
|
|
|
|
add_action( 'wp_enqueue_scripts', 'remove_actions_parent_theme');
|
|
|
|
function remove_actions_parent_theme() {
|
2020-12-02 12:32:14 -05:00
|
|
|
remove_action( 'wp_enqueue_scripts', 'twentysixteen_custom_background_css', 11 );
|
2020-11-10 16:10:41 -05:00
|
|
|
remove_action( 'wp_enqueue_scripts', 'twentysixteen_page_background_color_css', 11 );
|
|
|
|
remove_action( 'wp_enqueue_scripts', 'twentysixteen_link_color_css', 11 );
|
|
|
|
remove_action( 'wp_enqueue_scripts', 'twentysixteen_main_text_color_css', 11 );
|
|
|
|
remove_action( 'wp_enqueue_scripts', 'twentysixteen_secondary_text_color_css', 11 );
|
|
|
|
} # remove_actions_parent_theme
|
2020-06-28 14:33:05 -04:00
|
|
|
|
2020-12-02 12:32:14 -05:00
|
|
|
add_action( 'customize_register', 'remove_parent_customizer_register' );
|
|
|
|
function remove_parent_customizer_register( $wp_customize ) {
|
|
|
|
$wp_customize->remove_section( 'colors');
|
|
|
|
} # remove parent customizer register
|
|
|
|
|
|
|
|
add_filter('body_class', function (array $classes) {
|
|
|
|
# removes body class which lingers and causes issue.
|
|
|
|
if (in_array('custom-background', $classes)) {
|
|
|
|
unset( $classes[array_search('custom-background', $classes)] );
|
|
|
|
}
|
|
|
|
return $classes;
|
|
|
|
});
|
|
|
|
|
2020-11-10 16:10:41 -05:00
|
|
|
# Add additional file types to the media
|
|
|
|
|
|
|
|
add_filter( 'upload_mimes', 'my_myme_types', 1, 1 );
|
2020-06-28 14:33:05 -04:00
|
|
|
function my_myme_types( $mime_types ) {
|
|
|
|
$mime_types['epub'] = 'application/epub+zip'; // Adding .svg extension
|
|
|
|
$mime_types['mobi'] = 'application/octet-stream'; // Adding .json extension
|
|
|
|
return $mime_types;
|
2020-11-10 16:10:41 -05:00
|
|
|
} # my_myme_types
|
2020-06-28 14:33:05 -04:00
|
|
|
|
2020-12-02 12:32:14 -05:00
|
|
|
# Customizer - Add in Dark Mode Area
|
|
|
|
add_action( 'customize_register', 'child_theme_customizer_settings' );
|
|
|
|
function child_theme_customizer_settings( $wp_customize ) {
|
|
|
|
$wp_customize->add_section( 'dark_mode' , array(
|
|
|
|
'title' => 'Dark Mode',
|
|
|
|
'priority' => 30,
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_setting( 'dark_mode_theme' , array(
|
|
|
|
'default' => 'dark',
|
|
|
|
'transport' => 'refresh',
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_control( 'dark_mode_theme', array(
|
|
|
|
'label' => __( 'Custom Theme CSS' ),
|
|
|
|
'type' => 'radio',
|
|
|
|
'section' => 'dark_mode',
|
|
|
|
'choices' => array(
|
2023-08-30 15:14:22 -04:00
|
|
|
'dark' => 'Classic Dark',
|
|
|
|
'alpenglow' => 'Alpenglow',
|
|
|
|
'blue' => 'Blue',
|
2020-12-02 12:32:14 -05:00
|
|
|
)
|
|
|
|
) );
|
|
|
|
|
|
|
|
} # child_theme_customizer_settings
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-28 14:33:05 -04:00
|
|
|
?>
|