The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2013-09-20 21:24:09 +02:00
|
|
|
* Implement an optional custom header for Twenty Twelve
|
|
|
|
*
|
2015-04-12 23:29:32 +02:00
|
|
|
* See https://codex.wordpress.org/Custom_Headers
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
2012-07-13 01:28:33 +02:00
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Twenty_Twelve
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-09-20 21:24:09 +02:00
|
|
|
* Set up the WordPress core custom header arguments and settings.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
2012-08-25 18:53:32 +02:00
|
|
|
* @uses add_theme_support() to register support for 3.4 and up.
|
2016-02-25 13:53:27 +01:00
|
|
|
* @uses twentytwelve_header_style() to style front end.
|
2012-08-25 18:53:32 +02:00
|
|
|
* @uses twentytwelve_admin_header_style() to style wp-admin form.
|
|
|
|
* @uses twentytwelve_admin_header_image() to add custom markup to wp-admin form.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
2012-07-25 19:30:19 +02:00
|
|
|
* @since Twenty Twelve 1.0
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*/
|
|
|
|
function twentytwelve_custom_header_setup() {
|
|
|
|
$args = array(
|
|
|
|
// Text color and image (empty to use none).
|
2013-03-15 19:03:43 +01:00
|
|
|
'default-text-color' => '515151',
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
'default-image' => '',
|
|
|
|
|
|
|
|
// Set height and width, with a maximum value for the width.
|
|
|
|
'height' => 250,
|
|
|
|
'width' => 960,
|
|
|
|
'max-width' => 2000,
|
|
|
|
|
|
|
|
// Support flexible height and width.
|
|
|
|
'flex-height' => true,
|
|
|
|
'flex-width' => true,
|
|
|
|
|
|
|
|
// Random image rotation off by default.
|
|
|
|
'random-default' => false,
|
|
|
|
|
|
|
|
// Callbacks for styling the header and the admin preview.
|
|
|
|
'wp-head-callback' => 'twentytwelve_header_style',
|
|
|
|
'admin-head-callback' => 'twentytwelve_admin_header_style',
|
|
|
|
'admin-preview-callback' => 'twentytwelve_admin_header_image',
|
|
|
|
);
|
|
|
|
|
2012-07-25 19:30:19 +02:00
|
|
|
add_theme_support( 'custom-header', $args );
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
}
|
|
|
|
add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );
|
|
|
|
|
2013-03-15 19:03:43 +01:00
|
|
|
/**
|
2013-09-20 21:24:09 +02:00
|
|
|
* Load our special font CSS file.
|
2013-03-15 19:03:43 +01:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.2
|
|
|
|
*/
|
|
|
|
function twentytwelve_custom_header_fonts() {
|
|
|
|
$font_url = twentytwelve_get_font_url();
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! empty( $font_url ) ) {
|
2013-03-15 19:03:43 +01:00
|
|
|
wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null );
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2013-03-15 19:03:43 +01:00
|
|
|
}
|
|
|
|
add_action( 'admin_print_styles-appearance_page_custom-header', 'twentytwelve_custom_header_fonts' );
|
|
|
|
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
/**
|
2013-09-20 21:24:09 +02:00
|
|
|
* Style the header text displayed on the blog.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
2013-03-15 19:03:43 +01:00
|
|
|
* get_header_textcolor() options: 515151 is default, hide text (returns 'blank'), or any hex value.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
function twentytwelve_header_style() {
|
|
|
|
$text_color = get_header_textcolor();
|
|
|
|
|
2020-01-29 01:45:18 +01:00
|
|
|
// If no custom options for text are set, let's bail.
|
2020-02-09 17:55:09 +01:00
|
|
|
if ( get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) {
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
return;
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
|
|
|
|
// If we get this far, we have custom styles.
|
|
|
|
?>
|
2013-04-16 19:18:30 +02:00
|
|
|
<style type="text/css" id="twentytwelve-header-css">
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
<?php
|
|
|
|
// Has the text been hidden?
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! display_header_text() ) :
|
2018-08-17 03:51:36 +02:00
|
|
|
?>
|
2017-12-01 00:11:00 +01:00
|
|
|
.site-title,
|
|
|
|
.site-description {
|
|
|
|
position: absolute;
|
|
|
|
clip: rect(1px 1px 1px 1px); /* IE7 */
|
|
|
|
clip: rect(1px, 1px, 1px, 1px);
|
|
|
|
}
|
2018-08-17 03:51:36 +02:00
|
|
|
<?php
|
|
|
|
// If the user has set a custom color for the text, use that.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
else :
|
2018-08-17 03:51:36 +02:00
|
|
|
?>
|
2013-03-01 18:45:59 +01:00
|
|
|
.site-header h1 a,
|
|
|
|
.site-header h2 {
|
|
|
|
color: #<?php echo $text_color; ?>;
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
}
|
|
|
|
<?php endif; ?>
|
|
|
|
</style>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-09-20 21:24:09 +02:00
|
|
|
* Style the header image displayed on the Appearance > Header admin panel.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
function twentytwelve_admin_header_style() {
|
2018-08-17 03:51:36 +02:00
|
|
|
?>
|
2013-04-17 19:50:04 +02:00
|
|
|
<style type="text/css" id="twentytwelve-admin-header-css">
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
.appearance_page_custom-header #headimg {
|
|
|
|
border: none;
|
2013-04-17 19:48:09 +02:00
|
|
|
font-family: "Open Sans", Helvetica, Arial, sans-serif;
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
}
|
|
|
|
#headimg h1,
|
|
|
|
#headimg h2 {
|
2013-03-15 19:03:43 +01:00
|
|
|
line-height: 1.84615;
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
#headimg h1 {
|
2013-03-15 19:03:43 +01:00
|
|
|
font-size: 26px;
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
}
|
|
|
|
#headimg h1 a {
|
|
|
|
color: #515151;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
#headimg h1 a:hover {
|
2013-03-15 19:03:43 +01:00
|
|
|
color: #21759b !important; /* Has to override custom inline style. */
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
}
|
|
|
|
#headimg h2 {
|
2012-11-14 21:13:04 +01:00
|
|
|
color: #757575;
|
2013-03-15 19:03:43 +01:00
|
|
|
font-size: 13px;
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
margin-bottom: 24px;
|
|
|
|
}
|
|
|
|
#headimg img {
|
|
|
|
max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px;
|
|
|
|
}
|
|
|
|
</style>
|
2018-08-17 03:51:36 +02:00
|
|
|
<?php
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-09-20 21:24:09 +02:00
|
|
|
* Output markup to be displayed on the Appearance > Header admin panel.
|
|
|
|
*
|
2012-08-25 18:53:32 +02:00
|
|
|
* This callback overrides the default markup displayed there.
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
function twentytwelve_admin_header_image() {
|
2015-01-21 22:06:23 +01:00
|
|
|
$style = 'color: #' . get_header_textcolor() . ';';
|
|
|
|
if ( ! display_header_text() ) {
|
|
|
|
$style = 'display: none;';
|
|
|
|
}
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
?>
|
|
|
|
<div id="headimg">
|
2015-01-21 22:06:23 +01:00
|
|
|
<h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( $style ); ?>" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
|
|
|
|
<h2 id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></h2>
|
2017-12-01 00:11:00 +01:00
|
|
|
<?php
|
|
|
|
$header_image = get_header_image();
|
|
|
|
if ( ! empty( $header_image ) ) :
|
2018-08-17 03:51:36 +02:00
|
|
|
?>
|
2015-01-21 22:06:23 +01:00
|
|
|
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" />
|
The Twenty Twelve for WordPress.
props drewstrojny, lancewillett.
also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.
see #19978.
git-svn-id: http://core.svn.wordpress.org/trunk@21261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-12 06:20:46 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
2018-08-17 03:51:36 +02:00
|
|
|
<?php
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|