Last active
December 21, 2016 20:14
-
-
Save cdils/fb1e7e3481b069e01ac8 to your computer and use it in GitHub Desktop.
Display a Logo (or Avatar) Before the Site Title - See accompanying tutorial at http://www.carriedils.com/display-logo-before-site-title/
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 // remove this line. | |
add_action( 'genesis_header', 'cd_site_image', 5 ); | |
/** | |
* Output image before site title. | |
* | |
* Checks to see if a header image exists. If so, output that in an `img` tag. If not, get | |
* the Gravatar associated with the site administrator's email (under Settings > General). | |
* | |
* @see get_header_image() Retrieve header image for custom header. | |
* @see get_avatar() Retrieve the avatar `<img>` tag for a user. | |
* | |
* @return string HTML for site logo/image. | |
*/ | |
function cd_site_image() { | |
$header_image = get_header_image() ? '<img alt="" src="' . get_header_image() . '" />' : get_avatar( get_option( 'admin_email' ), 224 ); | |
printf( '<div class="site-image">%s</div>', $header_image ); | |
} |
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
.site-header .site-image img { | |
border-radius: 50%; | |
display: block; | |
height: 100px; | |
margin: 0 auto 20px; | |
width: 100px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment