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
|
|
|
|
|
/**
|
2012-08-25 12:53:32 -04:00
|
|
|
|
* Implements an optional custom header for Twenty Twelve.
|
|
|
|
|
* See http://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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2012-08-25 12:53:32 -04:00
|
|
|
|
* Sets 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.
|
|
|
|
|
* @uses twentytwelve_header_style() to style front-end.
|
|
|
|
|
* @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
|
|
|
|
/**
|
|
|
|
|
* Loads our special font CSS file.
|
|
|
|
|
*
|
|
|
|
|
* @since Twenty Twelve 1.2
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
function twentytwelve_custom_header_fonts() {
|
|
|
|
|
$font_url = twentytwelve_get_font_url();
|
|
|
|
|
if ( ! empty( $font_url ) )
|
|
|
|
|
wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null );
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
/**
|
|
|
|
|
* Styles the header text displayed on the blog.
|
|
|
|
|
*
|
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
|
|
|
|
|
if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// 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?
|
|
|
|
|
if ( ! display_header_text() ) :
|
|
|
|
|
?>
|
|
|
|
|
.site-title,
|
|
|
|
|
.site-description {
|
2013-03-15 12:42:10 -04:00
|
|
|
|
position: absolute;
|
2012-09-27 11:23:15 -04:00
|
|
|
|
clip: rect(1px 1px 1px 1px); /* IE7 */
|
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
|
|
|
|
clip: rect(1px, 1px, 1px, 1px);
|
|
|
|
|
}
|
|
|
|
|
<?php
|
|
|
|
|
// If the user has set a custom color for the text, use that.
|
|
|
|
|
else :
|
|
|
|
|
?>
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Styles the header image displayed on the Appearance > Header admin panel.
|
|
|
|
|
*
|
|
|
|
|
* @since Twenty Twelve 1.0
|
|
|
|
|
*/
|
|
|
|
|
function twentytwelve_admin_header_style() {
|
|
|
|
|
?>
|
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
|
|
|
|
.appearance_page_custom-header #headimg {
|
|
|
|
|
border: none;
|
2013-04-17 13:46:58 -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>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-08-25 12:53:32 -04:00
|
|
|
|
* Outputs markup to be displayed on the Appearance > Header admin panel.
|
|
|
|
|
* 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() {
|
|
|
|
|
?>
|
|
|
|
|
<div id="headimg">
|
|
|
|
|
<?php
|
|
|
|
|
if ( ! display_header_text() )
|
|
|
|
|
$style = ' style="display:none;"';
|
|
|
|
|
else
|
|
|
|
|
$style = ' style="color:#' . get_header_textcolor() . ';"';
|
|
|
|
|
?>
|
|
|
|
|
<h1><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
|
|
|
|
|
<h2 id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></h2>
|
|
|
|
|
<?php $header_image = get_header_image();
|
|
|
|
|
if ( ! empty( $header_image ) ) : ?>
|
|
|
|
|
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php }
|