-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmember-template.php
178 lines (162 loc) · 6.21 KB
/
member-template.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
/**
* Template Name: Members
*
* @package WordPress
* @subpackage cto
* @since cto 1.0
*/
get_header();
?>
<!-- HEADER -->
<?php
$custom_terms = get_terms(array(
'taxonomy' => 'member_cat',
'orderby' => 'slug',
'order' => 'ASC',
));
foreach ($custom_terms as $custom_term) {
// print_r($custom_term);
echo '<div id="members-cnt-' . $custom_term->term_id . '" class="member-cat-cnt"><div id="members-' . $custom_term->term_id . '" class="meber-cat-wrap">';
wp_reset_query();
$args = array(
'post_type' => 'members',
'tax_query' => array(
array(
'taxonomy' => 'member_cat',
'field' => 'slug',
'orderby' => 'title',
'terms' => $custom_term->slug,
),
),
'orderby' => 'date',
'order' => 'ASC',
'posts_per_page' => -1
);
$loop = new WP_Query($args);
if ($loop->have_posts()) {
if($custom_term->term_id == 9){
echo '<h3 class="meme-cat-subheading blingbling">XTREME TEAM</h3><br><h3 class="meme-cat-subheading">Cape Town, South Africa Dev. Team</h3>';
}
else{
?>
<div class="pg-title-cnt">
<!-- <div class="line-divider flex-fill"></div> -->
<h3 class="c-gold">The passionate beings.</h3>
<div class="pg-title">
<?php echo '<h2 class="mem-cat-name">' . $custom_term->name . '</h2></div>'; ?>
<!-- <div class="line-divider flex-fill"></div> -->
</div>
<?php
if($custom_term->term_id == 12){
echo '<h3 class="meme-cat-subheading blingbling">NO REST LABS</h3><br><h3 class="meme-cat-subheading">Silicone Valley & Asia Dev. Teams</h3>';
}
}
?>
<?php
// if($custom_term->term_id == 8){
// echo '<h3 class="meme-cat-subheading">NO REST LABS/MOUSEBELT<br>
// Silicone Valley & Asia Dev. Teams</h3>';
// }
// if($custom_term->term_id == 7){
// // echo '<h3 class="meme-cat-subheading">Cape Town, South Africa</h3>';
// }
?>
<div class="my-row">
<?php
while ($loop->have_posts()) {
$loop->the_post();
?>
<div class="my-col-6 member-col-out">
<div class="my-row">
<?php
echo '<div class="member-col-in my-col-4"><a class="m-open-popup" onClick="openMemberModal(' . get_the_id() . ')">';
if (has_post_thumbnail()) {
echo get_the_post_thumbnail();
}
echo '</a></div>';
echo '<div class="member-text-cnt my-col-8"><a class="m-open-popup" onClick="openMemberModal(' . get_the_id() . ')">';
echo '<h2 class="member-name">' . get_the_title() . '</h2>';
echo '<h3 class="member-title c-gold">' . get_post_meta(get_the_id(), 'memtitle', true) . '</h3>';
$my_content = apply_filters( 'the_content', get_the_content() );
echo '<p class="member-desc">' . wp_trim_words( $my_content, 15); '</p>';
echo '<p class="member-desc" style="font-weight: 700;">MORE</p>';
echo '</a></div>';
?>
</div>
</div>
<?php
}
}
wp_reset_query();
?>
</div>
</div>
</div>
<?php
$ajax_nonce = wp_create_nonce("member-bootstrap");
}
?>
<div id="member-modal" class="member-container">
<div class="my-row mem-box">
<div class="my-col-4">
<div id="memberImgPop">
</div>
</div>
<div class="my-col-8">
<div class="pop-cnt-wrap">
<h4>
<div id="memberTitle">
</h4>
<div id="mempos">
</div>
<div id="memeberDescription">
</div>
</div>
</div>
<a href="" class="close-popup-member"><i class="fas fa-times"></i></a>
</div>
</div>
<script>
function openMemberModal(id) {
jQuery.ajax({
url: "<?php echo admin_url('admin-ajax.php'); ?>",
data: {
id: id,
action: 'member_show_post',
security: '<?php echo $ajax_nonce; ?>'
},
success: function(response) {
if (jQuery("#member-modal").hasClass('pop-is-open')) {
jQuery("#member-modal").removeClass('pop-is-open');
// jQuery("#member-modal").animate({
// width: '0',
// }, 0, function() {
// });
}
if (response['error'] == '1') {
jQuery('#memberTitle').html("Error");
jQuery('#memeberDescription').html("No post found! Sorry :(");
} else {
jQuery('#memberTitle').html(response['post_title']);
// console.log(response['post_title']);
jQuery('#memeberDescription').html(response['post_content']);
// console.log(response['post_content']);
jQuery('#memberImgPop').html(response['post_thumbnail']).removeClass().addClass(response['cat_id']);
jQuery('#mempos').html(response['memtitle']);
}
if(!jQuery("body").hasClass('noscroll')){
jQuery("html").addClass('noscroll');
jQuery("body").addClass('noscroll');
}
jQuery("#member-modal").addClass('pop-is-open');
// jQuery("#member-modal").animate({
// width: '80%',
// }, 300, function() {
// });
}
});
}
</script>
<?php
get_footer();