Container's Homepage transparent (7 posts)

  1. andreand
    Posted 4 years ago #

    Hi wpmates!

    I wonder if someone have solved the problem that I'll tell you now.

    I'm building a webpage with WP, as a CMS. I'll try to describe the structure:

    1. There is a image in the background (*)
    2. The navigation menu is on the left, and, of course, upper the background
    3. The content (#container) is on the right of the navigation menu, and the background colour is white:
    #container { background-color:#FFFFFF; }

    So, my problem is:

    I'd like the homepage were void, I mean, I'd like the container wasn't white, but transparent, to let the user see the image (*)

    However, I'd like the other sections were white colour:
    #container { background-color:#FFFFFF; }

    How can I solve this?

    Thanks a lot wpmates!

  2. body_class() http://codex.wordpress.org/Function_Reference/body_class

    this would give you some css classes for the body tag, which you can use to style your #container dependant on which page you are on; for instance:

    .home #container { background: none; }

  3. andreand
    Posted 4 years ago #

    Thanks a lot alchymyth!

    But, how can I change the container background colour of the homepage?

    I mean, how can I say that if it's homepage, the container background colour is none?

    Thanks a lot!

  4. .home is the css class that is added to the body tag on the home page.

    the rest is in my first reply.

  5. andreand
    Posted 4 years ago #

    Thanks alchymyth, but my concern is about detection ...

    What I'd like to know is how can I detect that is the homepage.

    There isn't a page called homepage.php ...


    Does somebody know how to solve this?

    Thanks a lot!

  6. andreand
    Posted 4 years ago #

    Another way to solve the same question:

    how can I make a customized homepage?

  7. andreand
    Posted 4 years ago #

    Solved! I modified the index.php:

    get_header(); ?>
    if ( is_home() ) {
        // This is a homepage
    else {
        // This is not a homepage
     <div id="container">
       <div id="content" role="main">
             get_template_part( 'loop', 'index' );
       </div><!-- #content -->
     </div><!-- #container -->
    <?php }
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic