Last active
May 27, 2018 07:38
-
-
Save SanjeevMohindra/5472846a50154eceaf669aaf77fa0389 to your computer and use it in GitHub Desktop.
Display Your Logo rather than blog name on the AMP Pages
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 | |
// Do not copy the above php tag in your function.php | |
/** | |
* Change blog name to a blog logo on the AMP Page Header | |
* | |
* Add this to your function.php | |
* | |
* @author MetaBlogue | |
* @license GPL-2.0+ | |
* @link https://metablogue.com/configure-enable-amp-wordpress/ | |
*/ | |
add_action( 'amp_post_template_css', 'mb_amp_header_css_styles' ); | |
function mb_amp_header_css_styles( $amp_template ) { | |
// only CSS here please... | |
?> | |
header.amp-wp-header { | |
background: #F6E3CE; | |
} | |
header.amp-wp-header a { | |
background-image: url( 'https://example.com/wp-content/uploads/2017/09/example-header-image.png' ); | |
background-repeat: no-repeat; | |
background-size: contain; | |
display: block; | |
height: 60px; | |
width: 165px; | |
margin: 0 auto; | |
text-indent: -9999px; | |
} | |
<?php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment