-
Notifications
You must be signed in to change notification settings - Fork 0
/
all-networks.php
151 lines (116 loc) · 5.8 KB
/
all-networks.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php get_header();
/*
Template name: All Networks
*/
?>
<!-- section divider -->
<div class="container mt-30">
<div class="row">
<!-- right side content -->
<div class="col-lg-10 offset-lg-1">
<!-- hero section -->
<div class="row">
<?php
// WP_Query arguments
$args = array(
'post_type' => 'post',
);
// The Query
$query = new WP_Query( $args );
// Restore original Post Data
wp_reset_postdata();
?>
<!-- Blog-->
<div class="premium-networks global-card mt-30">
<div class=" mb-20 px-4">
<h6 class="section-title mb-40">
<?php the_title();?>
</h6>
<!-- blog content image -->
<img class="mb-40" src="<?php echo get_the_post_thumbnail_url(); ?>" alt="">
<p class="mb-30">
<?php
$premium = new WP_Query( array(
'post_type' => 'network',
'category' => 'premium-networks',
'posts_per_page' => -1
) );
while($premium->have_posts()) : $premium->the_post();
$meta = get_post_meta(get_the_ID(), '_adnets_network_options', true);
$rating = isset($meta['rating']) ? $meta['rating'] : 0;
$total_comments = get_comments_number();
$comments = get_comments(array(
'post_id' => get_the_ID(),
));
$total_rating = 0;
foreach($comments as $comment) {
$comment_id = $comment->comment_ID;
$comment_rating = get_comment_meta( $comment_id, 'ic_review_rating', true);
$total_rating += $comment_rating;
}
$average_rating = number_format( (float)$total_rating/get_comments_number(), 2, '.', '' );
?>
<!-- single card -->
<div class="mp_single-card d-flex align-items-center mt-30 mx-4">
<!-- left side img -->
<div class="me-md-4">
<?php the_post_thumbnail(); ?>
</div>
<div>
<!-- top -->
<span class="top-card-info">
<a href="<?php the_permalink(); ?>">
<h6 class="title"><?php the_title(); ?></h6>
</a>
<span class="ratings-wrapper">
<?php for($i = 0; $i < round( $average_rating ); $i++) : ?>
<a href=""> <i class="fa-solid fa-star"></i></a>
<?php endfor; ?>
</span>
<span class="separator">
_
</span>
<!-- <span class="icon-wraper">
<a class="card-icon" href="#"><i class="fa-solid fa-ticket"></i></a>
<span class="separator">
_
</span>
<a class="card-icon" href="#"><i class="fa-solid fa-heart"></i></a>
<span class="separator">
_
</span>
<a class="card-icon" href="#"><i class="fa-solid fa-briefcase"></i></a>
</span> -->
<span class="ratings-number">
<?php
$metadata = get_post_meta( get_the_ID(), '_adnets_network_options', true ); echo $average_rating; ?>
</span>
<a href="<?php echo isset($metadata['button-url']) ? $metadata['button-url'] : ''; ?>" class="btn2 card-btn">join</a>
</span>
<!-- mid text -->
<p class="mt-10">
<?php echo wp_trim_words(get_the_content(), 30, ''); ?>
</p>
<!-- bottom -->
<ul class="bottom-card-info mt-10">
<li><?php comments_number('no reviews', '1 review', '% reviews'); ?></li>
<li class="separator">_</li>
<li>Offers: <?php echo $metadata['offers'] ?></li>
<li class="separator">_</li>
<li><?php echo $metadata['place'] ?></li>
<li class="separator">_</li>
<li><?php echo $metadata['timelines'] ?></li>
</ul>
</div>
</div>
<?php endwhile; ?>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
get_footer();
?>