WordPress.org

Forums

[resolved] Hide a Div tag on all but the home page (10 posts)

  1. loldblog
    Member
    Posted 10 months ago #

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

  2. esmi
    Forum Moderator
    Posted 10 months ago #

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

  3. loldblog
    Member
    Posted 10 months ago #

    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

  4. esmi
    Forum Moderator
    Posted 10 months ago #

    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;?>
  5. loldblog
    Member
    Posted 10 months ago #

    Still getting the same error :(

  6. esmi
    Forum Moderator
    Posted 10 months ago #

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

  7. alchymyth
    Forum Moderator
    Posted 10 months ago #

    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; ?>
  8. esmi
    Forum Moderator
    Posted 10 months ago #

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

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

  9. loldblog
    Member
    Posted 10 months ago #

    Thank you

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

    got it to work right.

  10. loldblog
    Member
    Posted 10 months ago #

    Forgot to resolve.

Reply

You must log in to post.

About this Topic