Forums

Join
bbPress Support ForumsTroubleshootingSmall template bug (in search.php of default template)

Info

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

  1. 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.

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

  3. 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; ?>
  4. You must log in to post.