WordPress.org

Support

Support » Themes and Templates » Container's Homepage transparent

Container's Homepage transparent

  • 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!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Michael

    @alchymyth

    Forum Moderator

    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; }

    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!

    Moderator Michael

    @alchymyth

    Forum Moderator

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

    the rest is in my first reply.

    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 …

    So?

    Does somebody know how to solve this?

    Thanks a lot!

    Another way to solve the same question:

    how can I make a customized homepage?

    Solved! I modified the index.php:

    <?php
    
    get_header(); ?>
    
    <?php
    if ( is_home() ) {
        // This is a homepage
    } 
    
    else {
        // This is not a homepage
    ?>
    
     <div id="container">
       <div id="content" role="main">
    
          <?php
             get_template_part( 'loop', 'index' );
          ?>
       </div><!-- #content -->
     </div><!-- #container -->
    
    <?php }
    ?>
    
    <?php get_footer(); ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Container's Homepage transparent’ is closed to new replies.