Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30
  1. #11
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

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

    Quote Originally Posted by DivaVocals View Post
    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???

    I think the 1st thing to do would be to determine the value of "$this_is_home_page" isn't somehow being set when NOT the home page.

    The other thing I might try would be to add an 'else' condition to the code so that it explicitly outputs something like
    echo "<style>#ez-feature-top-container-wrap {display: block;}</style>" if NOT the home page.

    Cheers
    RodG

  2. #12
    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
    I'm confused.....

    So you want to hide #ez-feature-top-container-wrap on the homepage only according to the first post right?
    Sorry mistated in OP.. wanna DISPLAY it.. JUST 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.

  3. #13
    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 RodG View Post
    I think the 1st thing to do would be to determine the value of "$this_is_home_page" isn't somehow being set when NOT the home page.
    Right.. except as I indicted earlier I am also using the $this_is_home_page on the same page to display the slideshow ONLY on the home page and that code works just fine..

    Quote Originally Posted by RodG View Post
    The other thing I might try would be to add an 'else' condition to the code so that it explicitly outputs something like
    echo "<style>#ez-feature-top-container-wrap {display: block;}</style>" if NOT the home page.
    Good morning.. Looks like we had the same idea Rod.. After thinking about this overnight I too realized that this was the answer.. So I changed my code as follows:
    Code:
    <?php    
        if ($this_is_home_page) {
            echo "<style>#ez-feature-top-container-wrap {display:block !important;}</style>";
                } else {
            echo "<style>#ez-feature-top-container-wrap {display:none;}</style>";
        }
    ?>
    Now the container displays on the home page ONLY. Thanks everyone for the tips and pointers.. Put it all together and it got me moving in the right direction.. Gotta love the Zen Cart community!!
    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. #14
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

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

    Quote Originally Posted by DivaVocals View Post
    Good morning.. Looks like we had the same idea Rod.. After thinking about this overnight I too realized that this was the answer..
    If this a case of great minds thinking alike, or fools never differ? <g>

    Hmmm. Better not answer that...

    Cheers
    RodG

  5. #15
    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 RodG View Post
    If this a case of great minds thinking alike, or fools never differ? <g>

    Hmmm. Better not answer that...

    Cheers
    RodG
    I'll go with the former..
    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. #16
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

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

    I'm cuious why all the extra coding rather than using the appropriate css stylesheet for the div tag to be shown when on the index page and hidden at all other times?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #17
    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 mc12345678 View Post
    I'm cuious why all the extra coding rather than using the appropriate css stylesheet for the div tag to be shown when on the index page and hidden at all other times?
    Because I can't use the page specific stylesheets to NOT display the container on ALL pages EXCEPT the home unless I'm willing to create a GAZILLION page specific stylesheets whose only purpose would be to support not displaying this one container.. and I did NOT want to create a bunch of stylesheets just to support NOT displaying this one div..

    Happy to be proven wrong if you have a solution that doesn't require me to create a GAZILLION stylsheets to simply NOT display this container on the rest of the site..

    Remember I want it to DISPLAY on the homepage and NOT on the rest of the site..
    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.

  8. #18
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

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

    Why not just wrap the entire container in the if statement, no need for CSS

    <?php
    if ($this_is_home_page) {
    echo '<div id="ez-feature-top-container-wrap">';
    echo 'Content of Container';
    echo '</div>';
    } else {
    echo '';
    }
    ?>

  9. #19
    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 rbarbour View Post
    Why not just wrap the entire container in the if statement, no need for CSS

    <?php
    if ($this_is_home_page) {
    echo '<div id="ez-feature-top-container-wrap">';
    echo 'Content of Container';
    echo '</div>';
    } else {
    echo '';
    }
    ?>
    The code is coming from WordPress.. Hence why I HAVE to use the CSS to hide this container.. I could hire a developer to write a bunch of code to do this with code and no CSS.. This was a simpler solution.. and it works so I don't see the downside here.. Happy to be proven wrong though..
    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.

  10. #20
    Join Date
    Feb 2010
    Location
    Syracuse, NY
    Posts
    2,159
    Plugin Contributions
    17

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

    Not my intentions, I also agree that their is no downside, just giving alternatives and suggestions.

    Quote Originally Posted by DivaVocals View Post
    The code is coming from WordPress.. Hence why I HAVE to use the CSS to hide this container.. I could hire a developer to write a bunch of code to do this with code and no CSS.. This was a simpler solution.. and it works so I don't see the downside here.. Happy to be proven wrong though..

 

 
Page 2 of 3 FirstFirst 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