WordPress.org

Make WordPress Core

Changeset 4673


Ignore:
Timestamp:
01/03/07 23:49:34 (9 years ago)
Author:
ryan
Message:

Custom Image Header. fixes #3465

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r4546 r4673  
    456456} 
    457457 
     458function remove_theme_mod( $name ) { 
     459    $theme = get_current_theme(); 
     460 
     461    $mods = get_option("mods_$theme"); 
     462 
     463    if ( !isset($mods[$name]) ) 
     464        return; 
     465 
     466    unset($mods[$name]); 
     467 
     468    if ( empty($mods) ) 
     469        return remove_theme_mods(); 
     470 
     471    update_option("mods_$theme", $mods); 
     472    wp_cache_delete("mods_$theme", 'options'); 
     473} 
     474 
    458475function remove_theme_mods() { 
    459476    $theme = get_current_theme(); 
     
    462479} 
    463480 
     481function get_header_textcolor() { 
     482    return get_theme_mod('header_textcolor', HEADER_TEXTCOLOR); 
     483} 
     484 
     485function header_textcolor() { 
     486    echo get_header_textcolor();     
     487} 
     488 
     489function get_header_image() { 
     490    return get_theme_mod('header_image', HEADER_IMAGE); 
     491} 
     492 
     493function header_image() { 
     494    echo get_header_image();     
     495} 
     496 
     497function add_custom_image_header($header_callback, $admin_header_callback) { 
     498    if ( ! empty($header_callback) ) 
     499        add_action('wp_head', $header_callback); 
     500 
     501    if ( ! is_admin() ) 
     502        return; 
     503    require_once(ABSPATH . 'wp-admin/custom-header.php'); 
     504    $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback); 
     505    add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init')); 
     506} 
     507 
    464508?> 
Note: See TracChangeset for help on using the changeset viewer.