1 | <?php |
||
2 | /** |
||
3 | * Team Archive |
||
4 | * |
||
5 | * @package tour-operator |
||
6 | * @category team |
||
7 | */ |
||
8 | |||
9 | get_header(); ?> |
||
10 | |||
11 | <?php lsx_content_wrap_before(); ?> |
||
12 | |||
13 | <div id="primary" class="content-area col-sm-12 <?php echo esc_attr( lsx_main_class() ); ?>"> |
||
14 | |||
15 | <?php lsx_content_before(); ?> |
||
16 | |||
17 | <main id="main" class="site-main" role="main"> |
||
18 | |||
19 | <?php lsx_content_top(); ?> |
||
20 | |||
21 | <?php if ( have_posts() ) : ?> |
||
22 | |||
23 | <?php |
||
24 | $header_before = ''; |
||
25 | $group_items_by_role = false; |
||
26 | |||
27 | if ( isset( tour_operator()->options['team'] ) && isset( tour_operator()->options['team']['group_items_by_role'] ) ) { |
||
28 | $group_items_by_role = true; |
||
29 | } |
||
30 | |||
31 | $count = 0; |
||
32 | ?> |
||
33 | |||
34 | <?php while ( have_posts() ) : the_post(); ?> |
||
35 | |||
36 | <?php |
||
37 | if ( true === $group_items_by_role ) { |
||
38 | $header_current = get_the_terms( get_the_id(), 'role' ); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
39 | $header_html = ''; |
||
40 | |||
41 | if ( ! is_wp_error( $header_current ) && is_array( $header_current ) && ! empty( $header_current ) ) { |
||
42 | $header_current = $header_current[0]->name; |
||
43 | |||
44 | if ( $header_before !== $header_current ) { |
||
45 | $header_html = '<h3 class="lsx-to-archive-items-separator lsx-title">' . $header_current . '</h3>'; |
||
46 | $header_before = $header_current; |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
51 | $count++; |
||
52 | ?> |
||
53 | |||
54 | <?php if ( $count > 1 && true === $group_items_by_role && ! empty( $header_html ) ) { ?> |
||
55 | </div> |
||
56 | <?php } ?> |
||
57 | |||
58 | <?php if ( 1 === $count || ( true === $group_items_by_role && ! empty( $header_html ) ) ) { ?> |
||
59 | <?php if ( true === $group_items_by_role && ! empty( $header_html ) ) { ?> |
||
60 | <?php echo wp_kses_post( $header_html ); ?> |
||
61 | <?php } ?> |
||
62 | |||
63 | <div class="row lsx-to-archive-items lsx-to-archive-template-<?php echo esc_attr( tour_operator()->archive_layout ); ?> lsx-to-archive-template-image-<?php echo esc_attr( tour_operator()->archive_list_layout_image_style ); ?>"> |
||
64 | <?php } ?> |
||
65 | |||
66 | <div class="<?php echo esc_attr( lsx_to_archive_class( 'lsx-to-archive-item' ) ); ?>"> |
||
67 | <?php lsx_to_team_content( 'content', 'team' ); ?> |
||
68 | </div> |
||
69 | |||
70 | <?php if ( $GLOBALS['wp_query']->post_count === $count ) { ?> |
||
71 | </div> |
||
72 | <?php } ?> |
||
73 | |||
74 | <?php endwhile; ?> |
||
75 | |||
76 | <?php else : ?> |
||
77 | |||
78 | <?php get_template_part( 'partials/content', 'none' ); ?> |
||
79 | |||
80 | <?php endif; ?> |
||
81 | |||
82 | <?php lsx_content_bottom(); ?> |
||
83 | |||
84 | </main><!-- #main --> |
||
85 | |||
86 | <?php lsx_content_after(); ?> |
||
87 | |||
88 | </div><!-- #primary --> |
||
89 | |||
90 | <?php lsx_content_wrap_after(); ?> |
||
91 | |||
92 | <?php //get_sidebar(); ?> |
||
93 | |||
94 | <?php get_footer(); |
||
95 |