-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.php
113 lines (79 loc) · 3.16 KB
/
archive.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
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
get_header(); $paged = ($_GET["paging"]) ? esc_attr($_GET["paging"]) : 1; ?>
<!-- / banner container \ -->
<section id="bannerCntr">
<!-- / inner box \ -->
<article class="innerbannerBox" style="background: url(<?php if(get_field('banner_image')): ?><?php the_field('banner_image'); ?><?php else: ?><?php the_field('banner_image',9); ?><?php endif; ?>) no-repeat top center / cover;">
<div class="mycontainer">
<div class="text">
<h2><?php _e('News'); ?></h2>
</div>
</div>
</article>
<!-- \ banner box / -->
</section>
<!-- \ banner container / -->
<!-- / middle container \ -->
<section id="middleCntr">
<!-- / breadcrumb box \ -->
<article class="breadcrumbBox">
<div class="mycontainer">
<?php if(function_exists('bcn_display')){ bcn_display(); }?>
</div>
</article>
<!-- \ breadcrumb box / -->
<!-- / news box \ -->
<article class="newsBox">
<div class="mycontainer">
<div class="row">
<aside class="left col-xs-12 col-sm-8 col-md-9 col-lg-9">
<?php
$args = array(
'post_type' => 'post',
'orderby' => 'id',
'posts_per_page' => 3,
'paged' => $paged
);
$loop = new WP_Query($args); $page_count= $loop->max_num_pages;
if($loop->have_posts()): while($loop->have_posts()): $loop->the_post(); ?>
<div class="item">
<div class="date"><?php the_date("d - M"); ?></div>
<div class="news">
<?php the_post_thumbnail(); ?>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<span><i class="fa fa-user"></i> Posted By <?php echo get_the_author(); ?></span>
<p><?php echo wp_trim_words( get_the_content(), 65, '...' ); ?></p>
<a href="<?php the_permalink() ?>" class="mybtn">Read more</a>
</div>
</div>
<?php endwhile; wp_reset_query(); endif; ?>
<div class="page">
<?php if($page_count > 1): ?>
<?php $prev = (($paged - 1) >= 0) ? $paged - 1 : false; ?>
<?php $next = (($paged + 1) <= $page_count) ? $paged + 1 : false; ?>
<?php if($prev): ?>
<a class="active" href="<?php echo add_query_arg("paging", $prev) ?>"><i class="fa fa-angle-left"></i></a>
<?php endif; ?>
<?php for($i = max(1, $paged - 3); $i <= min($paged + 3, $page_count); $i++): ?>
<a <?php if($paged == $i): ?> class="active" <?php endif; ?> href="<?php echo add_query_arg("paging", $i) ?>"><?= $i ?></a>
<?php endfor; ?>
<?php if($next): ?>
<a class="active" href="<?php echo add_query_arg("paging", $next) ?>"><i class="fa fa-angle-right"></i></a></li>
<?php endif; wp_reset_query(); ?>
<?php endif; ?>
</div>
</aside>
<aside class="right col-xs-12 col-sm-4 col-md-3 col-lg-3">
<?php dynamic_sidebar('sidebar'); ?>
</aside>
</div>
</div>
</article>
<!-- \ news box / -->
</section>
<!-- \ middle container / -->
<?php get_footer(); ?>