This repository has been archived by the owner on Nov 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
search.php
137 lines (128 loc) · 6.21 KB
/
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php get_header(); ?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
"<?php echo get_search_query(); ?>"
</h1>
</section>
<!-- row -->
<div class="row">
<?php if (get_option('ad_header') != '') : ?>
<div class="col-md-12 hidden-xs hidden-sm ad">
<?php echo stripslashes(get_option('ad_header')); ?>
</div>
<?php endif; ?>
<?php if (get_option('ad_header_mobile') != '') : ?>
<div class="col-md-12 visible-xs visible-sm ad">
<?php echo stripslashes(get_option('ad_header_mobile')); ?>
</div>
<?php endif; ?>
<div class="col-md-12">
<div class="row" id="posts">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="box box-widget">
<div class="box-header with-border">
<div class="user-block">
<span class="username">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"
title="<?php the_title(); ?> "><?php the_title(); ?></a></span>
<ul class="description list-inline">
<li><i class="fa fa-calendar"></i> <?php the_time('d.m.Y ') ?> |</li>
<li><i class="fa fa-user"></i> <a
href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>"
title="<?php the_author(); ?>"><?php the_author(); ?></a> |
</li>
<li><i class="fa fa-folder-open"></i> <?php the_category(', ') ?> |</li>
<li>
<i class="fa fa-comments"></i> <?php comments_number('0 comment', '1 comment', '% comments'); ?>
</li>
</ul>
</div>
<!-- /.user-block -->
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="caption">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium');
if (has_post_thumbnail()) : ?>
<img src="<?php echo $img[0]; ?>" class="img-responsive pad"
alt="<?php the_title(); ?>" title="<?php the_title() ?>"/>
<?php endif ?>
</a>
</div>
<a href="<?php the_permalink() ?>"
title="<?php the_title(); ?>"><?php the_excerpt_rss(); ?></a>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<?php endwhile; ?>
<?php else : ?>
</div>
<div class="error-page">
<h3><i class="fa fa-warning text-yellow"></i> Oops! Articles not found.</h3>
<p>
There is no article.
Meanwhile, you may <a href="<?php bloginfo('url'); ?>">return to home</a> or try using the
search form.
</p>
<form action="<?php bloginfo('url'); ?>" class="search-form">
<div class="input-group">
<input type="text" name="s" class="form-control" placeholder="Search">
<div class="input-group-btn">
<button type="submit" class="btn btn-warning btn-flat"><i class="fa fa-search"></i>
</button>
</div>
</div>
<!-- /.input-group -->
</form>
</div>
<!-- /.error-page -->
<?php endif; ?>
</div>
<div id="inifiniteLoader"><i class="fa fa-2x fa-refresh fa-spin"></i></div>
</div>
<!-- /.row -->
<?php if (get_option('ad_footer') != '') : ?>
<div class="col-md-12 hidden-xs hidden-sm ad">
<?php echo stripslashes(get_option('ad_footer')); ?>
</div>
<?php endif; ?>
<?php if (get_option('ad_footer_mobile') != '') : ?>
<div class="col-md-12 visible-xs visible-sm ad">
<?php echo stripslashes(get_option('ad_footer_mobile')); ?>
</div>
<?php endif; ?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
var count = 2;
var total = <?php echo $wp_query->max_num_pages; ?>;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
if (count > total) {
return false;
} else {
loadArticle(count);
}
count++;
}
});
function loadArticle(pageNumber) {
$('#inifiniteLoader').show();
$.ajax({
url: "<?php echo admin_url(); ?>admin-ajax.php",
type: 'POST',
data: "action=infinite_scroll&page_no=" + pageNumber + '&loop_file=loop&what=search&value=<?php echo get_search_query(); ?>',
success: function (html) {
$('#inifiniteLoader').hide('1000');
$("#posts").append(html);
}
});
return false;
}
});
</script>
<?php get_footer(); ?>