Changeset 16674
- Timestamp:
- 12/02/2010 12:16:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r16660 r16674 1445 1445 * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional. 1446 1446 */ 1447 function add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback = '') {1448 if ( ! empty( $header_callback) )1447 function add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback = '' ) { 1448 if ( ! empty( $header_callback ) ) 1449 1449 add_action('wp_head', $header_callback); 1450 1450 1451 add_theme_support( 'custom-header' );1451 add_theme_support( 'custom-header', array( 'callback' => $header_callback ) ); 1452 1452 add_theme_support( 'custom-header-uploads' ); 1453 1453 1454 1454 if ( ! is_admin() ) 1455 1455 return; 1456 require_once(ABSPATH . 'wp-admin/custom-header.php'); 1457 $GLOBALS['custom_image_header'] =& new Custom_Image_Header($admin_header_callback, $admin_image_div_callback); 1458 add_action('admin_menu', array(&$GLOBALS['custom_image_header'], 'init')); 1456 1457 global $custom_image_header; 1458 1459 require_once( ABSPATH . 'wp-admin/custom-header.php' ); 1460 $custom_image_header = new Custom_Image_Header( $admin_header_callback, $admin_image_div_callback ); 1461 add_action( 'admin_menu', array( &$custom_image_header, 'init' ) ); 1462 } 1463 1464 /** 1465 * Remove image header support. 1466 * 1467 * @since 3.1.0 1468 * @see add_custom_image_header() 1469 * 1470 * @return bool Whether support was removed. 1471 */ 1472 function remove_custom_image_header() { 1473 if ( ! current_theme_supports( 'custom-header' ) ) 1474 return false; 1475 1476 $callback = get_theme_support( 'custom-header' ); 1477 remove_action( 'wp_head', $callback['callback'] ); 1478 _remove_theme_support( 'custom-header' ); 1479 remove_theme_support( 'custom-header-uploads' ); 1480 1481 if ( ! is_admin() ) 1482 return; 1483 1484 global $custom_image_header; 1485 1486 remove_action( 'admin_menu', array( &$custom_image_header, 'init' ) ); 1487 1488 unset( $GLOBALS['custom_image_header'] ); 1489 return true; 1459 1490 } 1460 1491 … … 1695 1726 if ( in_array( $feature, array( 'custom-background', 'custom-header', 'editor-style', 'widgets', 'menus' ) ) ) 1696 1727 return false; 1697 1728 return _remove_theme_support( $feature ); 1729 } 1730 1731 /** 1732 * Removes theme support internally, ignorant of the blacklist. 1733 * 1734 * @access private 1735 * @since 3.1.0 1736 */ 1737 function _remove_theme_support( $feature ) { 1698 1738 global $_wp_theme_features; 1699 1739
Note: See TracChangeset
for help on using the changeset viewer.