WordPress.org

Ready to get started?Download WordPress

Forums

Please help :) (3 posts)

  1. blechblehblah
    Member
    Posted 4 years ago #

    Hello. I'm having trouble with the following code:

    <?php
    // Checks to see whether it needs a sidebar or not. If not, post a search box
    if ( empty($withcomments) && !is_single() ) { echo '<div id="footer">';
    else get_search_form && echo '<div id="footer">';} ?>

    It's goal:
    If there is a sidebar, just post div#footer
    If there isn't, post a search box right before posting div#footer

    Help would be greatly appreciated :) Thanks

  2. stvwlf
    Member
    Posted 4 years ago #

    Your code is missing an closing and opening brace, and the two statements in the second part were started incorrectly. Just moving it around a little:

    <?php
    // Checks to see whether it needs a sidebar or not. If not, post a search box
    if ( empty($withcomments) && !is_single() ) {
    //
    } else {
       get_search_form;
    }
    echo '<div id="footer">'; ?>

    I didn't check the logic you are using, just stated it in a way that what you are trying will run.

  3. 112502
    Member
    Posted 4 years ago #

    Umm ... *blink*

    <?php
    // Checks to see whether it needs a sidebar or not. If not, post a search box
    if ( !empty($withcomments) && is_single() ) { get_search_form(); }
    echo '<div id="footer">';
    ?>

    Or ...

    <?php
    // Checks to see whether it needs a sidebar or not. If not, post a search box
    if ( !empty($withcomments) && is_single() ) { get_search_form(); }
    ?>
    <div id="footer">

    I mean ... just to keep things .... simple ...

Topic Closed

This topic has been closed to new replies.

About this Topic