-
-
Save 2ndkauboy/5e1cc889028cd8408a1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function twentyfifteen_parent_enqueue_styles() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'twentyfifteen_parent_enqueue_styles' ); | |
/** | |
* @param $wp_customize WP_Customize_Manager | |
*/ | |
function twentyfifteen_customized_setting_custom_css( $wp_customize ) { | |
$wp_customize->add_setting( 'custom_theme_css', array( | |
'type' => 'theme_mod', | |
) ); | |
$wp_customize->add_control( 'custom_theme_css', array( | |
'label' => __( 'Custom Theme CSS', 'twentyfifteen-customized' ), | |
'type' => 'textarea', | |
'section' => 'custom_css', | |
) ); | |
$wp_customize->add_section( 'custom_css', array( | |
'title' => __( 'Custom CSS', 'twentyfifteen-customized' ), | |
'description' => __( 'Add custom CSS here', 'twentyfifteen-customized' ), | |
'priority' => 160, | |
'capability' => 'edit_theme_options', | |
) ); | |
} | |
add_action( 'customize_register', 'twentyfifteen_customized_setting_custom_css' ); | |
/** | |
* @param $wp_customize WP_Customize_Manager | |
*/ | |
function twentyfifteen_customized_setting_blog_title_color( $wp_customize ) { | |
$wp_customize->add_setting( 'blog_title_color', array( | |
'default' => '#4f998d', | |
'sanitize_callback' => 'sanitize_hex_color', | |
) ); | |
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'blog_title_color', array( | |
'label' => __( 'Blog Title Color', 'twentyfifteen-customized' ), | |
'section' => 'custom_css', | |
) ) ); | |
} | |
add_action( 'customize_register', 'twentyfifteen_customized_setting_blog_title_color' ); | |
/** | |
* @param $wp_customize WP_Customize_Manager | |
*/ | |
function twentyfifteen_customized_setting_header_background_image( $wp_customize ) { | |
$wp_customize->add_setting( 'blog_title_bg_image', array( | |
'type' => 'theme_mod', | |
) ); | |
$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'blog_title_bg_image', array( | |
'label' => __( 'Blog Title Background Image', 'twentyfifteen-customized' ), | |
'section' => 'custom_css', | |
'mime_type' => 'image', | |
) ) ); | |
} | |
add_action( 'customize_register', 'twentyfifteen_customized_setting_header_background_image' ); | |
function twentyfifteen_customized_custom_css_output() { | |
?> | |
<style type="text/css" id="custom-theme-css"> | |
.site-title { | |
background-image: url(<?php echo wp_get_attachment_image_url( get_theme_mod( 'blog_title_bg_image', '' ) ); ?>); | |
} | |
.site-title a { | |
color: <?php echo get_theme_mod( 'blog_title_color', '#4f998d' ) ?>; | |
} | |
<?php echo get_theme_mod( 'custom_theme_css', '' ); ?> | |
</style> | |
<?php | |
} | |
add_action( 'wp_head', 'twentyfifteen_customized_custom_css_output'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Theme Name: TwentyFifteen Customized | |
Template: twentyfifteen | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment