-
Notifications
You must be signed in to change notification settings - Fork 1
/
search-loop.php
60 lines (43 loc) · 2.31 KB
/
search-loop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?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()) : ?>
<p class="info pagetitle"><?php _e( 'Search Results', 'buddypress' ) ?></p>
<div class="navigation">
<div class="alignleft"><?php next_posts_link( __( '« Previous Entries', 'buddypress' ) ) ?></div>
<div class="alignright"><?php previous_posts_link( __( 'Next Entries »', 'buddypress' ) ) ?></div>
<div class="clear" ></div>
</div>
<?php while (have_posts()) : the_post(); ?>
<?php do_action( 'bp_before_blog_post' ) ?>
<div class="post">
<?php if(has_post_thumbnail()):?>
<div class="post-thumb cb-thumb-wrap">
<?php the_post_thumbnail();?>
</div>
<?php endif;?>
<h2 id="post-<?php the_ID(); ?>" class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('l, F jS, Y') ?></small>
<p class="postmetadata"><?php _e( 'Posted in', 'buddypress' ) ?> <?php the_category(', ') ?> | <?php edit_post_link( __( 'Edit', 'buddypress' ), '', ' | '); ?> <?php comments_popup_link( __( 'No Comments »', 'buddypress' ), __( '1 Comment »', 'buddypress' ), __( '% Comments »', 'buddypress' ) ); ?></p>
<?php do_action( 'bp_blog_post' ) ?>
</div>
<?php do_action( 'bp_after_blog_post' ) ?>
<?php endwhile; ?>
<div class="navigation">
<?php if(function_exists("wp_pagenavi"))wp_pagenavi();else{ ?>
<div class="alignleft"><?php next_posts_link( __( '← Previous Entries', 'cb' ) ) ?></div>
<div class="alignright"><?php previous_posts_link( __( 'Next Entries →', 'cb' ) ) ?></div>
<?php }?>
</div>
<?php else : ?>
<h2 class="center"><?php _e( 'No posts found. Try a different search?', 'buddypress' ) ?></h2>
<?php locate_template( array( '/searchform.php'), true ) ?>
<?php endif; ?>