Created
July 4, 2014 10:04
-
-
Save conor-egan/0a12933c9017608ac777 to your computer and use it in GitHub Desktop.
Change background image with custom fields
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 if (is_page() || is_single()) { | |
<?php $background = get_post_meta($post->ID, 'background', true); | |
if ($background) { | |
?> | |
<style type="text/css">body{ url(<?php echo $background; ?>) no-repeat fixed; }</style> | |
<?php } | |
}?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from:
http://www.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/