diff --git a/functions.php b/functions.php index 7526319a..e3c29a1e 100644 --- a/functions.php +++ b/functions.php @@ -79,6 +79,11 @@ function _s_setup() { endif; // _s_setup add_action( 'after_setup_theme', '_s_setup' ); +/** + * Implement the Custom Header feature + */ +//require( get_template_directory() . '/inc/custom-header.php' ); + /** * Register widgetized area and update sidebar with default widgets * diff --git a/inc/custom-header.php b/inc/custom-header.php new file mode 100644 index 00000000..4ace4593 --- /dev/null +++ b/inc/custom-header.php @@ -0,0 +1,133 @@ + + + + + + + * + * @package _s + * @since _s 1.0 + */ + +function _s_custom_header_setup() { + // The default header text color + define( 'HEADER_TEXTCOLOR', '000' ); + + // By leaving empty, we allow for random image rotation. + define( 'HEADER_IMAGE', '' ); + + // The height and width of your custom header. + // Add a filter to _s_header_image_width and _s_header_image_height to change these values. + define( 'HEADER_IMAGE_WIDTH', apply_filters( '_s_header_image_width', 1000 ) ); + define( 'HEADER_IMAGE_HEIGHT', apply_filters( '_s_header_image_height', 250 ) ); + + // Turn on random header image rotation by default. + add_theme_support( 'custom-header', array( 'random-default' => true ) ); + + // Add a way for the custom header to be styled in the admin panel that controls custom headers + add_custom_image_header( '_s_header_style', '_s_admin_header_style', '_s_admin_header_image' ); +} +add_action( 'after_setup_theme', '_s_custom_header_setup' ); + +if ( ! function_exists( '_s_header_style' ) ) : +/** + * Styles the header image and text displayed on the blog + * + * @since _s 1.0 + */ +function _s_header_style() { + + // 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 == get_header_textcolor() ) + return; + // If we get this far, we have custom styles. Let's do this. + ?> + + Header admin panel. + * + * Referenced via add_custom_image_header() in _s_setup(). + * + * @since _s 1.0 + */ +function _s_admin_header_style() { +?> + + Header admin panel. + * + * Referenced via add_custom_image_header() in _s_setup(). + * + * @since _s 1.0 + */ +function _s_admin_header_image() { ?> +
+ +

onclick="return false;" href="">

+
>
+ + + +
+