PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 3.2.8
Strong Testimonials v3.2.8
3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / includes / functions-template.php
strong-testimonials / includes Last commit date
elementor 1 year ago logs 1 year ago strong-testimonials-beaver-block 1 year ago submodules 1 year ago class-strong-gutemberg.php 1 year ago class-strong-log.php 1 year ago class-strong-mail.php 1 year ago class-strong-testimonials-average-shortcode.php 1 year ago class-strong-testimonials-count-shortcode.php 1 year ago class-strong-testimonials-form.php 1 year ago class-strong-testimonials-order.php 1 year ago class-strong-testimonials-privacy.php 1 year ago class-strong-testimonials-render.php 1 year ago class-strong-testimonials-templates.php 1 year ago class-strong-testimonials-view-shortcode.php 1 year ago class-strong-testimonials-view-widget.php 1 year ago class-strong-view-display.php 1 year ago class-strong-view-form.php 1 year ago class-strong-view-slideshow.php 1 year ago class-strong-view.php 1 year ago class-walker-strong-category-checklist-front.php 1 year ago deprecated.php 1 year ago filters.php 1 year ago functions-activation.php 1 year ago functions-content.php 1 year ago functions-image.php 1 year ago functions-rating.php 1 year ago functions-template-form.php 1 year ago functions-template.php 1 year ago functions-views.php 1 year ago functions.php 1 year ago l10n-polylang.php 1 year ago l10n-wpml.php 1 year ago post-types.php 1 year ago retro.php 1 year ago scripts.php 1 year ago
functions-template.php
715 lines
1 <?php
2 /**
3 * Template Functions
4 */
5
6 /**
7 * Template function for showing a View.
8 *
9 * @since 1.25.0
10 *
11 * @param null $id
12 */
13 function strong_testimonials_view( $id = null ) {
14 if ( ! $id ) {
15 return;
16 }
17
18 $out = array();
19 $pairs = array();
20 $atts = array( 'id' => $id );
21 $out = WPMST()->render->prerender( $atts );
22 $out = WPMST()->render->parse_view( $out, $pairs, $atts );
23
24 echo WPMST()->shortcode->render_view( $out );
25 }
26
27 /**
28 * Print the current post title with optional markup.
29 *
30 * @since 2.26.0 Add optional link to post.
31 *
32 * @param string $before
33 * @param string $after
34 */
35
36 function wpmtst_the_title( $tag = '', $wrapper_class = '' ) {
37 $title = get_the_title();
38 $options = get_option( 'wpmtst_options' );
39
40 $tag = apply_filters( 'wpmtst_the_title_tag', $tag );
41 if ( ! empty( $tag ) ) {
42 $before = '<' . $tag . ' class="' . $wrapper_class . '">';
43 $after = '</' . $tag . '>';
44 }
45 if ( WPMST()->atts( 'title' ) && $title ) {
46
47 if ( 'none' !== WPMST()->atts( 'title_link' ) && '0' !== WPMST()->atts( 'title_link' ) ) {
48
49 if ( ( ! isset( $options['disable_rewrite'] ) || false === $options['disable_rewrite'] ) && ( 'wpmtst_testimonial' === WPMST()->atts( 'title_link' ) || '1' === WPMST()->atts( 'title_link' ) ) ) {
50 $before .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
51 $after = '</a>' . $after;
52 } else {
53 $id = get_the_ID();
54 $url_field = WPMST()->atts( 'title_link' );
55 $external_url = get_post_meta( $id, $url_field, true );
56
57 if ( '' !== $external_url && ! is_array( $external_url ) ) {
58 $before .= '<a href="' . esc_url( $external_url ) . '" rel="bookmark" target="_blank">';
59 $after = '</a>' . $after;
60 }
61 }
62 }
63 }
64 $before = apply_filters( 'wpmtst_the_title_before', $before );
65 $after = apply_filters( 'wpmtst_the_title_after', $after );
66
67 if ( WPMST()->atts( 'title' ) !== 'hidden' ) {
68 the_title( $before, $after );
69 }
70 }
71
72 /**
73 * Display the testimonial content.
74 *
75 * @since 1.24.0
76 *
77 * @since 2.4.0 Run content through core WordPress filters only, instead of all filters
78 * added to the_excerpt() or the_content() in order to to be compatible with
79 * NextGEN Gallery and to prevent other plugins from unconditionally adding
80 * content like share buttons, etc.
81 *
82 * @since 2.11.5 Run specific filters on `wpmtst_the_content` hook.
83 *
84 * @since 2.20.0 For automatic excerpts, run `wpautop` after truncating.
85 * Add `wp_make_content_images_responsive`.
86 *
87 * @since 2.26.0 Using content filters instead of direct function calls.
88 * Using custom get_*() functions to allow filter selectivity.
89 */
90 function wpmtst_the_content() {
91 /**
92 * Use this hook to remove specific content filters.
93 *
94 * @since 2.26.0
95 */
96 do_action( 'wpmtst_before_content_filters' );
97
98 echo apply_filters( 'wpmtst_get_the_content', '' );
99
100 /**
101 * Restore content filters that were removed.
102 *
103 * @since 2.26.0
104 */
105 do_action( 'wpmtst_after_content_filters' );
106 }
107
108 /**
109 * Like the_excerpt().
110 *
111 * @since 2.33.0
112 */
113 function wpmtst_the_excerpt() {
114 echo wpmtst_the_excerpt_filtered();
115 }
116
117 /**
118 * The ellipsis on read-more's.
119 *
120 * @since 2.33.0
121 */
122 function wpmtst_ellipsis() {
123 if ( apply_filters( 'wpmtst_use_ellipsis', true ) ) {
124 return apply_filters( 'wpmtst_ellipsis', __( '&hellip;', 'strong-testimonials' ) );
125 }
126
127 return '';
128 }
129
130 function wpmtst_prepend_ellipsis( $more ) {
131 return wpmtst_ellipsis() . ' ' . $more;
132 }
133
134 /**
135 * Assemble link to secondary "Read more" page.
136 *
137 * @since 2.10.0
138 */
139 function wpmtst_read_more_page() {
140 $atts = WPMST()->atts();
141
142 if ( $atts['more_page'] && $atts['more_page_id'] ) {
143
144 $permalink = '';
145 if ( is_numeric( $atts['more_page_id'] ) ) {
146 $permalink = wpmtst_get_permalink( $atts['more_page_id'] );
147 }
148 $permalink = apply_filters( 'wpmtst_readmore_page_link', $permalink, $atts );
149
150 if ( $permalink ) {
151 $default_view = wpmtst_get_view_default();
152
153 if ( isset( $atts['more_page_text'] ) && $atts['more_page_text'] ) {
154 $link_text = $atts['more_page_text'];
155 } else {
156 $link_text = $default_view['more_page_text'];
157 }
158
159 $link_text = apply_filters( 'wpmtst_read_more_page_link_text', $link_text, $atts );
160
161 if ( 'wpmtst_after_testimonial' === $atts['more_page_hook'] ) {
162 $classname = 'readmore';
163 } else {
164 $classname = 'readmore-page';
165 }
166 $classname = apply_filters( 'wpmtst_read_more_page_class', $classname );
167 echo apply_filters( 'wpmtst_read_more_page_output', sprintf( '<div class="%s"><a href="%s">%s</a></div>', esc_attr( $classname ), esc_url( $permalink ), wp_kses_post( $link_text ) ) );
168 }
169 }
170 }
171
172 /**
173 * L10n filter on read-more-page link.
174 *
175 * @since 2.23.0 As separate function.
176 *
177 * @param $text
178 * @param $atts
179 *
180 * @return string
181 */
182 function wpmtst_read_more_page_link_text_l10n( $text, $atts ) {
183 return apply_filters(
184 'wpmtst_l10n',
185 $text,
186 'strong-testimonials-read-more',
187 sprintf( 'View %s : Read more (page or post)', $atts['view'] )
188 );
189 }
190 add_filter( 'wpmtst_read_more_page_link_text', 'wpmtst_read_more_page_link_text_l10n', 10, 2 );
191
192 /**
193 * L10n filter on read-more-post link.
194 *
195 * @since 2.29.0
196 *
197 * @param $text
198 * @param $atts
199 *
200 * @return string
201 */
202 function wpmtst_read_more_post_link_text_l10n( $text, $atts ) {
203 return apply_filters(
204 'wpmtst_l10n',
205 $text,
206 'strong-testimonials-read-more',
207 sprintf( 'View %s : Read more (testimonial)', $atts['view'] )
208 );
209 }
210 add_filter( 'wpmtst_read_more_post_link_text', 'wpmtst_read_more_post_link_text_l10n', 10, 2 );
211
212 /**
213 * Get permalink by ID or slug.
214 *
215 * @since 1.25.0
216 *
217 * @param $page_id
218 *
219 * @return false|string
220 */
221 function wpmtst_get_permalink( $page_id ) {
222 if ( ! is_numeric( $page_id ) ) {
223 $page = get_page_by_path( $page_id );
224 $page_id = $page->ID;
225 }
226
227 return get_permalink( $page_id );
228 }
229
230 /**
231 * Prevent page scroll when clicking the More link.
232 *
233 * @since 2.10.0
234 *
235 * @param $link
236 *
237 * @return mixed
238 */
239 function wpmtst_remove_more_link_scroll( $link ) {
240 if ( 'wpm-testimonial' === get_post_type() ) {
241 $link = preg_replace( '|#more-[0-9]+|', '', $link );
242 }
243
244 return $link;
245 }
246 add_filter( 'the_content_more_link', 'wpmtst_remove_more_link_scroll' );
247
248 /**
249 * Display the thumbnail.
250 *
251 * TODO WP 4.2+ has better filters.
252 *
253 * @param null $size
254 * @param string $before
255 * @param string $after
256 */
257 function wpmtst_the_thumbnail( $size = null, $before = '<div class="wpmtst-testimonial-image testimonial-image">', $after = '</div>' ) {
258 if ( ! WPMST()->atts( 'thumbnail' ) ) {
259 return;
260 }
261
262 $img = wpmtst_get_thumbnail( $size );
263 if ( $img ) {
264 echo $before . $img . $after;
265 }
266 }
267
268 /**
269 * Print the date.
270 *
271 * @param string $format
272 * @param string $wrapper_class
273 */
274 function wpmtst_the_date( $format = '', $wrapper_class = '' ) {
275 global $post;
276 if ( ! $post ) {
277 return;
278 }
279
280 if ( ! $format ) {
281 $format = get_option( 'date_format' );
282 }
283
284 $the_date = apply_filters( 'wpmtst_the_date', mysql2date( $format, $post->post_date ), $format, $post );
285 echo '<div class="' . esc_attr( $wrapper_class ) . '">' . esc_attr( $the_date ) . '</div>';
286 }
287
288 /**
289 * Display the client section.
290 *
291 * @since 1.21.0
292 */
293 function wpmtst_the_client() {
294 $atts = WPMST()->atts();
295 if ( isset( $atts['client_section'] ) ) {
296 echo wpmtst_client_section( $atts['client_section'] );
297 }
298 }
299
300 /**
301 * Assemble the client section.
302 *
303 * @since 1.21.0
304 *
305 * @param array $client_section An array of client fields.
306 *
307 * @return mixed
308 */
309 function wpmtst_client_section( $client_section ) {
310
311 $html = '';
312
313 foreach ( $client_section as $field ) {
314 $html .= wpmtst_the_custom_field( $field );
315 }
316
317 return $html;
318 }
319
320 function wpmtst_the_custom_field( $field ) {
321 global $post;
322
323 $options = get_option( 'wpmtst_options' );
324 $custom_fields = wpmtst_get_custom_fields();
325
326 $output = '';
327 $field_name = $field['field'];
328
329 if ( isset( $custom_fields[ $field_name ] ) ) {
330 $field['prop'] = $custom_fields[ $field_name ];
331 } else {
332 $field['prop'] = array();
333 }
334
335 // Check for callback first.
336 if ( isset( $field['prop']['action_output'] ) && $field['prop']['action_output'] ) {
337 $value = get_post_meta( $post->ID, $field_name, true );
338 $output = apply_filters( $field['prop']['action_output'], $field, $value );
339 } else {
340 switch ( $field['type'] ) {
341
342 case 'link':
343 case 'link2':
344 // use default if missing
345 if ( ! isset( $field['link_text'] ) ) {
346 $field['link_text'] = 'value';
347 }
348
349 /**
350 * Get link text and an alternate in case the URL is empty;
351 * e.g. display the domain if no company name given
352 * but don't display 'LinkedIn' if no URL given.
353 */
354 switch ( $field['link_text'] ) {
355 case 'custom':
356 $text = $field['link_text_custom'];
357 $output = '';
358 break;
359 case 'label':
360 $text = $field['prop']['label'];
361 $output = '';
362 break;
363 default: // value
364 $text = get_post_meta( $post->ID, $field_name, true );
365 // if no URL (next condition), show the alternate (the field)
366 $output = $text;
367 }
368
369 if ( $field['url'] ) {
370
371 $url = get_post_meta( $post->ID, $field['url'], true );
372 if ( $url ) {
373 if ( isset( $field['new_tab'] ) && $field['new_tab'] ) {
374 $newtab = ' target="_blank"';
375 } else {
376 $newtab = '';
377 }
378
379 // TODO Abstract this global fallback technique.
380 $is_nofollow = get_post_meta( $post->ID, 'nofollow', true );
381 if ( 'default' === $is_nofollow || '' === $is_nofollow ) {
382 // convert default to (yes|no)
383 $is_nofollow = $options['nofollow'] ? 'yes' : 'no';
384 }
385 if ( 'yes' === $is_nofollow ) {
386 $nofollow = 'nofollow';
387 } else {
388 $nofollow = '';
389 }
390
391 $is_noopener = get_post_meta( $post->ID, 'noopener', true );
392 if ( 'default' === $is_noopener || '' === $is_noopener ) {
393 // convert default to (yes|no)
394 $is_noopener = $options['noopener'] ? 'yes' : 'no';
395 }
396 if ( 'yes' === $is_noopener ) {
397 $noopener = 'noopener';
398 } else {
399 $noopener = '';
400 }
401
402 $is_noreferrer = get_post_meta( $post->ID, 'noreferrer', true );
403 if ( 'default' === $is_noreferrer || '' === $is_noreferrer ) {
404 // convert default to (yes|no)
405 $is_noreferrer = $options['noreferrer'] ? 'yes' : 'no';
406 }
407 if ( 'yes' === $is_noreferrer ) {
408 $noreferrer = 'noreferrer';
409 } else {
410 $noreferrer = '';
411 }
412
413 if ( ! empty( $noopener ) || ! empty( $nofollow ) || ! empty( $noreferrer ) ) {
414 $rel = sprintf( ' rel="%s %s %s"', esc_attr( $nofollow ), esc_attr( $noopener ), esc_attr( $noreferrer ) );
415 } else {
416 $rel = '';
417 }
418
419 // if field empty, use domain instead
420 if ( ! $text || is_array( $text ) ) {
421 $text = preg_replace( '(^https?://)', '', $url );
422 }
423 $output = sprintf( '<a href="%s"%s%s>%s</a>', esc_url( $url ), $newtab, $rel, wp_kses_post( $text ) );
424 }
425 }
426 break;
427
428 case 'date':
429 $format = isset( $field['format'] ) && $field['format'] ? $field['format'] : get_option( 'date_format' );
430
431 // Fall back to post_date if submit_date missing.
432 $the_date = get_post_meta( $post->ID, $field_name, true );
433 $the_date = $the_date ? $the_date : $post->post_date;
434 $the_date = mysql2date( $format, $the_date );
435
436 if ( get_option( 'date_format' ) !== $format ) {
437 // Requires PHP 5.3+
438 if ( version_compare( PHP_VERSION, '5.3' ) >= 0 ) {
439 $new_date = DateTime::createFromFormat( get_option( 'date_format' ), $the_date );
440 if ( $new_date ) {
441 $the_date = $new_date->format( $format );
442 }
443 }
444 }
445
446 $output = apply_filters( 'wpmtst_the_date', $the_date, $format, $post );
447 break;
448
449 case 'category':
450 // 1. Get all terms for testimonial
451 $categories = get_the_terms( $post->ID, 'wpm-testimonial-category' );
452 // 2, Check for errors
453 if ( $categories && ! is_wp_error( $categories ) ) {
454 $list = array();
455 // 3. Check if should display parent cats, child cats, or both.
456 if ( isset( $field['category_show'] ) && 'both' !== $field['category_show'] ) {
457 if ( 'parent' === $field['category_show'] ) {
458 foreach ( $categories as $cat ) {
459 // 3.1 Include only categories that don't have parents
460 if ( 0 === $cat->parent ) {
461 $list[] = $cat->name;
462 }
463 }
464 $output = implode( ', ', $list );
465
466 } elseif ( 'child' === $field['category_show'] ) {
467 foreach ( $categories as $cat ) {
468 // 3.2 Include only categories that have parents
469 if ( 0 !== $cat->parent ) {
470 $list[] = $cat->name;
471 }
472 }
473 $output = implode( ', ', $list );
474 }
475 } else {
476 foreach ( $categories as $cat ) {
477 // 3.3 Include all categories
478 $list[] = $cat->name;
479 }
480 $output = implode( ', ', $list );
481 }
482 } else {
483 $output = '';
484 }
485 break;
486
487 case 'shortcode':
488 if ( isset( $field['prop']['shortcode_on_display'] ) && $field['prop']['shortcode_on_display'] ) {
489 $output = do_shortcode( $field['prop']['shortcode_on_display'] );
490 }
491 break;
492
493 case 'rating':
494 $output = get_post_meta( $post->ID, $field_name, true );
495 // Check default value
496 if ( '' === $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
497 $output = $field['prop']['default_display_value'];
498 }
499 // Convert number to stars
500 if ( $output ) {
501 $output = wpmtst_star_rating_display( $output, 'in-view', false );
502 }
503 break;
504
505 case 'platform':
506 $platform = get_post_meta( $post->ID, $field_name, true );
507
508 if ( $platform ) {
509 $output = wpmtst_platform_display( $platform );
510 }
511
512 break;
513
514 case 'checkbox':
515 // we output the checkbox value from view
516 $output = '';
517 if ( isset( $field['custom_label'] ) && ! empty( $field['custom_label'] ) ) {
518 $output = sprintf( '%s: ', esc_attr( $field['custom_label'] ) );
519 }
520 if ( get_post_meta( $post->ID, $field_name, true ) ) {
521 $output .= esc_attr( $field['checked_value_custom'] );
522 } else {
523 $output .= esc_attr( $field['unchecked_value'] );
524 }
525 break;
526
527 default:
528 // text field
529 $output = get_post_meta( $post->ID, $field_name, true );
530 if ( '' === $output && isset( $field['prop']['default_display_value'] ) && $field['prop']['default_display_value'] ) {
531 $output = $field['prop']['default_display_value'];
532 }
533 }
534 }
535
536 if ( $output ) {
537 if ( isset( $field['before'] ) && $field['before'] ) {
538 $output = '<span class="wpmtst-testimonial-field-before testimonial-field-before">' . $field['before'] . '</span>' . $output;
539 }
540 $output = '<div class="wpmtst-testimonial-field testimonial-field ' . esc_attr( $field['class'] ) . '">' . $output . '</div>';
541 }
542
543 return $output;
544 }
545
546 function wpmtst_container_class() {
547 echo esc_attr( apply_filters( 'wpmtst_container_class', WPMST()->atts( 'container_class' ) ) );
548 }
549
550 function wpmtst_container_data() {
551 $data_array = apply_filters( 'wpmtst_container_data', WPMST()->atts( 'container_data' ) );
552 if ( $data_array ) {
553 $data = '';
554 foreach ( $data_array as $attr => $value ) {
555 $data .= " data-$attr=$value";
556 }
557 echo esc_attr( $data );
558 }
559 }
560
561 function wpmtst_content_class() {
562 echo esc_attr( apply_filters( 'wpmtst_content_class', WPMST()->atts( 'content_class' ) ) );
563 }
564
565 function wpmtst_post_class( $args = null ) {
566 echo esc_attr( apply_filters( 'wpmtst_post_class', WPMST()->atts( 'post_class' ) . ' post-' . get_the_ID(), $args ) );
567 }
568
569 /**
570 * Echo custom field.
571 *
572 * @since 1.11.0
573 *
574 * @param null $field
575 * @param array $args
576 */
577 function wpmtst_field( $field = null, $args = array() ) {
578 echo wpmtst_get_field( $field, $args );
579 }
580
581 /**
582 * Fetch custom field.
583 *
584 * Thanks to Matthew Harris.
585 *
586 * @link https://github.com/cdillon/strong-testimonials/issues/2
587 *
588 * @param $field
589 * @param array $args
590 *
591 * @since 1.15.7
592 *
593 * @return mixed|string
594 */
595 function wpmtst_get_field( $field, $args = array() ) {
596 if ( ! $field ) {
597 return '';
598 }
599
600 global $post;
601
602 switch ( $field ) {
603
604 // Apply a character limit to post content.
605 case 'truncated':
606 $html = wpmtst_truncate( $post->post_content, $args['char_limit'] );
607 break;
608
609 // Get the custom field.
610 default:
611 $html = get_post_meta( $post->ID, $field, true );
612
613 }
614
615 return $html;
616 }
617
618 if ( ! function_exists( 'wpmtst_standard_pagination' ) ) :
619 /**
620 * Custom pagination. Pluggable.
621 *
622 * Thanks http://callmenick.com/post/custom-wordpress-loop-with-pagination
623 */
624 function wpmtst_standard_pagination() {
625 $query = WPMST()->get_query();
626 $numpages = $query->max_num_pages ? $query->max_num_pages : 1;
627 $paged = wpmtst_get_paged();
628 $options = WPMST()->atts( 'pagination_settings' );
629
630 $pagination_args = array(
631 // Required
632 'total' => $numpages,
633 'current' => $paged,
634 // Options
635 'show_all' => isset( $options['show_all'] ) ? $options['show_all'] : false,
636 'end_size' => isset( $options['end_size'] ) ? $options['end_size'] : 1,
637 'mid_size' => isset( $options['mid_size'] ) ? $options['mid_size'] : 2,
638 'prev_next' => isset( $options['prev_next'] ) ? $options['prev_next'] : true,
639 'prev_text' => isset( $options['prev_text'] ) ? $options['prev_text'] : __( '&laquo; Previous', 'strong-testimonials' ),
640 'next_text' => isset( $options['next_text'] ) ? $options['next_text'] : __( 'Next &raquo;', 'strong-testimonials' ),
641 'before_page_number' => isset( $options['before_page_number'] ) ? $options['before_page_number'] : '',
642 'after_page_number' => isset( $options['after_page_number'] ) ? $options['after_page_number'] : '',
643 );
644
645 $paginate_links = paginate_links( apply_filters( 'wpmtst_pagination_args', $pagination_args ) );
646
647 if ( $paginate_links ) {
648 echo "<nav class='nav-links'>";
649 //echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
650 echo $paginate_links;
651 echo '</nav>';
652 }
653 }
654 endif;
655
656 /**
657 * If paged, return the current page number.
658 *
659 * @return int|mixed
660 */
661 function wpmtst_get_paged() {
662 return get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
663 }
664
665 /*
666 // alternate pagination style
667 function wpmtst_new_pagination_2() {
668 $query = WPMST()->get_query();
669 if ($query->max_num_pages > 1) { ?>
670 <nav class="prev-next-posts">
671 <div class="prev-posts-link">
672 <?php echo get_next_posts_link( 'Older Entries', $query->max_num_pages ); // display older posts link ?>
673 </div>
674 <div class="next-posts-link">
675 <?php echo get_previous_posts_link( 'Newer Entries' ); // display newer posts link ?>
676 </div>
677 </nav>
678 <?php }
679 }
680 */
681
682 if ( ! function_exists( 'wpmtst_single_template_client' ) ) :
683 /**
684 * Single testimonial custom fields. Pluggable.
685 *
686 * @since 2.22.0
687 */
688 function wpmtst_single_template_client() {
689 $html = '';
690 $view = wpmtst_find_single_template_view();
691 if ( $view && isset( $view['client_section'] ) ) {
692 foreach ( $view['client_section'] as $field ) {
693 if ( 'rating' === $field['type'] ) {
694 wp_enqueue_style( 'wpmtst-rating-display' );
695 break;
696 }
697 }
698
699 $html .= '<div class="testimonial-client normal">';
700 $html .= wpmtst_client_section( $view['client_section'] );
701 $html .= '</div>';
702 }
703
704 return $html;
705 }
706 endif;
707
708 function wpmtst_platform_display( $platform ) {
709 ob_start();
710 ?>
711 <img title="<?php echo esc_attr( __( 'posted on ', 'strong-testimonials' ) . $platform ); ?>" width="20" height="20" src="<?php echo esc_attr( WPMTST_ASSETS_IMG ); ?>/platform_icons/<?php echo esc_attr( $platform ); ?>.svg"/>
712 <?php
713 return ob_get_clean();
714 }
715