-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop-search.php
89 lines (71 loc) · 2.84 KB
/
loop-search.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?
/**
* @package WordPress
* @subpackage WP-Skeleton
*/
?>
<ul id="search_posts">
<?php
while ( have_posts() ) : the_post();
$is_page_locked_student = get_post_meta(get_the_id(), '_cmb_student_portal_checkbox', true);
$is_page_locked_staff = get_post_meta(get_the_id(), '_cmb_staff_portal_checkbox', true);
if ($is_page_locked_staff == 'on' && $_SESSION['Login_Status'] != "staff") {
continue;
}
if ($is_page_locked_student == 'on' && $_SESSION['Login_Status'] != "student") {
continue;
}
?>
<li id="post-<?php the_ID(); ?>">
<div class="title">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title('<h3>', '</h3>'); ?></a> <!--Post titles-->
</div>
<?
add_filter( 'the_excerpt', 'strip_shortcodes');
echo apply_filters('the_excerpt', utf8_truncate( get_the_content(), $max_chars = 200, $append = "\xC2\xA0…" ));
?> <!--The Content-->
<!--The Meta, Author, Date, Categories and Comments-->
<?
if(! is_page() && get_post_type() == 'post') { ?>
<div class="meta">
Date posted: <?php echo get_the_date(); ?>
| Author: <?php the_author_posts_link(); ?>
| <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
<p>Categories: <?php the_category(' '); ?></p>
</div><?
}
?>
<hr />
</li>
<?php endwhile; ?><!-- End the Loop -->
</ul>
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<nav id="nav-below">
<?php
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
$big = 99999999;
echo '<ul class="bootpag">';
str_replace($big, '%#%', get_pagenum_link($big));
$links = paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '/page/%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_next' => false,
'show_all' => true,
'type' => 'array',
));
foreach($links as $link){
echo '<li>',$link,'</li>';
}
echo '</ul>';
}
?>
</nav><!-- #nav-below -->
<?php endif; ?>
<?php /* Only load comments on single post*/ ?>
<?php if(! is_page() || is_single()) : comments_template( '', true ); endif; ?>