-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-detailed-blogging.php
128 lines (116 loc) · 5.64 KB
/
template-detailed-blogging.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
<?php /* Template Name: Detailed Blogging */ ?>
<?php get_header(); ?>
<!-- Latest Articles -->
<section class="flex justify-center ">
<div id="courses" class="w-[80%] pt-10">
<h2 class="text-3xl font-bold leading-tight text-center text-black sm:text-4xl lg:text-5xl">
Latest Articles
</h2>
<div class="justify-items-center">
<div id="blog1" class="grid w-full grid-cols-1 mt-5 md:grid-cols-2 lg:grid-cols-3 md:gap-4 lg:gap-5 justify-items-center">
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'posts_per_page' => 12,
'paged' => $paged,
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
$url = get_the_permalink();
$title = get_the_title();
$date = get_the_date();
$thumbnail = get_the_post_thumbnail_url();
?>
<div class="flex items-stretch py-4 ">
<div class="h-auto overflow-hidden rounded shadow-lg group hover:shadow-2xl">
<a href="<?php echo $url; ?>"><img class="group-hover:opacity-80" src="<?php echo $thumbnail; ?>" alt="<?php echo $title; ?>" class="w-auto"></a>
<div class="p-5 text-center md:text-left">
<p class="mt-2 text-2xl font-semibold">
<a href="<?php echo $url; ?>" title="<?php echo $title; ?>" class="text-black group-hover:text-[#ee4a03]">
<?php echo $title; ?>
</a>
</p>
<p class="block mt-6 text-sm font-semibold tracking-widest text-center text-gray-500 uppercase">
Published on <?php echo $date; ?>
</p>
</div>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
else :
echo '<p>No posts found.</p>';
endif;
?>
</div>
<a href=""
class="visible px-3 mt-4 font-sans text-xl font-medium text-black border-0 rounded md:hidden lg:invisible bg-gray-50">View
All <i class="fa-solid fa-arrow-right"></i></a>
</div>
</div>
</section>
<div class="flex justify-center py-10">
<div class="w-[120px] flex justify-around gap-5">
<?php ravig_pagination($the_query);?>
</div>
</div>
<!-- Trending Now -->
<section class="flex justify-center py-16">
<div id="courses" class="w-[80%] pt-10">
<h2 class="text-3xl font-bold leading-tight text-center text-black sm:text-4xl lg:text-5xl">
Trending Now
</h2>
<div id="blog2" class="grid w-full grid-cols-1 mt-5 md:grid-cols-2 lg:grid-cols-3 md:gap-4 lg:gap-5 justify-items-center">
<?php
$trending_posts_args = array(
'post_type' => 'post',
'posts_per_page' => 6,
'meta_query' => array(
array(
'key' => 'trending_post',
'value' => 'yes',
'compare' => '=',
)
)
);
$trending_posts_query = new WP_Query($trending_posts_args);
if ( $trending_posts_query->have_posts() ) :
while ( $trending_posts_query->have_posts() ) : $trending_posts_query->the_post();
$url = get_the_permalink();
$title = get_the_title();
$date = get_the_date();
$thumbnail = get_the_post_thumbnail_url();
?>
<div class="flex items-stretch py-4 ">
<div class="h-auto overflow-hidden rounded shadow-lg group hover:shadow-2xl">
<a href="<?php echo $url; ?>"><img class="group-hover:opacity-80" src="<?php echo $thumbnail; ?>" alt="<?php echo $title; ?>" class="w-auto"></a>
<div class="p-5 text-center md:text-left">
<p class="mt-2 text-2xl font-semibold">
<a href="<?php echo $url; ?>" title="<?php echo $title; ?>" class="text-black group-hover:text-[#ee4a03]">
<?php echo $title; ?>
</a>
</p>
<p class="block mt-6 text-sm font-semibold tracking-widest text-center text-gray-500 uppercase">
Published on <?php echo $date; ?>
</p>
</div>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
else :
echo '<p>No posts found.</p>';
endif;
?>
</div>
</div>
</section>
<div class="flex justify-center py-10">
<div class="w-[120px] flex justify-around gap-5">
<?php ravig_pagination($trending_posts_query);?>
</div>
</div>
<?php get_footer(); ?>