• Hi all

    I’m pretty good with CSS and stylesheets but I am a total novice with php.

    So I wonder if anyone can help me with this little snippet in the header of my new template for a client:

    <div class=”slider”>
    <?php

    if ( is_front_page() ) {

    if (function_exists(“easing_slider”)){ easing_slider(); };

    }

    ?>

    So far so good. It works.

    Now my problem: Since the div class slider is styled via my stylesheet, where I have given it a fixed height and also a small box shadow, on the rest of the site this code removes the slider successfully but leaves the gap where it should be and the shadow.

    So what else do I add to make this disappear altogether on all other pages than my front page?

    The site is on this test server https://213.175.194.240:8000/

    Thanks in advance for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • your posted snippet does not show the closing of the <div class="slider">;
    therefore it is slightly difficult to give you a solution.

    general (closing div included):

    <?php if( is_front_page() && function_exists("easing_slider") ) { ?>
    <div class="slider">
    <?php easing_slider(); ?>
    </div>
    <?php } ?>
    Thread Starter Vishy Moghan

    (@vishy-moghan)

    Hi alchymyth

    yeah I may have missed a line there.

    This is the code at the bottom of the header.php

    <div class=”base-box-body base-sheet-body”>
    <div class=”slider”>
    <?php

    if ( is_front_page() ) {

    if (function_exists(“easing_slider”)){ easing_slider(); };

    }
    else
    {

    }

    ?>
    </div>
    <div class=”cleared reset-box”></div>

    So tell me though, the problem as you see it is that I have the div class=”slider” before the conditional and not inside it? Am I right?

    But on the plus side I just tried your code and it seems to work perfectly. Thanks a huge amount.

    You have just made my day. I guess i will have to learn php properly one of these days.

    But I have another question on this point.

    How would I use and else conditional to load something else in place of this?

    Say for example I want to put a slogan or a ticker or whatever in it’s place. In this case (say I create a div class “other’) how would I write the else condition so that my header on other pages loads a div of a style-able sort where I can insert say an image from a given directory and into a controlled height? Without confusing the page with clashing styles.

    But thanks a lot for this help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php help’ is closed to new replies.