Title: background image
Last modified: August 19, 2016

---

# background image

 *  [stargatesg1](https://wordpress.org/support/users/stargatesg1/)
 * (@stargatesg1)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/)
 * Is there a plug in where you can specify a background image for different page
   sections?

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822896)
 * I’m looking for the same thing stargatesg1. Plugin, css or another method would
   be excellent.
 * I’d like to put a different background image on each page of this site:
    [http://garyploski.com/actor](http://garyploski.com/actor)
 * Thanks for any/all ideas suggested.
 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822901)
 * Additional thoughts anyone? Thanks.
 *  [mores](https://wordpress.org/support/users/mores/)
 * (@mores)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822902)
 * use a function to extract the image that is attached to a post or page and display
   it in the background.
 * Step1: check the extraction process here: [http://wordpress.org/support/topic/140609?replies=39](http://wordpress.org/support/topic/140609?replies=39)
 * Step2: in your header, use the function to define the body background.
 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822903)
 * Thanks mores.
 * I”ll look into this/give it a try tonight.
 *  [mrichard](https://wordpress.org/support/users/mrichard/)
 * (@mrichard)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822904)
 * Just thinking you could try using custom tags in the admin, put the image url
   in there and then just do something like –
 * Create custom tag called BGIMAGE with the image url as the value. Then use this
   in the head of the header file….
 *     ```
       <?php $key = "BGIMAGE";
       $BGIMAGE = get_post_meta($postID, $key, true); 
   
       if(!empty($BGIMAGE)) { ?>
       <style>
       body {
       background-url:('<?=$BGIMAGE; ?>');
       }
       </style>
       <?php } ?>
       ```
   
 * Hope that helps.
 * Marc
 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822905)
 * Thanks for the idea Marc.
 * Could you elaborate on this point “try using custom tags in the admin” – I don’t
   follow. Do you mean for each page?
 * I would put your sample code into the HTML for each page… y/n? If so I believe
   I understand up to the original point noted above.
 * Sadly I didn’t get to try either suggestions – late night. Hopefully I’ll have
   a chance in the AM.
 *  [mores](https://wordpress.org/support/users/mores/)
 * (@mores)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822907)
 * gary … when you write a post or a page, underneath the text-input area you have
   advanced options like excerpts, trackback and custom fields.
    Click on custom
   fields, write “BGIMAGE” into the “key” part, and the link to your file in the“
   value” box.
 * marc’s code then needs to be implemented in the header.php file of your template,
   
   somwehere right before the < body > tag.
 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822909)
 * Thanks mores.
 * It dawned on me while I was getting ready for bed — I’ve never considered that
   section. Sweet! Thanks for specifying.
 * I just tried Marc’s idea/code and can report that it did not work. I chose an
   image of mine and another image elsewhere into two pages.
 * [http://garyploski.com/actor/about/](http://garyploski.com/actor/about/) (using:
   [http://www.sixapart.com/i/wrench_hat.jpg](http://www.sixapart.com/i/wrench_hat.jpg))
   
   and [http://garyploski.com/actor](http://garyploski.com/actor) (using: [http://garyploski.com/actor/wp-content/gallery/theatre/153_5354.jpg](http://garyploski.com/actor/wp-content/gallery/theatre/153_5354.jpg))
 * I paste the code in the following three places:
 * <?php wp_head(); ?>
    </head> **HERE** <body>
 * <?php wp_head(); ?>
    **HERE** </head> <body>
 * **HERE**
    <?php wp_head(); ?> </head> <body>
 * I’m using the HemingwayEX 1.1 theme. As a test I tried with the Default template
   as well – still didn’t work.
 * It’s a great idea Marc and would make this idea fly. With this in mind, is there
   something I might be missing?
 *  [mores](https://wordpress.org/support/users/mores/)
 * (@mores)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822913)
 * hmmm, you know what, I think it’s due to the fact that marc’s code needs to know,
   what post-id we’re currently looking at, and that information is only available
   inside the loop – not embeddable in the header.
 * I don’t know how do do this any better, but here’s a little plugin for you:
 *     ```
       <?php
       /*
       Plugin Name: MetaBackGround
       Plugin URI: http://www.mores.cc/metabackground
       Description: Backgroundimages for posts and pages. Add a custom field called BGIMAGE with the absolute link to your desired background image.
       Version: 0.0.1
       Author: Mores Daniel
       Author URI: http://www.mores.cc/
       */
   
       add_action('wp_head', 'mores_metabackground');
   
       function mores_metabackground() {
       	global $post;
   
       	$key = "BGIMAGE";
       	$BGIMAGE = get_post_meta($post->ID, $key, true);
   
       	if(!empty($BGIMAGE)) {
       		echo "\n<style>\nbody{background: url('".$BGIMAGE."');}\n</style>\n";
       	}
       } ?>
       ```
   
 * Copy the code, paste it into a text file, name it “metabackground.php” or whatever,
   upload to your plugin directory, activate, and wallah. It’ll put the code where
   it needs to go.
 * If you know what kind of backgrounds you use, you might want to edit the actual
   style definition so that your background image is properly aligned, repeated 
   etc.
 * You can also download it from here: [http://www.mores.cc/metabackground](http://www.mores.cc/metabackground)
   
   🙂
 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822914)
 * Wow. Great thinking. Here are some test results.
 * Default – no image displays in home or about
    Classic – image displays in home
   and about HemingwayEX – images displays in what appears to be the footer only
   NinjaMonkeys 0.20 – images displays in what appears to be the footer only
 * I’ve left HemingwayEX active so the result can be seen. Thank you so much for
   putting your time into this mores.
 *  [mores](https://wordpress.org/support/users/mores/)
 * (@mores)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822915)
 * In Hemingway it’s due to the number of layers with background-color definitions
   that cover the image. Must be the same for the others, so you’ll need to get 
   rid of all the unnecessary background colors in the appropriate stylesheet.
 * BUT, you might want to put the image only in a certain part of the page. Try 
   editing the plugin so that the image is not background of the entire body, but
   of the layer you want it to display in.
    In hemingway this might be “primary”,
   so change
 *     ```
       echo "\n<style>\nbody{background: url('".$BGIMAGE."');}\n</style>\n";
       ```
   
 * to
 *     ```
       echo "\n<style>\n#primary{background: url('".$BGIMAGE."');}\n</style>\n";
       ```
   
 * (By the way, the \n is a control character that returns a line-break, so that
   the source-code is more easily debuggable.)
 * I’d have to do a lot of fiddling to get it just right for your template. Try 
   disabling any background colors first, then see what it looks like.
 *  [garyploski](https://wordpress.org/support/users/garyploski/)
 * (@garyploski)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822918)
 * It’s working! Thank you so much.
 * The change to this code made all the difference:
 * > echo “\n<style>\n#primary{background: url(‘”.$BGIMAGE.”‘);}\n</style>\n”;
 * I’ve added background pix to about 4 pages. Fantastic!
 *  [iam4](https://wordpress.org/support/users/iam4/)
 * (@iam4)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/background-image-4-2/#post-822986)
 * Hallo Mores!
 * First of all, thanks for your plugin, it was exactly what I was looking for.
   
   But as always, we need to customize, I´m absolute new to php, css and so on, 
   but I was able to modifie everything I wanted ´till now. My question is: can 
   I set the position of the background (top center) and no-repeat?
 * the site is here: [http://www.grandtour.at](http://www.grandtour.at)
 * the page in question is the splash page.
 * Ich danke schon im voraus!
 *  [bretttorrium](https://wordpress.org/support/users/bretttorrium/)
 * (@bretttorrium)
 * [17 years ago](https://wordpress.org/support/topic/background-image-4-2/#post-822992)
 * i am a little tech-dumb. i would like to do the same thing on my blog: have all
   the pages have the same background as the homepage. how do i do this?
 * [http://www.bretttorrium.com](http://www.bretttorrium.com)

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘background image’ is closed to new replies.

## Tags

 * [background](https://wordpress.org/support/topic-tag/background/)
 * [image](https://wordpress.org/support/topic-tag/image/)
 * [page](https://wordpress.org/support/topic-tag/page/)

 * 14 replies
 * 6 participants
 * Last reply from: [bretttorrium](https://wordpress.org/support/users/bretttorrium/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/background-image-4-2/#post-822992)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
