Page 1 of 3 123 LastLast
Results 1 to 10 of 30
  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Hide a <div> in JUST the home page..

    So I'm trying this code to hide a <div> on JUST on the home page:

    Code:
    <?php    
    if ($this_is_home_page) {
    echo "<style>#ez-feature-top-container-wrap {display: none;}</style>";
    } 
    ?>
    To my dismay it works on EVERY page.. What did I miss/do wrong here???
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,505
    Plugin Contributions
    88

    Default Re: Hide a <div> in JUST the home page..

    The code itself looks OK, but where are you using that? In a template file (should work)? In a function (it'll need a global $this_is_home_page; definition). Is it in an initialization file where the variable has not yet been set?

  3. #3
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Hide a <div> in JUST the home page..

    Quote Originally Posted by lat9 View Post
    The code itself looks OK, but where are you using that? In a template file (should work)? In a function (it'll need a global $this_is_home_page; definition). Is it in an initialization file where the variable has not yet been set?
    I'm using it in a template file:
    includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php

    Using this code later on the page to show the slideshow on the home page and it works fine
    Code:
    <?php    
    if ($this_is_home_page) {
    echo do_shortcode("[huge_it_slider id='1']");
    } 
    ?>
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  4. #4
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,748
    Plugin Contributions
    0

    Default Re: Hide a <div> in JUST the home page..

    have you tried dropping this into the bottom of the stylesheet?
    Code:
    #indexHomeBody #ez-feature-top-container-wrap {display:none}
    that or something like that should work as the only place #indexHomeBody exists is the homepage
    Mike
    GeekHost - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  5. #5
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Hide a <div> in JUST the home page..

    Quote Originally Posted by barco57 View Post
    have you tried dropping this into the bottom of the stylesheet?
    Code:
    #indexHomeBody #ez-feature-top-container-wrap {display:none}
    that or something like that should work as the only place #indexHomeBody exists is the homepage
    Except I WANT this code to display on the home page, but nowhere else...
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  6. #6
    Join Date
    Jul 2009
    Location
    picaflor-azul.com
    Posts
    6,930
    Plugin Contributions
    45

    Default Re: Hide a <div> in JUST the home page..

    Quote Originally Posted by DivaVocals View Post
    Except I WANT this code to display on the home page, but nowhere else...
    use the same thing but with display:block !important;

    Thanks,

    Anne

  7. #7
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,748
    Plugin Contributions
    0

    Default Re: Hide a <div> in JUST the home page..

    I'm confused.....
    So I'm trying this code to hide a <div> on JUST on the home page
    So you want to hide #ez-feature-top-container-wrap on the homepage only according to the first post right?
    Mike
    GeekHost - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  8. #8
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Hide a <div> in JUST the home page..

    Quote Originally Posted by picaflor-azul View Post
    use the same thing but with display:block !important;

    Thanks,

    Anne
    If this is what you meant, this didn't work either..

    Code:
    <?php    
    if ($this_is_home_page) {
    echo "<style>#ez-feature-top-container-wrap {display:block !important;}</style>";
    } 
    ?>
    The code now displays on all pages.. I only want to display it on the home page..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  9. #9
    Join Date
    Jul 2009
    Location
    picaflor-azul.com
    Posts
    6,930
    Plugin Contributions
    45

    Default Re: Hide a <div> in JUST the home page..

    Quote Originally Posted by DivaVocals View Post
    If this is what you meant, this didn't work either..

    Code:
    <?php    
    if ($this_is_home_page) {
    echo "<style>#ez-feature-top-container-wrap {display:block !important;}</style>";
    } 
    ?>
    The code now displays on all pages.. I only want to display it on the home page..
    No, I meant to add the code to the stylesheet

    Thanks,

    Anne

  10. #10
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Hide a <div> in JUST the home page..

    I tried this in tpl_main_page.php

    <?php
    if ($this_is_home_page) {
    echo "<style>div#logoWrapper {display: none;}</style>";
    }
    ?>

    Completely hides the Logo Wrapper on home page only.

    <?php
    if ($this_is_home_page) {
    echo "<style>div#logoWrapper {visibility: hidden;}</style>";
    }
    ?>

    Also works removing the logo but maintaining the space

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Checkout Confirmation Page - Radio Button to Hide Div
    By limelites in forum General Questions
    Replies: 0
    Last Post: 1 May 2012, 11:28 PM
  2. I can see the banner just in the home page...
    By Chris1 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 3 Feb 2011, 11:02 AM
  3. where is the div tag for... Home :: All Products
    By hangman21 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 19 Jul 2010, 09:11 AM
  4. Changing Page Titles. Not just on the Home Page
    By Globie in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 30 Aug 2008, 11:35 PM
  5. How to get just text on the home page?
    By heapy in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 27 Sep 2007, 06:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR