X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/af50974463450c98503e763a7836a50e260461a9..7f1521bf193b382565eb753043c161f4cb3fcda7:/wp-includes/theme.php?ds=sidebyside diff --git a/wp-includes/theme.php b/wp-includes/theme.php index f8539e9f..1b372da3 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -406,6 +406,7 @@ function search_theme_directories( $force = false ) { $found_themes = array(); $wp_theme_directories = (array) $wp_theme_directories; + $relative_theme_roots = array(); // Set up maybe-relative, maybe-absolute array of theme directories. // We always want to return absolute, but we need to cache relative @@ -675,7 +676,6 @@ function preview_theme() { ob_start( 'preview_theme_ob_filter' ); } -add_action('setup_theme', 'preview_theme'); /** * Private function to modify the current template when previewing a theme @@ -934,7 +934,7 @@ function get_theme_mod( $name, $default = false ) { * @since 2.1.0 * * @param string $name Theme modification name. - * @param string $value theme modification value. + * @param mixed $value theme modification value. */ function set_theme_mod( $name, $value ) { $mods = get_theme_mods(); @@ -1034,12 +1034,25 @@ function display_header_text() { return 'blank' != $text_color; } +/** + * Check whether a header image is set or not. + * + * @since 4.2.0 + * + * @see get_header_image() + * + * @return bool Whether a header image is set or not. + */ +function has_header_image() { + return (bool) get_header_image(); +} + /** * Retrieve header image for custom header. * * @since 2.1.0 * - * @return string + * @return string|false */ function get_header_image() { $url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) ); @@ -1142,7 +1155,10 @@ function is_random_header_image( $type = 'any' ) { * @since 2.1.0 */ function header_image() { - echo esc_url( get_header_image() ); + $image = get_header_image(); + if ( $image ) { + echo esc_url( $image ); + } } /** @@ -1662,7 +1678,6 @@ function _custom_header_background_just_in_time() { } } } -add_action( 'wp_loaded', '_custom_header_background_just_in_time' ); /** * Gets the theme support arguments passed when registering that support @@ -1871,8 +1886,6 @@ function _delete_attachment_theme_mod( $id ) { remove_theme_mod( 'background_image' ); } -add_action( 'delete_attachment', '_delete_attachment_theme_mod' ); - /** * Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load * @@ -1929,7 +1942,6 @@ function _wp_customize_include() { // Init Customize class $GLOBALS['wp_customize'] = new WP_Customize_Manager; } -add_action( 'plugins_loaded', '_wp_customize_include' ); /** * Adds settings for the customize-loader script. @@ -1953,7 +1965,8 @@ function _wp_customize_loader_settings() { 'isCrossDomain' => $cross_domain, 'browser' => $browser, 'l10n' => array( - 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), + 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), + 'mainIframeTitle' => __( 'Customizer' ), ), ); @@ -1965,7 +1978,6 @@ function _wp_customize_loader_settings() { $wp_scripts->add_data( 'customize-loader', 'data', $script ); } -add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' ); /** * Returns a URL to load the Customizer. @@ -2032,5 +2044,5 @@ function wp_customize_support_script() { function is_customize_preview() { global $wp_customize; - return is_a( $wp_customize, 'WP_Customize_Manager' ) && $wp_customize->is_preview(); + return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview(); }