WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Hide a Div tag on all but the home page

[Resolved] Hide a Div tag on all but the home page

  • Hi, I am new to word press I have been doing a ton of searches and still not get any of the options I have found to work. So I am hoping someone can help me.
    I would like to hide a specific div on all pages expect I want it to show on the home page.

    Any suggestions would be much appreciated here is what I have.

    <? php function meteor_slideshow() { if (is_front_page() ) { ?>)
    
    <div id="meteor-slideshow">
    <?php if (  is_front_page( 'meteor_slideshow' ) ) { meteor_slideshow( 
    
    "MainSlideshow"); } ?>
    </div><?php
    }
    } ?>

    CSS:
    #meteor-slideshow {
    background-color: #FFF;
    border: medium solid #000;
    margin-top: 15px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
    width: 930px;
    position: relative;
    padding: 5px;
    }

Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi
    Forum Moderator

    @esmi

    I can’t see anything wrong with the above code snippet.

    When I put that in the page.php it gives me this error

    Parse error: syntax error, unexpected T_FUNCTION /page.php on line 16

    any thoughts

    esmi
    Forum Moderator

    @esmi

    Try:

    <?php function meteor_slideshow();
    if (is_front_page() ) :?>
    <div id="meteor-slideshow">
    <?php if (  is_front_page( 'meteor_slideshow' ) )  meteor_slideshow( "MainSlideshow"); ?>
    </div>
    <?php endif;?>

    Still getting the same error 🙁

    esmi
    Forum Moderator

    @esmi

    I can’t see any errors in the code I posted above.

    Michael
    Forum Moderator

    @alchymyth

    what is the purpose of this line:
    function meteor_slideshow(); ?

    also ‘is_front_page()‘ does not use any parameter;
    http://codex.wordpress.org/Function_Reference/is_front_page

    you possibly only need to use this code:

    <?php if ( is_front_page() ) : ?>
    <div id="meteor-slideshow">
    <?php  meteor_slideshow( "MainSlideshow" ); ?>
    </div>
    <?php endif; ?>

    esmi
    Forum Moderator

    @esmi

    what is the purpose of this line:
    function meteor_slideshow(); ?

    Shoot! Missed that! Perhaps it’s meant to be an if(function_exists('')) conditional?

    Thank you

    <?php if ( is_front_page() ) : ?>
    <div id="meteor-slideshow">
    <?php  meteor_slideshow( "MainSlideshow" ); ?>
    </div>
    <?php endif; ?>

    got it to work right.

    Forgot to resolve.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Hide a Div tag on all but the home page’ is closed to new replies.