|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Custom Header implementation |
|
4
|
|
|
* |
|
5
|
|
|
* @link http://codex.wordpress.org/Custom_Headers |
|
6
|
|
|
* |
|
7
|
|
|
* @package WordPress |
|
8
|
|
|
* @subpackage Strip |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Setup the WordPress core custom header feature. |
|
13
|
|
|
* |
|
14
|
|
|
* @uses strip_header_style() |
|
15
|
|
|
* @uses strip_admin_header_style() |
|
16
|
|
|
* @uses strip_admin_header_image() |
|
17
|
|
|
* |
|
18
|
|
|
* @package strip |
|
19
|
|
|
*/ |
|
20
|
|
|
function strip_custom_header_setup() { |
|
21
|
|
|
add_theme_support( 'custom-header', apply_filters( 'strip_custom_header_args', array( |
|
22
|
|
|
'default-image' => get_template_directory_uri() . '/assets/images/Default-header.png', |
|
23
|
|
|
'default-text-color' => '000', |
|
24
|
|
|
'flex-height' => true, |
|
25
|
|
|
'height' => 320, |
|
26
|
|
|
'width' => 1920, |
|
27
|
|
|
'wp-head-callback' => 'strip_header_style', |
|
28
|
|
|
'admin-head-callback' => 'strip_admin_header_style', |
|
29
|
|
|
'admin-preview-callback' => 'strip_admin_header_image', |
|
30
|
|
|
) ) ); |
|
31
|
|
|
/** |
|
32
|
|
|
* Register default header image |
|
33
|
|
|
*/ |
|
34
|
|
|
register_default_headers( array( |
|
35
|
|
|
'default-image' => array( |
|
36
|
|
|
'url' => '%s/assets/images/Default-header.png', |
|
37
|
|
|
'thumbnail_url' => '%s/assets/images/Default-header.png', |
|
38
|
|
|
'description' => _x( 'DefaultHeader', 'header image description', 'strip' ), |
|
39
|
|
|
), |
|
40
|
|
|
) |
|
41
|
|
|
); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
add_action( 'after_setup_theme', 'strip_custom_header_setup' ); |
|
45
|
|
|
|
|
46
|
|
|
if ( ! function_exists( 'strip_header_style' ) ) : |
|
47
|
|
|
/** |
|
48
|
|
|
* Styles the header image and text displayed on the blog |
|
49
|
|
|
* |
|
50
|
|
|
* @see strip_custom_header_setup(). |
|
51
|
|
|
*/ |
|
52
|
|
|
function strip_header_style() { |
|
53
|
|
|
|
|
54
|
|
|
/* Header text color. */ |
|
55
|
|
|
$header_text_color = get_header_textcolor(); |
|
56
|
|
|
|
|
57
|
|
|
/* Header image. */ |
|
58
|
|
|
$header_image = esc_url( get_header_image() ); |
|
59
|
|
|
|
|
60
|
|
|
/* Start header styles. */ |
|
61
|
|
|
$style = ''; |
|
62
|
|
|
|
|
63
|
|
|
/* Site title styles. */ |
|
64
|
|
|
if ( display_header_text() ) { |
|
65
|
|
|
$style .= ".site-title, .site-title a, .site-description, .site-description a { color: #{$header_text_color} }"; |
|
66
|
|
|
$style .= ".site-title { border-color: #{$header_text_color} }"; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
if ( ! display_header_text() ) { |
|
70
|
|
|
$style .= '.site-title, .site-title a, .site-description, .site-description a { clip: rect(1px, 1px, 1px, 1px); position: absolute; }'; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/* Echo styles if it's not empty. */ |
|
74
|
|
|
if ( ! empty( $style ) ) { |
|
75
|
|
|
echo "\n" . '<style type="text/css" id="custom-header-css">' . esc_attr( trim( $style ) ) . '</style>' . "\n"; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
} |
|
79
|
|
|
endif; // strip_header_style. |
|
80
|
|
|
|