I ran into a recent problem that required me to set a different background image / theme in WordPress for individual pages and found a very simple solution. Follow these easy steps and you will be well on your way to customizing individual pages.
On the “Edit Page” page of the WordPress admin panel, you can define “Custom Fields”. For each page, create a custom field named “background-image”. The value should be a URL like “http://my-domain.tld/my-picture.png”.
Use the Theme Editor to edit the Page Template (page.php) of your current theme and add the following HTML/CSS between get_header() and <div id=”content”>.
- <style type=“text/css”>
- body {
- background-image: url(‘<?php echo get_post_meta($post->ID, ‘background-image‘, true); ?>’);
- }
- </style>
This is a simple way to have customized background images for individual pages in WordPress.
No comments yet