ASong2U_Web/wp-content/themes/score/search-loop.php

55 lines
2.0 KiB
PHP
Raw Permalink Normal View History

<?php /* this search loop shows your blog posts in the unified search
you may modify it as you want, It is a copy from my theme
*/
?>
<?php do_action('bp_before_blog_search') ?>
<?php
global $wp_query;
$wp_query->is_search = true;
$search_term = $_REQUEST['search-terms'];
if (empty($search_term))
$search_term = $_REQUEST['s'];
$wp_query->query("s=" . $search_term);
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()):the_post();
global $post; ?>
<?php do_action('bp_before_blog_post') ?>
<div> <!-- Post goes here... -->
<div>
<h3><?php the_title(); ?></h3>
<div>
<?php the_excerpt(); ?>
</div>
<div> </div>
</div>
<div>
<span><?php the_time('F j, Y') ?> | <?php the_category(', ') ?> | <?php comments_popup_link(__('No Comments &#187;', 'bpmag'), __('1 Comment &#187;', 'bpmag'), __('% Comments &#187;', 'bpmag')); ?></span>
<div><a href="<?php the_permalink(); ?>"><?php _e("Read more...", "bpmag"); ?></a></div>
</div>
</div><!-- Post ends here... -->
<?php do_action('bp_after_blog_post') ?>
<?php endwhile; ?>
<?php if (!bpmag_is_advance_search()): ?>
<div>
<?php if (function_exists("wp_pagenavi")) wp_pagenavi();else { ?>
<div><?php next_posts_link(__('&larr; Previous Entries', 'bpmag')) ?></div>
<div><?php previous_posts_link(__('Next Entries &rarr;', 'bpmag')) ?></div>
<?php } ?>
</div>
<?php endif; ?>
<?php else : ?>
<div>
<div>
<?php echo sprintf(__("We are sorry, but we could not find anything for the search term '%s'", "bpmag"), $search_term); ?>
<?php locate_template(array('searchform.php'), true) ?>
</div>
</div>
<?php endif; ?>
<?php do_action('bp_after_blog_search') ?>