Created
August 11, 2016 22:38
-
-
Save susanlangenes/b7b6435a4187f4bc921c09ed7f182412 to your computer and use it in GitHub Desktop.
smoother way to get a specific image size's url (using ACF image ID). Note lines 62-64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The header for our theme. | |
* | |
* This is the template that displays all of the <head> section and everything up until <div id="content"> | |
* | |
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials | |
* | |
* @package Collage Creative Gallery 2016 | |
*/ | |
?><!DOCTYPE html> | |
<html <?php language_attributes(); ?>> | |
<head> | |
<meta charset="<?php bloginfo( 'charset' ); ?>"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="profile" href="http://gmpg.org/xfn/11"> | |
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> | |
<link href="https://fonts.googleapis.com/css?family=Gentium+Basic:400,400i|Lato:400,400i,700" rel="stylesheet"> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> | |
<div id="page" class="site"> | |
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'cc-gallery-2016' ); ?></a> | |
<?php if ( get_field('hero_image') ) { | |
$image = wp_get_attachment_image_src(get_field('hero_image'), 'hero'); ?> | |
<div id="headwrap" class="header-wrapper" style="background-image: url('<?php echo $image[0]; ?>');"> | |
<?php } ?> | |
<header id="masthead" class="site-header" role="banner"> | |
<div class="site-branding"> | |
<?php | |
if ( is_front_page() && is_home() ) : ?> | |
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> | |
<?php else : ?> | |
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p> | |
<?php | |
endif; | |
// $description = get_bloginfo( 'description', 'display' ); | |
// if ( $description || is_customize_preview() ) : ?> | |
<!-- <p class="site-description"><?php //echo $description; /* WPCS: xss ok. */ ?></p> --> | |
<?php | |
//endif; ?> | |
</div><!-- .site-branding --> | |
</header><!-- #masthead --> | |
<nav id="site-navigation" class="main-navigation" role="navigation"> | |
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"> | |
<img src="<?php echo get_stylesheet_directory_uri(); ?>/img/hamburger.png" /> | |
<img src="<?php echo get_stylesheet_directory_uri(); ?>/img/x.png" /> | |
</button> | |
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' ) ); ?> | |
</nav><!-- #site-navigation --> | |
<?php if ( get_field('hero_image') ) { ?> | |
</div><!-- #headwrap --> | |
<?php } ?> | |
<div id="content" class="site-content"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment