@@ -15,39 +15,39 @@ discard block |
||
15 | 15 | $button_cf_id = ''; |
16 | 16 | |
17 | 17 | if ( ! empty( projects_get_option( 'projects_modal_enable' ) ) ) { |
18 | - if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) { |
|
19 | - $button_label = projects_get_option( 'projects_modal_cta_label' ); |
|
20 | - $button_cf_id = projects_get_option( 'projects_modal_form_id' ); |
|
21 | - } |
|
18 | + if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) { |
|
19 | + $button_label = projects_get_option( 'projects_modal_cta_label' ); |
|
20 | + $button_cf_id = projects_get_option( 'projects_modal_form_id' ); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ( ! empty( $client_logo ) ) { |
25 | - $client_logo = '<img src="' . $client_logo . '">'; |
|
25 | + $client_logo = '<img src="' . $client_logo . '">'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $groups = ''; |
29 | 29 | $terms = get_the_terms( get_the_ID(), 'project-group' ); |
30 | 30 | |
31 | 31 | if ( $terms && ! is_wp_error( $terms ) ) { |
32 | - $groups = array(); |
|
32 | + $groups = array(); |
|
33 | 33 | |
34 | - foreach ( $terms as $term ) { |
|
35 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
36 | - } |
|
34 | + foreach ( $terms as $term ) { |
|
35 | + $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
36 | + } |
|
37 | 37 | |
38 | - $groups = join( ', ', $groups ); |
|
38 | + $groups = join( ', ', $groups ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $product_groups = ''; |
42 | 42 | $product_terms = get_post_meta( get_the_ID(), 'lsx_project__alt_products', false ); |
43 | 43 | |
44 | 44 | if ( $product_terms && ! is_wp_error( $product_terms ) ) { |
45 | - $product_groups = array(); |
|
46 | - foreach ( $product_terms[0] as $product_term ) { |
|
47 | - $product_groups[] = '<a href="' . $product_term['lsx_project_alt_product_link'] . '">' . $product_term['lsx_project_alt_product_title'] . '</a>'; |
|
48 | - } |
|
45 | + $product_groups = array(); |
|
46 | + foreach ( $product_terms[0] as $product_term ) { |
|
47 | + $product_groups[] = '<a href="' . $product_term['lsx_project_alt_product_link'] . '">' . $product_term['lsx_project_alt_product_title'] . '</a>'; |
|
48 | + } |
|
49 | 49 | |
50 | - $product_groups = join( ', ', $product_groups ); |
|
50 | + $product_groups = join( ', ', $product_groups ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -55,83 +55,83 @@ discard block |
||
55 | 55 | // Connection Projects. |
56 | 56 | |
57 | 57 | if ( post_type_exists( 'project' ) && $terms && ! is_wp_error( $terms ) ) { |
58 | - $groups_ = array(); |
|
59 | - |
|
60 | - foreach ( $terms as $term ) { |
|
61 | - $groups_[] = $term->term_id; |
|
62 | - } |
|
63 | - |
|
64 | - if ( count( $groups_ ) > 0 ) { |
|
65 | - $connection_project['post_type'] = 'project'; |
|
66 | - $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
67 | - $connection_project['posts'] = array(); |
|
68 | - |
|
69 | - $args = array( |
|
70 | - 'post_type' => 'project', |
|
71 | - 'post__not_in' => array( get_the_ID() ), |
|
72 | - 'no_found_rows' => true, |
|
73 | - 'ignore_sticky_posts' => 1, |
|
74 | - 'update_post_meta_cache' => false, |
|
75 | - 'tax_query' => array( |
|
76 | - array( |
|
77 | - 'taxonomy' => 'project-group', |
|
78 | - 'terms' => $groups_, |
|
79 | - ), |
|
80 | - ), |
|
81 | - ); |
|
82 | - |
|
83 | - $projects_ = new \WP_Query( $args ); |
|
84 | - |
|
85 | - if ( $projects_->have_posts() ) { |
|
86 | - while ( $projects_->have_posts() ) { |
|
87 | - $projects_->the_post(); |
|
88 | - $connection_project['posts'][] = get_the_ID(); |
|
89 | - wp_reset_postdata(); |
|
90 | - } |
|
91 | - } |
|
92 | - |
|
93 | - if ( ! empty( $connection_project['posts'] ) ) { |
|
94 | - $post_ids = join( ',', $connection_project['posts'] ); |
|
95 | - $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
96 | - $connections[] = $connection_project; |
|
97 | - } |
|
98 | - } |
|
58 | + $groups_ = array(); |
|
59 | + |
|
60 | + foreach ( $terms as $term ) { |
|
61 | + $groups_[] = $term->term_id; |
|
62 | + } |
|
63 | + |
|
64 | + if ( count( $groups_ ) > 0 ) { |
|
65 | + $connection_project['post_type'] = 'project'; |
|
66 | + $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
67 | + $connection_project['posts'] = array(); |
|
68 | + |
|
69 | + $args = array( |
|
70 | + 'post_type' => 'project', |
|
71 | + 'post__not_in' => array( get_the_ID() ), |
|
72 | + 'no_found_rows' => true, |
|
73 | + 'ignore_sticky_posts' => 1, |
|
74 | + 'update_post_meta_cache' => false, |
|
75 | + 'tax_query' => array( |
|
76 | + array( |
|
77 | + 'taxonomy' => 'project-group', |
|
78 | + 'terms' => $groups_, |
|
79 | + ), |
|
80 | + ), |
|
81 | + ); |
|
82 | + |
|
83 | + $projects_ = new \WP_Query( $args ); |
|
84 | + |
|
85 | + if ( $projects_->have_posts() ) { |
|
86 | + while ( $projects_->have_posts() ) { |
|
87 | + $projects_->the_post(); |
|
88 | + $connection_project['posts'][] = get_the_ID(); |
|
89 | + wp_reset_postdata(); |
|
90 | + } |
|
91 | + } |
|
92 | + |
|
93 | + if ( ! empty( $connection_project['posts'] ) ) { |
|
94 | + $post_ids = join( ',', $connection_project['posts'] ); |
|
95 | + $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
96 | + $connections[] = $connection_project; |
|
97 | + } |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Connection Products. |
102 | 102 | if ( class_exists( 'WooCommerce' ) ) { |
103 | - $connection_product['post_type'] = 'product'; |
|
104 | - $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
105 | - $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
106 | - |
|
107 | - if ( ! empty( $connection_product['posts'] ) ) { |
|
108 | - $connection_product['small_list_html'] = ''; |
|
109 | - |
|
110 | - $args = array( |
|
111 | - 'post_type' => 'product', |
|
112 | - 'post__in' => $connection_product['posts'][0], |
|
113 | - 'orderby' => 'post__in', |
|
114 | - 'no_found_rows' => true, |
|
115 | - 'ignore_sticky_posts' => 1, |
|
116 | - 'update_post_term_cache' => false, |
|
117 | - 'update_post_meta_cache' => false, |
|
118 | - ); |
|
119 | - $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
120 | - |
|
121 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
122 | - $connection_product['small_list_html'] = array(); |
|
123 | - |
|
124 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
125 | - $connection_product['posts_obj']->the_post(); |
|
126 | - $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
127 | - wp_reset_postdata(); |
|
128 | - } |
|
129 | - |
|
130 | - $connection_product['posts_obj']->rewind_posts(); |
|
131 | - $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
132 | - } |
|
133 | - $connections[] = $connection_product; |
|
134 | - } |
|
103 | + $connection_product['post_type'] = 'product'; |
|
104 | + $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
105 | + $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
106 | + |
|
107 | + if ( ! empty( $connection_product['posts'] ) ) { |
|
108 | + $connection_product['small_list_html'] = ''; |
|
109 | + |
|
110 | + $args = array( |
|
111 | + 'post_type' => 'product', |
|
112 | + 'post__in' => $connection_product['posts'][0], |
|
113 | + 'orderby' => 'post__in', |
|
114 | + 'no_found_rows' => true, |
|
115 | + 'ignore_sticky_posts' => 1, |
|
116 | + 'update_post_term_cache' => false, |
|
117 | + 'update_post_meta_cache' => false, |
|
118 | + ); |
|
119 | + $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
120 | + |
|
121 | + if ( $connection_product['posts_obj']->have_posts() ) { |
|
122 | + $connection_product['small_list_html'] = array(); |
|
123 | + |
|
124 | + while ( $connection_product['posts_obj']->have_posts() ) { |
|
125 | + $connection_product['posts_obj']->the_post(); |
|
126 | + $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
127 | + wp_reset_postdata(); |
|
128 | + } |
|
129 | + |
|
130 | + $connection_product['posts_obj']->rewind_posts(); |
|
131 | + $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
132 | + } |
|
133 | + $connections[] = $connection_product; |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // Connection Services. |
@@ -139,81 +139,81 @@ discard block |
||
139 | 139 | $connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false ); |
140 | 140 | |
141 | 141 | if ( ! empty( $connection_service['pages'] ) ) { |
142 | - $post_ids = join( ',', $connection_service['pages'] ); |
|
143 | - $connection_service['small_list_html'] = ''; |
|
144 | - |
|
145 | - $args = array( |
|
146 | - 'post_type' => 'page', |
|
147 | - 'post__in' => $connection_service['pages'], |
|
148 | - 'orderby' => 'post__in', |
|
149 | - 'no_found_rows' => true, |
|
150 | - 'ignore_sticky_posts' => 1, |
|
151 | - 'update_post_term_cache' => false, |
|
152 | - 'update_post_meta_cache' => false, |
|
153 | - ); |
|
154 | - $services_ = new \WP_Query( $args ); |
|
155 | - |
|
156 | - if ( $services_->have_posts() ) { |
|
157 | - $connection_service['small_list_html'] = array(); |
|
158 | - |
|
159 | - while ( $services_->have_posts() ) { |
|
160 | - $services_->the_post(); |
|
161 | - $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
162 | - wp_reset_postdata(); |
|
163 | - } |
|
164 | - |
|
165 | - $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
166 | - } |
|
167 | - $connections[] = $connection_service; |
|
142 | + $post_ids = join( ',', $connection_service['pages'] ); |
|
143 | + $connection_service['small_list_html'] = ''; |
|
144 | + |
|
145 | + $args = array( |
|
146 | + 'post_type' => 'page', |
|
147 | + 'post__in' => $connection_service['pages'], |
|
148 | + 'orderby' => 'post__in', |
|
149 | + 'no_found_rows' => true, |
|
150 | + 'ignore_sticky_posts' => 1, |
|
151 | + 'update_post_term_cache' => false, |
|
152 | + 'update_post_meta_cache' => false, |
|
153 | + ); |
|
154 | + $services_ = new \WP_Query( $args ); |
|
155 | + |
|
156 | + if ( $services_->have_posts() ) { |
|
157 | + $connection_service['small_list_html'] = array(); |
|
158 | + |
|
159 | + while ( $services_->have_posts() ) { |
|
160 | + $services_->the_post(); |
|
161 | + $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
162 | + wp_reset_postdata(); |
|
163 | + } |
|
164 | + |
|
165 | + $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
166 | + } |
|
167 | + $connections[] = $connection_service; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | // Connection Testimonials. |
171 | 171 | if ( post_type_exists( 'testimonial' ) ) { |
172 | - $connection_testimonial['post_type'] = 'testimonial'; |
|
173 | - $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
174 | - |
|
175 | - if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
176 | - $post_ids = join( ',', $connection_testimonial['posts'][0] ); |
|
177 | - $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
|
178 | - $connections[] = $connection_testimonial; |
|
179 | - } |
|
172 | + $connection_testimonial['post_type'] = 'testimonial'; |
|
173 | + $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
174 | + |
|
175 | + if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
176 | + $post_ids = join( ',', $connection_testimonial['posts'][0] ); |
|
177 | + $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
|
178 | + $connections[] = $connection_testimonial; |
|
179 | + } |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // Connection Team. |
183 | 183 | if ( post_type_exists( 'team' ) ) { |
184 | - $connection_team['post_type'] = 'team'; |
|
185 | - $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
186 | - |
|
187 | - if ( ! empty( $connection_team['posts'] ) ) { |
|
188 | - $post_ids = join( ',', $connection_team['posts'][0] ); |
|
189 | - $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
|
190 | - $connection_team['small_list_html'] = ''; |
|
191 | - |
|
192 | - $args = array( |
|
193 | - 'post_type' => 'team', |
|
194 | - 'post__in' => $connection_team['posts'][0], |
|
195 | - 'orderby' => 'post__in', |
|
196 | - 'no_found_rows' => true, |
|
197 | - 'ignore_sticky_posts' => 1, |
|
198 | - 'update_post_term_cache' => false, |
|
199 | - 'update_post_meta_cache' => false, |
|
200 | - ); |
|
201 | - $team_ = new \WP_Query( $args ); |
|
202 | - |
|
203 | - if ( $team_->have_posts() ) { |
|
204 | - global $lsx_team; |
|
205 | - $connection_team['small_list_html'] = array(); |
|
206 | - |
|
207 | - while ( $team_->have_posts() ) { |
|
208 | - $team_->the_post(); |
|
209 | - $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
210 | - wp_reset_postdata(); |
|
211 | - } |
|
212 | - |
|
213 | - $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
214 | - } |
|
215 | - $connections[] = $connection_team; |
|
216 | - } |
|
184 | + $connection_team['post_type'] = 'team'; |
|
185 | + $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
186 | + |
|
187 | + if ( ! empty( $connection_team['posts'] ) ) { |
|
188 | + $post_ids = join( ',', $connection_team['posts'][0] ); |
|
189 | + $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
|
190 | + $connection_team['small_list_html'] = ''; |
|
191 | + |
|
192 | + $args = array( |
|
193 | + 'post_type' => 'team', |
|
194 | + 'post__in' => $connection_team['posts'][0], |
|
195 | + 'orderby' => 'post__in', |
|
196 | + 'no_found_rows' => true, |
|
197 | + 'ignore_sticky_posts' => 1, |
|
198 | + 'update_post_term_cache' => false, |
|
199 | + 'update_post_meta_cache' => false, |
|
200 | + ); |
|
201 | + $team_ = new \WP_Query( $args ); |
|
202 | + |
|
203 | + if ( $team_->have_posts() ) { |
|
204 | + global $lsx_team; |
|
205 | + $connection_team['small_list_html'] = array(); |
|
206 | + |
|
207 | + while ( $team_->have_posts() ) { |
|
208 | + $team_->the_post(); |
|
209 | + $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
210 | + wp_reset_postdata(); |
|
211 | + } |
|
212 | + |
|
213 | + $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
214 | + } |
|
215 | + $connections[] = $connection_team; |
|
216 | + } |
|
217 | 217 | } |
218 | 218 | ?> |
219 | 219 | |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | <?php if ( count( $connections ) > 0 ) : ?> |
231 | 231 | <?php foreach ( $connections as $i => $connection ) : ?> |
232 | 232 | <?php |
233 | - if ( 'testimonial' === $connection['post_type'] ) { |
|
234 | - echo '<div class="tab-pane-fake">'; |
|
235 | - echo do_shortcode( $connection['shortcode'] ); |
|
236 | - echo '</div>'; |
|
237 | - } |
|
238 | - ?> |
|
233 | + if ( 'testimonial' === $connection['post_type'] ) { |
|
234 | + echo '<div class="tab-pane-fake">'; |
|
235 | + echo do_shortcode( $connection['shortcode'] ); |
|
236 | + echo '</div>'; |
|
237 | + } |
|
238 | + ?> |
|
239 | 239 | <?php endforeach; ?> |
240 | 240 | <?php endif; ?> |
241 | 241 | </div> |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | <?php if ( count( $connections ) > 0 ) : ?> |
292 | 292 | <?php foreach ( $connections as $i => $connection ) : ?> |
293 | 293 | <?php |
294 | - // Team is now visible on detail box. |
|
295 | - // Services is now visible on detail box. |
|
296 | - // Testimonials is now visible below the content. |
|
297 | - if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) { |
|
298 | - continue; |
|
299 | - } |
|
300 | - ?> |
|
294 | + // Team is now visible on detail box. |
|
295 | + // Services is now visible on detail box. |
|
296 | + // Testimonials is now visible below the content. |
|
297 | + if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) { |
|
298 | + continue; |
|
299 | + } |
|
300 | + ?> |
|
301 | 301 | <?php if ( 'page' !== $connection['post_type'] ) { ?> |
302 | 302 | <div class="lsx-projects-section lsx-full-width"> |
303 | 303 | <div class="row"> |
@@ -305,34 +305,34 @@ discard block |
||
305 | 305 | <h3 class="lsx-title"><?php echo wp_kses_post( $connection['title'] ); ?></h3> |
306 | 306 | |
307 | 307 | <?php |
308 | - if ( 'product' === $connection['post_type'] ) { |
|
309 | - |
|
310 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
311 | - // @codingStandardsIgnoreLine |
|
312 | - echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
313 | - |
|
314 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
315 | - $connection_product['posts_obj']->the_post(); |
|
316 | - wc_get_template( 'content-widget-product.php', array( |
|
317 | - 'show_rating' => false, |
|
318 | - ) ); |
|
319 | - |
|
320 | - wp_reset_postdata(); |
|
321 | - } |
|
322 | - |
|
323 | - // @codingStandardsIgnoreLine |
|
324 | - echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
325 | - } |
|
326 | - } else { |
|
327 | - echo do_shortcode( $connection['shortcode'] ); |
|
328 | - } |
|
329 | - ?> |
|
308 | + if ( 'product' === $connection['post_type'] ) { |
|
309 | + |
|
310 | + if ( $connection_product['posts_obj']->have_posts() ) { |
|
311 | + // @codingStandardsIgnoreLine |
|
312 | + echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
313 | + |
|
314 | + while ( $connection_product['posts_obj']->have_posts() ) { |
|
315 | + $connection_product['posts_obj']->the_post(); |
|
316 | + wc_get_template( 'content-widget-product.php', array( |
|
317 | + 'show_rating' => false, |
|
318 | + ) ); |
|
319 | + |
|
320 | + wp_reset_postdata(); |
|
321 | + } |
|
322 | + |
|
323 | + // @codingStandardsIgnoreLine |
|
324 | + echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
325 | + } |
|
326 | + } else { |
|
327 | + echo do_shortcode( $connection['shortcode'] ); |
|
328 | + } |
|
329 | + ?> |
|
330 | 330 | </div> |
331 | 331 | </div> |
332 | 332 | </div> |
333 | 333 | <?php |
334 | - } |
|
335 | - ?> |
|
334 | + } |
|
335 | + ?> |
|
336 | 336 | <?php endforeach; ?> |
337 | 337 | <?php endif; ?> |
338 | 338 |