WordPress.org

Ready to get started?Download WordPress

Forums

Editing background image in template (5 posts)

  1. iluvwrdpress
    Member
    Posted 3 years ago #

    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?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    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

  3. iluvwrdpress
    Member
    Posted 3 years ago #

    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?

  4. maidulislam
    Member
    Posted 3 years ago #

    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>
  5. iluvwrdpress
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic