Skip to:
Content
Pages
Categories
Search
Top
Bottom

Small template bug (in search.php of default template)


  • Fakey
    Member

    @wyday

    After a search for a word that appears only in the topic title (but not the tags, nor post content) the results are listed, followed by:

    No results found.

    This is because the if statement is looking for the local variable $topics, instead of the correct variable $titles.

    It’s a small fix, but I didn’t know how to post on the bbPress bugtracker.

Viewing 2 replies - 1 through 2 (of 2 total)

  • FCB
    Member

    @fcb

    So i think the database field title is not included in the search ?


    Fakey
    Member

    @wyday

    Oh no, quite the contrary. The results are shown fine too. The problem is when the titles are show a local variable $topics is created:

    <?php
    foreach ( $titles as $topic ) :
    $count = $topic->topic_posts;
    ?>

    This is all fine and dandy, but, as you can see, $topic is a local variable and won’t be any use further down the page when the code checks whether results have been returned or not.

    I hope I’m making myself clear. Let me reiterate just for kicks: The title results show up fine, but the php code prints “No results found.” as well. Just change $topics to $titles in the following code in the template file “search.php”:

    <?php if ( !$topics && !$recent && !$relevant && !$users) : ?>
    <?php _e('No results found.') ?>

    <?php endif; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar