add_section( 'eventbrite_logo_section' , array(
'title' => __( 'Logo', 'eventbrite-event' ),
'priority' => 30,
'description' => __( 'Upload a logo to replace the default site name in the header', 'eventbrite-event' ),
) );
$wp_customize->add_setting( 'eventbrite_logo', array(
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'eventbrite_logo', array(
'label' => __( 'Logo', 'eventbrite-event' ),
'section' => 'eventbrite_logo_section',
'settings' => 'eventbrite_logo',
) ) );
}
/**
* Sets up the WordPress core custom header arguments and settings.
*/
public static function custom_header_setup() {
$args = array(
// No support for header text
'default-text-color' => 'fff',
'default-image' => '%s/img/bg-header.jpg',
// Set height and width, with a maximum value for the width.
'height' => 228,
'width' => 1280,
// Callbacks for styling the header and the admin preview.
'wp-head-callback' => array( __CLASS__, 'header_style' ),
'admin-head-callback' => array( __CLASS__, 'admin_header_style' ),
'admin-preview-callback' => array( __CLASS__, 'admin_header_area' ),
);
add_theme_support( 'custom-header', $args );
/*
* Default custom headers packaged with the theme.
* %s is a placeholder for the theme template directory URI.
*/
register_default_headers( array(
'default' => array(
'url' => '%s/img/bg-header.jpg',
'thumbnail_url' => '%s/img/bg-header.jpg',
'description' => _x( 'Default', 'header image description', 'eventbrite' )
),
) );
}
/**
* Styles the header displayed on the blog.
*/
public static function header_style() {
$header_image = get_header_image();
$header_text_color = get_header_textcolor();
// If no custom options for text or banner 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 && empty( $header_image ) )
return;
// If we get this far, we have custom styles. Let's do this.
?>
Header admin panel.
*/
public static function admin_header_style() {
$header_image = get_header_image();
$logo_image = get_theme_mod( 'eventbrite_logo' );
$theme_uri_root = trailingslashit( get_template_directory_uri() );
?>
Header admin panel.
* This callback overrides the default markup displayed there.
*/
public static function admin_header_area() {
$home_url = home_url( '/' );
$style = sprintf( ' style="color:#%s;"', get_header_textcolor() );
?>