ThemeShaper Forums » Thematic

[closed]

Resize background image in

(4 posts)
  • Started 4 years ago by initialsbr
  • Latest reply from flick
  • This topic is not resolved
  1. initialsbr
    Member

    I am trying to place a large background image in the child theme I am developing. I want it to be 100% width all the time and resize with the window. In the past I have put this code...

    <div><img id="diamondigloo" title="" alt="" src="images/diamondigloobackground.jpg"/></div>

    ...at the end of my footer.php page and this in the css...

    #diamondigloo {
    position: absolute;
    width: 100%;
    height: auto;
    top: 0;
    left: 0;
    z-order: 1;
    }

    But I want to do this the right way with a child theme. How would I go about that? Do I make a plugin or add a function to functions.php? I'm definitely new to this hooks and filters and plugins business, so some guidance would be wonderful.

    Thanks!

    Posted 4 years ago #
  2. @initialsbr: I am very new to Thematic as well and have spent a lot of time during the past two days thinking I must be too dim to grasp the concepts. Hopefully what I've posted below is somewhat correct - though corrections are always welcome:

    You've probably seen this visual guide to Thematic already: http://bluemandala.com/thematic/thematic-structure.html

    And from what I can gather, the appropriate thing to use for your background image would be a Hook rather than a Filter (http://wynnnetherland.com/2009/10/build-a-wordpress-theme-with-thematic/)

    So if you did want to continue inserting the same code into the footer (is this where the background should go?) I presume you might use something like this in your functions.php file:

    function 100bg() { ?>
    <div><img id="diamondigloo" title="" alt="" src="images/diamondigloobackground.jpg"/></div>
    <?php }
    add_action('thematic_belowfooter', '100bg');

    It might well be ok to use thematic_after instead of thematic_belowfooter (as per the design structure).

    And the rest of the CSS would go in style.css as usual.

    Hopefully this is correct and possibly somewhat helpful. I opted for a static background in the end for my own site.

    Posted 4 years ago #
  3. initialsbr
    Member

    Thanks. That totally worked. And thanks for the hooks reference. That will be extremely helpful!

    Posted 4 years ago #
  4. @initialsbr: Glad you found it helpful :) Hopefully we'll get to see your site in the showcase soon!

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.