Skip to content

Instantly share code, notes, and snippets.

@conor-egan
Created July 4, 2014 10:04
Show Gist options
  • Save conor-egan/0a12933c9017608ac777 to your computer and use it in GitHub Desktop.
Save conor-egan/0a12933c9017608ac777 to your computer and use it in GitHub Desktop.
Change background image with custom fields
<?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 }
}?>
@conor-egan
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment