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 00:20:46 -04:00
|
|
|
<?php
|
|
|
|
/**
|
2013-09-20 15:24:09 -04:00
|
|
|
* Implement an optional custom header for Twenty Twelve
|
|
|
|
*
|
2015-04-12 17:29:32 -04: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 00:20:46 -04:00
|
|
|
*
|
2012-07-12 19:28:33 -04: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 00:20:46 -04:00
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-09-20 15:24:09 -04: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 00:20:46 -04:00
|
|
|
*
|
2012-08-25 12:53:32 -04:00
|
|
|
* @uses add_theme_support() to register support for 3.4 and up.
|
2016-02-25 07:53:27 -05:00
|
|
|
* @uses twentytwelve_header_style() to style front end.
|
2012-08-25 12:53:32 -04: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 00:20:46 -04:00
|
|
|
*
|
2012-07-25 13:30:19 -04: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 00:20:46 -04:00
|
|
|
*/
|
|
|
|
function twentytwelve_custom_header_setup() {
|
|
|
|
$args = array(
|
|
|
|
// Text color and image (empty to use none).
|
2013-03-15 14:03:43 -04: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 00:20:46 -04: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 13:30:19 -04: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 00:20:46 -04:00
|
|
|
}
|
|
|
|
add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );
|
|
|
|
|
2013-03-15 14:03:43 -04:00
|
|
|
/**
|
2013-09-20 15:24:09 -04:00
|
|
|
* Load our special font CSS file.
|
2013-03-15 14:03:43 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.2
|
|
|
|
*/
|
|
|
|
function twentytwelve_custom_header_fonts() {
|
|
|
|
$font_url = twentytwelve_get_font_url();
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! empty( $font_url ) ) {
|
2013-03-15 14:03:43 -04:00
|
|
|
wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2013-03-15 14:03:43 -04: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 00:20:46 -04:00
|
|
|
/**
|
2013-09-20 15:24:09 -04: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 00:20:46 -04:00
|
|
|
*
|
2013-03-15 14:03:43 -04: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 00:20:46 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
function twentytwelve_header_style() {
|
|
|
|
$text_color = get_header_textcolor();
|
|
|
|
|
|
|
|
// If no custom options for text are set, let's bail
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( $text_color == get_theme_support( 'custom-header', 'default-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 00:20:46 -04:00
|
|
|
return;
|
2017-11-30 18:11:00 -05: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 00:20:46 -04:00
|
|
|
|
|
|
|
// If we get this far, we have custom styles.
|
|
|
|
?>
|
2013-04-16 13:18:30 -04: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 00:20:46 -04:00
|
|
|
<?php
|
|
|
|
// Has the text been hidden?
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! display_header_text() ) :
|
2018-08-16 21:51:36 -04:00
|
|
|
?>
|
2017-11-30 18:11:00 -05:00
|
|
|
.site-title,
|
|
|
|
.site-description {
|
|
|
|
position: absolute;
|
|
|
|
clip: rect(1px 1px 1px 1px); /* IE7 */
|
|
|
|
clip: rect(1px, 1px, 1px, 1px);
|
|
|
|
}
|
2018-08-16 21:51:36 -04: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 00:20:46 -04:00
|
|
|
else :
|
2018-08-16 21:51:36 -04:00
|
|
|
?>
|
2013-03-01 12:45:59 -05: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 00:20:46 -04:00
|
|
|
}
|
|
|
|
<?php endif; ?>
|
|
|
|
</style>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-09-20 15:24:09 -04: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 00:20:46 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
function twentytwelve_admin_header_style() {
|
2018-08-16 21:51:36 -04:00
|
|
|
?>
|
2013-04-17 13:50:04 -04: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 00:20:46 -04:00
|
|
|
.appearance_page_custom-header #headimg {
|
|
|
|
border: none;
|
2013-04-17 13:48:09 -04: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 00:20:46 -04:00
|
|
|
}
|
|
|
|
#headimg h1,
|
|
|
|
#headimg h2 {
|
2013-03-15 14:03:43 -04: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 00:20:46 -04:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
#headimg h1 {
|
2013-03-15 14:03:43 -04: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 00:20:46 -04:00
|
|
|
}
|
|
|
|
#headimg h1 a {
|
|
|
|
color: #515151;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
#headimg h1 a:hover {
|
2013-03-15 14:03:43 -04: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 00:20:46 -04:00
|
|
|
}
|
|
|
|
#headimg h2 {
|
2012-11-14 15:13:04 -05:00
|
|
|
color: #757575;
|
2013-03-15 14:03:43 -04: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 00:20:46 -04:00
|
|
|
margin-bottom: 24px;
|
|
|
|
}
|
|
|
|
#headimg img {
|
|
|
|
max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px;
|
|
|
|
}
|
|
|
|
</style>
|
2018-08-16 21:51:36 -04: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 00:20:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-09-20 15:24:09 -04:00
|
|
|
* Output markup to be displayed on the Appearance > Header admin panel.
|
|
|
|
*
|
2012-08-25 12:53:32 -04: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 00:20:46 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
*/
|
|
|
|
function twentytwelve_admin_header_image() {
|
2015-01-21 16:06:23 -05: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 00:20:46 -04:00
|
|
|
?>
|
|
|
|
<div id="headimg">
|
2015-01-21 16:06:23 -05: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-11-30 18:11:00 -05:00
|
|
|
<?php
|
|
|
|
$header_image = get_header_image();
|
|
|
|
if ( ! empty( $header_image ) ) :
|
2018-08-16 21:51:36 -04:00
|
|
|
?>
|
2015-01-21 16:06:23 -05: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 00:20:46 -04:00
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
2018-08-16 21:51:36 -04:00
|
|
|
<?php
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|