Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Apply background image just on homepage [WP]

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40451
    dynamyc
    Member

    I’m using a wordpress theme and I want to apply a background image to a div just on homepage.

    How can I do this ?

    #121742
    Melindrea
    Participant

    Depending on which page you are on, the body will have different classes, assuming your WordPress Theme calls the function body_class.

    The homepage has the class “home”, so you can use that to target the div, since my understanding of your question means that you don’t have other ways to differentiate this div from others.

    #121808
    dynamyc
    Member

    Thank you for your suggestion!
    And I assume I have to write a php funtction like “if body has homepage class apply that css property”
    Can you help me with this ?

    #121817
    wolfcry911
    Participant

    .home .yourdivclassorid { background: #fff url(yourimg.png) no-repeat top center; }

    as an example

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Other’ is closed to new topics and replies.