Skip to:

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

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:

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

Skip to toolbar