WordPress.org

Support

Support » How-To and Troubleshooting » Editing background image in template

Editing background image in template

  • Hi,

    I’m working with the Eximius theme. I’m having trouble editing the background image.

    In the theme functions (functions.php) page, it seems to get set the bgcolor in an array, but if i change that default color, nothing updates:

    $options = array (
    array(
    “id” => “Eximius_bgcolor”,
    “default” => “636566”,
    “type” => “Eximius_bgcolor”),

    I can’t seem to override it with a background image.

    I created a custom home page for my start page, I added a style tag to the top of the page: <style type=”text/css” media=”all”>
    body { background-image: url(“…images/background.jpg”) repeat-x; }
    </style>

    but it still shows up as that color 636566…?

    The only time I got rid of the background color was when I didn’t use this: <?php get_header( $name ); ?> in the custom home page that I made.

    In my custom template, if I took that get_header function out and just hardcoded in my nav and header image, the body tag above worked, but I’d rather not have to manually edit my nav if something changes each time. Plus, I want to override the background color on all the other pages that use the theme.

    Any suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • wordpress needs absolute file paths for background images in embedded css styles (different from styles in style.css);
    also, you background style is an invalid mix of the long and short css declaration.

    you could try:

    <style type="text/css" media="all">
    body { background-image: url("<?php bloginfo('template_url'); ?>/images/background.jpg");
    background-repeat: repeat-x; }
    </style>

    http://codex.wordpress.org/Function_Reference/bloginfo

    http://www.w3schools.com/css/css_background.asp

    I tried added this to my custom page template:
    <style type=”text/css” media=”all”>
    body { background-image: url(“<?php bloginfo(‘template_url’); ?>http://…../images/background.jpg”);
    background-repeat: repeat-x; }
    </style>

    but it still shows up with the gray color in the background and not the image?

    You use

    <style type="text/css" media="all">
    body { background-image: url("<?php bloginfo('template_url'); ?>http://...../images/background.jpg");
    background-repeat: repeat-x; }
    </style>

    use this to solve this problem

    <style type="text/css" media="all">
    body { background-image: url("<?php bloginfo('template_url'); ?>/images/background.jpg");
    background-repeat: repeat-x; }
    </style>

    I copied this code excatly:

    <style type=”text/css” media=”all”>
    body { background-image: url(“<?php bloginfo(‘template_url’); ?>/images/background.jpg”);
    background-repeat: repeat-x; }
    </style>

    into my custom home page template….but no luck. It still shows the gray color as the background and not my image?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Editing background image in template’ is closed to new replies.
Skip to toolbar