Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional IE Classes, Browser defaults + conditional logic moved to functions.php #20

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 26 additions & 2 deletions source/functions/functions.php
Expand Up @@ -191,13 +191,37 @@ function twentytwelve_admin_header_image() { ?>
<?php } <?php }
endif; endif;


if ( ! function_exists( 'twentytwelve_get_header_image' ) ) :
/** /**
* Enqueue scripts for front-end. * Print Header Image if it exists
*
* Referenced via header.php
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_get_header_image() {
$header_image = get_header_image();

if ( ! empty( $header_image ) ) ?>
<img src="<?php echo esc_url( $header_image ); ?>" alt="" />

<?php }
endif;

/**
* Enqueue scripts and styles for front-end.
* *
* @since Twenty Twelve 1.0 * @since Twenty Twelve 1.0
*/ */
function twentytwelve_scripts() { function twentytwelve_scripts() {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );

wp_enqueue_script( 'navigation', get_template_directory_uri() . '/javascripts/theme.js', array( 'jquery' ), '20130320', true ); wp_enqueue_script( 'navigation', get_template_directory_uri() . '/javascripts/theme.js', array( 'jquery' ), '20130320', true );

wp_enqueue_style( 'fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700' );

wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
} }
add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts' ); add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts' );


Expand Down Expand Up @@ -401,4 +425,4 @@ function twentytwelve_body_class( $classes ) {


return $classes; return $classes;
} }
add_filter( 'body_class', 'twentytwelve_body_class' ); add_filter( 'body_class', 'twentytwelve_body_class' );
25 changes: 10 additions & 15 deletions source/templates/header.php
Expand Up @@ -8,11 +8,15 @@
* @subpackage Twenty_Twelve * @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0 * @since Twenty Twelve 1.0
*/ */
?><!DOCTYPE html> ?><!doctype html>
<html <?php language_attributes(); ?>> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if gt IE 8]> <!--> <html class="no-js" <?php language_attributes( 'html' ); ?>> <!--<![endif]-->
<head> <head>
<meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?> <?php bloginfo( 'name' ); ?></title> <title><?php wp_title( '|', true, 'right' ); ?> <?php bloginfo( 'name' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
Expand Down Expand Up @@ -44,14 +48,7 @@
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/javascripts/html5.js" type="text/javascript"></script> <script src="<?php echo get_template_directory_uri(); ?>/javascripts/html5.js" type="text/javascript"></script>
<![endif]--> <![endif]-->
<?php
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );

wp_enqueue_style( 'fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700' );


wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
?>
<?php wp_head(); ?> <?php wp_head(); ?>
</head> </head>


Expand All @@ -69,10 +66,8 @@
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?> <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav> </nav>


<?php $header_image = get_header_image(); <?php twentytwelve_get_header_image(); ?>
if ( ! empty( $header_image ) ) : ?>
<img src="<?php echo esc_url( $header_image ); ?>" alt="" />
<?php endif; ?>
</header><!-- #masthead --> </header><!-- #masthead -->


<div id="main"> <div id="main">