-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhome.php
133 lines (102 loc) · 5.21 KB
/
home.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
<?php get_header(); ?>
<div class="container bg-light pb-5 pt-4 px-md-5 cont">
<div class="row pb-5">
<div class="col text-center">
<p class="display-4 mb-4"><?php _e('All news', 'legalizebelarus'); ?></p>
<a href="/<?php _e('press', 'legalizebelarus'); ?>">
<div class="badge-primary badge shadow my-1"><?php _e('Press service', 'legalizebelarus'); ?></div>
</a>
<a href="/<?php _e('drugs', 'legalizebelarus'); ?>">
<div class="badge-primary badge shadow my-1"><?php _e('Drugs News', 'legalizebelarus'); ?></div>
</a>
<a href="/<?php _e('media', 'legalizebelarus'); ?>">
<div class="badge-primary badge shadow my-1"><?php _e('Media mentions', 'legalizebelarus'); ?></div>
</a>
<a href="/<?php _e('stories', 'legalizebelarus'); ?>">
<div class="badge-primary badge shadow my-1"><?php _e('Stories of the convicted', 'legalizebelarus'); ?></div>
</div>
</div>
<?php
$page = (get_query_var('page')) ? get_query_var('page') : 1;
$query = new WP_Query(array(
'posts_per_page' => 10,
'paged' => $page
));
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
?>
<a href="<?php echo the_permalink() ?>" class="no-dec text-dark">
<div class="row mb-4 post-container mx-3">
<div class="col-lg-3 px-0">
<div class="h-100 rad-l news_wrapper">
<div class="img_holder"
style="background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.7)),
url(<?php the_post_thumbnail_url('medium_large'); ?>);"></div>
<div class="align-items-end post_thumbnail p-3 d-flex flex-column">
<div>
<span class="badge badge-secondary"><?php echo get_the_date('j F Y'); ?></span>
</div>
</div>
</div>
</div>
<div class="col-lg-9 px-0">
<div class="container d-flex flex-column h-100 w-100">
<div class="py-2">
<h4 class="pb-1"><?php the_title(); ?></h4>
<p class="font-weight-normal"><?php if (!has_excerpt()) {
echo '';
} else {
echo get_the_excerpt();
} ?></p>
</div>
<div class="d-flex justify-content-end mt-auto pb-3 w-100">
<div class="d-inline-flex px-1 badge-primary badge" style="opacity:0">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-eye-fill"
fill="white"
xmlns="http://www.w3.org/2000/svg">
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
<path fill-rule="evenodd"
d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
</svg>
<span> <?php echo getPostViews(get_the_ID()); ?></span>
</div>
</div>
</div>
</div>
</div>
</a>
<?php endwhile; ?>
<div class="container text-center pt-3">
<?php
echo paginate_links(array(
'base' => get_permalink(get_option('page_for_posts')) . '%_%',
'total' => $query->max_num_pages,
'current' => max(1, get_query_var('page')),
'format' => '%#%',
'show_all' => false,
'type' => 'plain',
'end_size' => 2,
'mid_size' => 3,
'prev_next' => true,
'prev_text' => '←',
'next_text' => '→',
'add_args' => false,
'add_fragment' => '',
));
?>
</div>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<?php endif; ?>
</div>
</div>
<script>
jQuery(document).ready(function () {
jQuery('.flex-column').mouseover(function () {
jQuery(this).find('.badge-primary').css('opacity', '1');
});
jQuery('.flex-column').mouseout(function () {
jQuery(this).find('.badge-primary').css('opacity', '0');
});
});
</script>
<?php get_footer(); ?>