-
-
Save tommcfarlin/40a3875a9869b82207df to your computer and use it in GitHub Desktop.
[WordPress] An example for logically separating inline styles for the Theme Customizer.
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 | |
/** | |
* Renders the styles from the Theme Customizer. This template is included | |
* in `header.php`. | |
* | |
* @package Acme | |
*/ | |
?> | |
<!-- customizer --> | |
<style type="text/css"> | |
body { | |
<?php if ( '' != get_theme_mod( 'acme_background_image' ) ) { ?> | |
background-image: url( <?php echo get_theme_mod( 'acme_background_image' ); ?> ); | |
background-repeat: repeat; | |
background-attachment: fixed; | |
<?php } else { ?> | |
background: <?php echo get_theme_mod( 'acme_background_color' ); ?>; | |
<?php } ?> | |
} | |
</style> | |
<!-- /customizer --> |
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
<head> | |
<meta charset="<?php bloginfo( 'charset' ); ?>"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title><?php wp_title( '|', true, 'right' ); ?></title> | |
<link rel="profile" href="http://gmpg.org/xfn/11"> | |
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> | |
<?php wp_head(); ?> | |
<?php get_template_part( 'partials/customizer' ); ?> | |
</head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment