PluginProbe
WP Team – WordPress Team Member Plugin / trunk
WP Team – WordPress Team Member Plugin vtrunk
trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8
ht-team-member / include / shortcode.php

shortcode.php in WP Team – WordPress Team Member Plugin trunk, at include/shortcode.php

328 lines 20.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if( !function_exists( 'htteammember_shortcode' ) ){
4
5 function htteammember_shortcode( $atts ){
6 extract( shortcode_atts( array(
7
8 'limit' => 4
9 ,'column' => 4
10 ,'layout' => 1
11 ,'order' => 'ASC'
12 ,'show_name' => 'yes'
13 ,'show_designation' => 'yes'
14 ,'show_bio' => 'yes'
15 ,'show_socialmedia' => 'yes'
16 ,'teams_list' => ''
17
18 ,'slideron' => 'no'
19 ,'slarrows' => 'no'
20 ,'slprevicon' => 'fa fa-angle-left'
21 ,'slnexticon' => 'fa fa-angle-right'
22 ,'sldots' => 'no'
23 ,'slautolay' => 'yes'
24 ,'slautoplay_speed' => 3000
25 ,'slanimation_speed' => 300
26 ,'slcentermode' => 'no'
27 ,'slcenterpadding' => 0
28 ,'slitems' => 4
29 ,'slrows' => 1
30 ,'slscroll_columns' => 1
31 ,'sltablet_width' => 750
32 ,'sltablet_display_columns' => 1
33 ,'sltablet_scroll_columns' => 1
34 ,'slmobile_width' => 480
35 ,'slmobile_display_columns' => 1
36 ,'slmobile_scroll_columns' => 1
37
38 ,'name_color' => '#343434'
39 ,'bio_color' => '#343434'
40 ,'desi_color' => '#343434'
41 ,'social_color' => '#343434'
42 ,'social_hovcolor' => '#343434'
43
44 ), $atts ) );
45
46 $unique_class = uniqid('teammember_style_');
47 $teamclass = array( esc_attr($unique_class), 'team_area', 'team_style_'. esc_attr($layout) );
48
49 $slider_atts = array();
50 $slider_atts['class'] = '';
51 if( $slideron == 'yes' ){
52
53 $slider_atts['class'] = 'ht-carousel';
54
55 $slider_settings = [
56 'arrows' => ( 'yes' === $slarrows ),
57 'arrow_prev_txt' => esc_attr($slprevicon),
58 'arrow_next_txt' => esc_attr($slnexticon),
59 'dots' => ( 'yes' === $sldots ),
60 'autoplay' => ( 'yes' === $slautolay ),
61 'autoplay_speed' => absint( $slautoplay_speed ),
62 'animation_speed' => absint( $slanimation_speed ),
63 'center_mode' => ( 'yes' === $slcentermode ),
64 'center_padding' => absint( $slcenterpadding ),
65 ];
66
67 $slider_responsive_settings = [
68 'rows' => esc_attr($slrows),
69 'display_columns' => esc_attr($slitems),
70 'scroll_columns' => esc_attr($slscroll_columns),
71 'tablet_width' => esc_attr($sltablet_width),
72 'tablet_display_columns' => esc_attr($sltablet_display_columns),
73 'tablet_scroll_columns' => esc_attr($sltablet_scroll_columns),
74 'mobile_width' => esc_attr($slmobile_width),
75 'mobile_display_columns' => esc_attr($slmobile_display_columns),
76 'mobile_scroll_columns' => esc_attr($slmobile_scroll_columns),
77 ];
78
79 $slider_settings = array_merge( $slider_settings, $slider_responsive_settings );
80 }
81
82 // Register CSS and JS
83 if( $slideron == 'yes' ){
84 wp_enqueue_style('slick');
85 wp_enqueue_script('ht-teammin');
86 }
87
88 $argss = array(
89 'post_type' => 'htteam_member',
90 'post_status' => 'publish',
91 'ignore_sticky_posts' => 1,
92 'posts_per_page' => empty( $teams_list ) ? esc_attr($limit) : -1,
93 'order' => esc_attr($order),
94 );
95
96 if( $teams_list >= 1 ) {
97 $team_names = explode(',', esc_attr($teams_list));
98 } else { $team_names = ''; }
99
100 if ( !empty( $teams_list ) ) {
101 $argss['post__in'] = $team_names;
102 }
103
104 $teammember = new WP_Query( $argss );
105
106 $itemwidth = 100/$column;
107
108 ob_start();
109
110 $output = '';
111 // custom style
112 $output .= '<style>';
113 $output .= ".$unique_class .single-team h4.team-name a{ color: " . esc_attr($name_color) . " }";
114 $output .= ".$unique_class .single-team .team-bio p{ color: " . esc_attr($bio_color) . " }";
115 $output .= ".$unique_class .single-team p.team-designation{ color: " . esc_attr($desi_color) . " }";
116 $output .= ".$unique_class .single-team .social-network li a{ color: " . esc_attr($social_color) . " }";
117 $output .= ".$unique_class .single-team .social-network li a:hover{ color: " . esc_attr($social_hovcolor) . " }";
118 $output .= '</style>';
119
120 ?>
121
122
123 <div class="<?php echo esc_attr(implode(' ', $teamclass )); ?>" >
124 <div class="<?php echo esc_attr(implode(' ', $slider_atts )); ?>" data-settings='<?php if( $slideron == 'yes' ){ echo wp_json_encode( $slider_settings ); }else{echo 'no-opt'; } ?>'>
125 <?php
126 if( $teammember->have_posts() ){
127 $i = 0;
128 while ( $teammember->have_posts() ) {
129 $i++;
130 $teammember->the_post();
131
132 $designation = get_post_meta( get_the_ID(), 'htdesignation', true );
133 $socialitem = get_post_meta( get_the_ID(), 'socialmedia_group', true );
134
135 ?>
136 <div class="item-col" style="<?php echo 'width:'.esc_attr( $itemwidth ).'%';?>">
137 <div class="single-team">
138 <?php if( $layout == '2' ):?>
139 <div class="team-thumb">
140 <a href="<?php the_permalink(); ?>">
141 <?php the_post_thumbnail(); ?>
142 </a>
143 <div class="team-hover-action">
144 <div class="hover-action">
145 <?php if( $show_name === 'yes' ): ?>
146 <h4 class="team-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
147 <?php endif; ?>
148 <?php
149 if( isset( $designation ) && $show_designation === 'yes' ){
150 echo '<p class="team-designation">'.esc_html( $designation ).'</p>';
151 }
152 ?>
153 <?php if( $show_bio === 'yes' ){ echo '<div class="team-bio"><p>'.get_the_excerpt().'</p></div>'; } ?>
154 <?php if( isset($socialitem) && $show_socialmedia === 'yes' ): ?>
155 <ul class="social-network">
156 <?php if (is_array($socialitem) || is_object($socialitem)) {
157 foreach ( $socialitem as $key => $value ) { ?>
158 <li><a href="<?php echo esc_url( $value['sociallink'] );?>"><i class="fa <?php echo esc_attr__($value['socialicon'],'ht-teammember');?>"></i></a></li>
159 <?php } } ?>
160 </ul>
161 <?php endif;?>
162 </div>
163 </div>
164 </div>
165
166 <?php elseif( $layout == '3' ):?>
167 <div class="thumb">
168 <a href="<?php the_permalink(); ?>">
169 <?php the_post_thumbnail(); ?>
170 </a>
171 <div class="team-hover-action">
172
173 <div class="team-click-action">
174 <div class="plus_click"></div>
175 <?php if( $show_name === 'yes' ): ?>
176 <h4 class="team-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
177 <?php endif; ?>
178 <?php
179 if( isset( $designation ) && $show_designation === 'yes' ){
180 echo '<p class="team-designation">'.esc_html( $designation ).'</p>';
181 }
182 ?>
183 <?php
184 if( $show_bio === 'yes' ){
185 echo '<div class="team-bio"><p>'.get_the_excerpt().'</p></div>';
186 }
187 ?>
188 <?php if( isset($socialitem) && $show_socialmedia === 'yes' ): ?>
189 <ul class="social-network">
190 <?php if (is_array($socialitem) || is_object($socialitem)) {
191 foreach ( $socialitem as $key => $value ) { ?>
192 <li><a href="<?php echo esc_url( $value['sociallink'] );?>"><i class="fa <?php echo esc_attr__($value['socialicon'],'ht-teammember');?>"></i></a></li>
193 <?php } } ?>
194 </ul>
195 <?php endif;?>
196
197 </div>
198
199 </div>
200 </div>
201
202 <?php elseif( $layout == '4' ):?>
203 <div class="thumb">
204 <a href="<?php the_permalink(); ?>">
205 <?php the_post_thumbnail(); ?>
206 </a>
207 </div>
208 <div class="team-info">
209 <div class="content">
210 <?php if( $show_name === 'yes' ): ?>
211 <h4 class="team-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
212 <?php endif; ?>
213 <?php
214 if( isset( $designation ) && $show_designation === 'yes' ){
215 echo '<p class="team-designation">'.esc_html( $designation ).'</p>';
216 }
217 ?>
218 <?php
219 if( $show_bio === 'yes' ){
220 echo '<div class="team-bio"><p>'.get_the_excerpt().'</p></div>';
221 }
222 ?>
223 </div>
224
225 <?php if( isset($socialitem) && $show_socialmedia === 'yes' ): ?>
226 <ul class="social-network">
227 <?php if (is_array($socialitem) || is_object($socialitem)) {
228 foreach ( $socialitem as $key => $value ) { ?>
229 <li><a href="<?php echo esc_url( $value['sociallink'] );?>"><i class="fa <?php echo esc_attr__($value['socialicon'],'ht-teammember');?>"></i></a></li>
230 <?php } } ?>
231 </ul>
232 <?php endif;?>
233 </div>
234
235 <?php elseif( $layout == '5' ):?>
236 <div class="thumb">
237 <a href="<?php the_permalink(); ?>">
238 <?php the_post_thumbnail(); ?>
239 </a>
240 <div class="team-hover-action">
241 <div class="hover-action">
242 <?php if( isset($socialitem) && $show_socialmedia === 'yes' ): ?>
243 <ul class="social-network">
244 <?php if (is_array($socialitem) || is_object($socialitem)) {
245 foreach ( $socialitem as $key => $value ) { ?>
246 <li><a href="<?php echo esc_url( $value['sociallink'] );?>"><i class="fa <?php echo esc_attr__($value['socialicon'],'ht-teammember');?>"></i></a></li>
247 <?php } } ?>
248 </ul>
249 <?php endif;?>
250 </div>
251 </div>
252 </div>
253 <div class="content">
254 <?php if( $show_name === 'yes' ): ?>
255 <h4 class="team-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
256 <?php endif; ?>
257 <?php
258 if( isset( $designation ) && $show_designation === 'yes' ){
259 echo '<p class="team-designation">'.esc_html( $designation ).'</p>';
260 }
261 ?>
262 <?php
263 if( $show_bio === 'yes' ){
264 echo '<div class="team-bio"><p>'.get_the_excerpt().'</p></div>';
265 }
266 ?>
267 </div>
268
269 <?php else:?>
270 <div class="team-thumb">
271 <a href="<?php the_permalink(); ?>">
272 <?php the_post_thumbnail(); ?>
273 </a>
274 <div class="team-hover-action">
275 <div class="team-hover">
276 <?php if( isset($socialitem) && $show_socialmedia === 'yes' ): ?>
277 <ul class="social-network">
278 <?php if (is_array($socialitem) || is_object($socialitem)) {
279 foreach ( $socialitem as $key => $value ) { ?>
280 <li><a href="<?php echo esc_url( $value['sociallink'] );?>"><i class="fa <?php echo esc_attr__($value['socialicon'],'ht-teammember');?>"></i></a></li>
281 <?php } } ?>
282 </ul>
283 <?php endif;?>
284 <?php
285 if( $show_bio === 'yes' ){
286 echo '<div class="team-bio"><p>'.get_the_excerpt().'</p></div>';
287 }
288 ?>
289 </div>
290 </div>
291 </div>
292 <div class="content">
293 <?php if( $show_name === 'yes' ): ?>
294 <h4 class="team-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
295 <?php endif; ?>
296 <?php
297 if( isset( $designation ) && $show_designation === 'yes' ){
298 echo '<p class="team-designation">'.esc_html( $designation ).'</p>';
299 }
300 ?>
301 </div>
302 <?php endif;?>
303 </div>
304 </div>
305 <?php
306 if( ( $limit == $i ) && empty( $teams_list ) ){
307 break;
308 }
309 }
310 }
311 ?>
312 </div>
313 </div>
314 <?php
315
316 wp_reset_postdata();
317 wp_reset_query();
318
319 $output .= ob_get_clean();
320 return $output;
321
322 }
323 add_shortcode( 'htteamember', 'htteammember_shortcode' );
324
325 }
326
327
328 ?>