writr_get_default_header_image(), 'default-text-color' => 'fff', 'width' => 120, 'height' => 120, 'flex-width' => true, 'flex-height' => true, 'wp-head-callback' => 'writr_header_style', 'admin-head-callback' => 'writr_admin_header_style', 'admin-preview-callback' => 'writr_admin_header_image', ) ) ); } add_action( 'after_setup_theme', 'writr_custom_header_setup' ); /** * A default header image * * Use the admin email's gravatar as the default header image. */ function writr_get_default_header_image() { // Get default from Discussion Settings. $default = get_option( 'avatar_default', 'mystery' ); // Mystery man default if ( 'mystery' == $default ) $default = 'mm'; elseif ( 'gravatar_default' == $default ) $default = ''; $protocol = ( is_ssl() ) ? 'https://secure.' : 'http://'; $url = sprintf( '%1$sgravatar.com/avatar/%2$s/', $protocol, md5( get_option( 'admin_email' ) ) ); $url = add_query_arg( array( 's' => 120, 'd' => urlencode( $default ), ), $url ); return esc_url_raw( $url ); } // writr_get_default_header_image if ( ! function_exists( 'writr_header_style' ) ) : /** * Styles the header image and text displayed on the blog * * @see writr_custom_header_setup(). */ function writr_header_style() { $header_text_color = get_header_textcolor(); // If no custom options for text are set, let's bail // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value if ( HEADER_TEXTCOLOR == $header_text_color ) return; // If we get this far, we have custom styles. Let's do this. ?> Header admin panel. * * @see writr_custom_header_setup(). */ function writr_admin_header_style() { ?> Header admin panel. * * @see writr_custom_header_setup(). */ function writr_admin_header_image() { $style = sprintf( ' style="color:#%s;"', get_header_textcolor() ); $header_image = get_header_image(); ?>