@@ -10,191 +10,191 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class LSX_Team_Widget extends WP_Widget { |
12 | 12 | |
13 | - public function __construct() { |
|
14 | - $widget_ops = array( |
|
15 | - 'classname' => 'lsx-team', |
|
16 | - ); |
|
13 | + public function __construct() { |
|
14 | + $widget_ops = array( |
|
15 | + 'classname' => 'lsx-team', |
|
16 | + ); |
|
17 | 17 | |
18 | - parent::__construct( 'LSX_Team_Widget', esc_html__( 'LSX Team Members', 'lsx-team' ), $widget_ops ); |
|
19 | - } |
|
18 | + parent::__construct( 'LSX_Team_Widget', esc_html__( 'LSX Team Members', 'lsx-team' ), $widget_ops ); |
|
19 | + } |
|
20 | 20 | |
21 | - public function widget( $args, $instance ) { |
|
22 | - extract( $args ); |
|
21 | + public function widget( $args, $instance ) { |
|
22 | + extract( $args ); |
|
23 | 23 | |
24 | - $title = $instance['title']; |
|
25 | - $title_link = $instance['title_link']; |
|
26 | - $tagline = $instance['tagline']; |
|
27 | - $columns = $instance['columns']; |
|
28 | - $orderby = $instance['orderby']; |
|
29 | - $order = $instance['order']; |
|
30 | - $role = $instance['role']; |
|
31 | - $limit = $instance['limit']; |
|
32 | - $include = $instance['include']; |
|
33 | - $display = $instance['display']; |
|
34 | - $size = $instance['size']; |
|
35 | - $show_link = $instance['show_link']; |
|
36 | - $show_image = $instance['show_image']; |
|
37 | - $show_roles = $instance['show_roles']; |
|
38 | - $show_job_title = $instance['show_job_title']; |
|
39 | - $show_desc = $instance['show_desc']; |
|
40 | - $show_social = $instance['show_social']; |
|
41 | - $button_text = $instance['button_text']; |
|
42 | - $carousel = $instance['carousel']; |
|
43 | - $featured = $instance['featured']; |
|
24 | + $title = $instance['title']; |
|
25 | + $title_link = $instance['title_link']; |
|
26 | + $tagline = $instance['tagline']; |
|
27 | + $columns = $instance['columns']; |
|
28 | + $orderby = $instance['orderby']; |
|
29 | + $order = $instance['order']; |
|
30 | + $role = $instance['role']; |
|
31 | + $limit = $instance['limit']; |
|
32 | + $include = $instance['include']; |
|
33 | + $display = $instance['display']; |
|
34 | + $size = $instance['size']; |
|
35 | + $show_link = $instance['show_link']; |
|
36 | + $show_image = $instance['show_image']; |
|
37 | + $show_roles = $instance['show_roles']; |
|
38 | + $show_job_title = $instance['show_job_title']; |
|
39 | + $show_desc = $instance['show_desc']; |
|
40 | + $show_social = $instance['show_social']; |
|
41 | + $button_text = $instance['button_text']; |
|
42 | + $carousel = $instance['carousel']; |
|
43 | + $featured = $instance['featured']; |
|
44 | 44 | |
45 | - // If limit not set, display 99 posts |
|
46 | - if ( empty( $limit ) ) { |
|
47 | - $limit = '99'; |
|
48 | - } |
|
45 | + // If limit not set, display 99 posts |
|
46 | + if ( empty( $limit ) ) { |
|
47 | + $limit = '99'; |
|
48 | + } |
|
49 | 49 | |
50 | - // If specific posts included, display 99 posts |
|
51 | - if ( ! empty( $include ) ) { |
|
52 | - $limit = '99'; |
|
53 | - } |
|
50 | + // If specific posts included, display 99 posts |
|
51 | + if ( ! empty( $include ) ) { |
|
52 | + $limit = '99'; |
|
53 | + } |
|
54 | 54 | |
55 | - // Disregard specific ID setting if specific role is defined |
|
56 | - if ( 'all' !== $role ) { |
|
57 | - $include = ''; |
|
58 | - } else { |
|
59 | - $role = ''; |
|
60 | - } |
|
55 | + // Disregard specific ID setting if specific role is defined |
|
56 | + if ( 'all' !== $role ) { |
|
57 | + $include = ''; |
|
58 | + } else { |
|
59 | + $role = ''; |
|
60 | + } |
|
61 | 61 | |
62 | - $show_link = '1' == $show_link ? 'true' : 'false'; |
|
63 | - $show_image = '1' == $show_image ? 'true' : 'false'; |
|
64 | - $show_roles = '1' == $show_roles ? 'true' : 'false'; |
|
65 | - $show_job_title = '1' == $show_job_title ? 'true' : 'false'; |
|
66 | - $show_desc = '1' == $show_desc ? 'true' : 'false'; |
|
67 | - $show_social = '1' == $show_social ? 'true' : 'false'; |
|
68 | - $carousel = '1' == $carousel ? 'true' : 'false'; |
|
69 | - $featured = '1' == $featured ? 'true' : 'false'; |
|
62 | + $show_link = '1' == $show_link ? 'true' : 'false'; |
|
63 | + $show_image = '1' == $show_image ? 'true' : 'false'; |
|
64 | + $show_roles = '1' == $show_roles ? 'true' : 'false'; |
|
65 | + $show_job_title = '1' == $show_job_title ? 'true' : 'false'; |
|
66 | + $show_desc = '1' == $show_desc ? 'true' : 'false'; |
|
67 | + $show_social = '1' == $show_social ? 'true' : 'false'; |
|
68 | + $carousel = '1' == $carousel ? 'true' : 'false'; |
|
69 | + $featured = '1' == $featured ? 'true' : 'false'; |
|
70 | 70 | |
71 | - if ( $title_link ) { |
|
72 | - //$link_open = '<a href="' . $title_link . '">'; |
|
73 | - $link_open = ''; |
|
74 | - $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
|
75 | - //$link_close = '</a>'; |
|
76 | - $link_close = ''; |
|
77 | - $link_btn_close = '</a>'; |
|
78 | - } else { |
|
79 | - $link_open = ''; |
|
80 | - $link_btn_open = ''; |
|
81 | - $link_close = ''; |
|
82 | - $link_btn_close = ''; |
|
83 | - } |
|
71 | + if ( $title_link ) { |
|
72 | + //$link_open = '<a href="' . $title_link . '">'; |
|
73 | + $link_open = ''; |
|
74 | + $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
|
75 | + //$link_close = '</a>'; |
|
76 | + $link_close = ''; |
|
77 | + $link_btn_close = '</a>'; |
|
78 | + } else { |
|
79 | + $link_open = ''; |
|
80 | + $link_btn_open = ''; |
|
81 | + $link_close = ''; |
|
82 | + $link_btn_close = ''; |
|
83 | + } |
|
84 | 84 | |
85 | - echo wp_kses_post( $before_widget ); |
|
85 | + echo wp_kses_post( $before_widget ); |
|
86 | 86 | |
87 | - if ( $title ) { |
|
88 | - echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
|
89 | - } |
|
87 | + if ( $title ) { |
|
88 | + echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
|
89 | + } |
|
90 | 90 | |
91 | - if ( $tagline ) { |
|
92 | - echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
|
93 | - } |
|
91 | + if ( $tagline ) { |
|
92 | + echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
|
93 | + } |
|
94 | 94 | |
95 | - if ( class_exists( 'LSX_Team' ) ) { |
|
96 | - lsx_team( array( |
|
97 | - 'columns' => $columns, |
|
98 | - 'orderby' => $orderby, |
|
99 | - 'order' => $order, |
|
100 | - 'role' => $role, |
|
101 | - 'limit' => $limit, |
|
102 | - 'include' => $include, |
|
103 | - 'display' => $display, |
|
104 | - 'size' => $size, |
|
105 | - 'show_link' => $show_link, |
|
106 | - 'show_image' => $show_image, |
|
107 | - 'show_roles' => $show_roles, |
|
108 | - 'show_job_title' => $show_job_title, |
|
109 | - 'show_desc' => $show_desc, |
|
110 | - 'show_social' => $show_social, |
|
111 | - 'carousel' => $carousel, |
|
112 | - 'featured' => $featured, |
|
113 | - ) ); |
|
95 | + if ( class_exists( 'LSX_Team' ) ) { |
|
96 | + lsx_team( array( |
|
97 | + 'columns' => $columns, |
|
98 | + 'orderby' => $orderby, |
|
99 | + 'order' => $order, |
|
100 | + 'role' => $role, |
|
101 | + 'limit' => $limit, |
|
102 | + 'include' => $include, |
|
103 | + 'display' => $display, |
|
104 | + 'size' => $size, |
|
105 | + 'show_link' => $show_link, |
|
106 | + 'show_image' => $show_image, |
|
107 | + 'show_roles' => $show_roles, |
|
108 | + 'show_job_title' => $show_job_title, |
|
109 | + 'show_desc' => $show_desc, |
|
110 | + 'show_social' => $show_social, |
|
111 | + 'carousel' => $carousel, |
|
112 | + 'featured' => $featured, |
|
113 | + ) ); |
|
114 | 114 | |
115 | - }; |
|
115 | + }; |
|
116 | 116 | |
117 | - if ( $button_text && $title_link ) { |
|
118 | - echo wp_kses_post( '<p class="text-center lsx-team-archive-link-wrap"><span class="lsx-team-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
|
119 | - } |
|
117 | + if ( $button_text && $title_link ) { |
|
118 | + echo wp_kses_post( '<p class="text-center lsx-team-archive-link-wrap"><span class="lsx-team-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
|
119 | + } |
|
120 | 120 | |
121 | - echo wp_kses_post( $after_widget ); |
|
122 | - } |
|
121 | + echo wp_kses_post( $after_widget ); |
|
122 | + } |
|
123 | 123 | |
124 | - public function update( $new_instance, $old_instance ) { |
|
125 | - $instance = $old_instance; |
|
124 | + public function update( $new_instance, $old_instance ) { |
|
125 | + $instance = $old_instance; |
|
126 | 126 | |
127 | - $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
|
128 | - $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
|
129 | - $instance['tagline'] = strip_tags( $new_instance['tagline'] ); |
|
130 | - $instance['columns'] = strip_tags( $new_instance['columns'] ); |
|
131 | - $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
|
132 | - $instance['order'] = strip_tags( $new_instance['order'] ); |
|
133 | - $instance['role'] = strip_tags( $new_instance['role'] ); |
|
134 | - $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
135 | - $instance['include'] = strip_tags( $new_instance['include'] ); |
|
136 | - $instance['display'] = strip_tags( $new_instance['display'] ); |
|
137 | - $instance['size'] = strip_tags( $new_instance['size'] ); |
|
138 | - $instance['show_link'] = strip_tags( $new_instance['show_link'] ); |
|
139 | - $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
|
140 | - $instance['show_roles'] = strip_tags( $new_instance['show_roles'] ); |
|
141 | - $instance['show_job_title'] = strip_tags( $new_instance['show_job_title'] ); |
|
142 | - $instance['show_desc'] = strip_tags( $new_instance['show_desc'] ); |
|
143 | - $instance['show_social'] = strip_tags( $new_instance['show_social'] ); |
|
144 | - $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
|
145 | - $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
|
146 | - $instance['featured'] = strip_tags( $new_instance['featured'] ); |
|
127 | + $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
|
128 | + $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
|
129 | + $instance['tagline'] = strip_tags( $new_instance['tagline'] ); |
|
130 | + $instance['columns'] = strip_tags( $new_instance['columns'] ); |
|
131 | + $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
|
132 | + $instance['order'] = strip_tags( $new_instance['order'] ); |
|
133 | + $instance['role'] = strip_tags( $new_instance['role'] ); |
|
134 | + $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
135 | + $instance['include'] = strip_tags( $new_instance['include'] ); |
|
136 | + $instance['display'] = strip_tags( $new_instance['display'] ); |
|
137 | + $instance['size'] = strip_tags( $new_instance['size'] ); |
|
138 | + $instance['show_link'] = strip_tags( $new_instance['show_link'] ); |
|
139 | + $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
|
140 | + $instance['show_roles'] = strip_tags( $new_instance['show_roles'] ); |
|
141 | + $instance['show_job_title'] = strip_tags( $new_instance['show_job_title'] ); |
|
142 | + $instance['show_desc'] = strip_tags( $new_instance['show_desc'] ); |
|
143 | + $instance['show_social'] = strip_tags( $new_instance['show_social'] ); |
|
144 | + $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
|
145 | + $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
|
146 | + $instance['featured'] = strip_tags( $new_instance['featured'] ); |
|
147 | 147 | |
148 | - return $instance; |
|
149 | - } |
|
148 | + return $instance; |
|
149 | + } |
|
150 | 150 | |
151 | - public function form( $instance ) { |
|
152 | - $defaults = array( |
|
153 | - 'title' => 'Team Members', |
|
154 | - 'title_link' => '', |
|
155 | - 'tagline' => '', |
|
156 | - 'columns' => '1', |
|
157 | - 'orderby' => 'name', |
|
158 | - 'order' => 'ASC', |
|
159 | - 'role' => '', |
|
160 | - 'limit' => '', |
|
161 | - 'include' => '', |
|
162 | - 'display' => 'excerpt', |
|
163 | - 'size' => 'lsx-team-archive', |
|
164 | - 'show_link' => 0, |
|
165 | - 'show_image' => 1, |
|
166 | - 'show_roles' => 0, |
|
167 | - 'show_job_title' => 1, |
|
168 | - 'show_desc' => 1, |
|
169 | - 'show_social' => 1, |
|
170 | - 'button_text' => '', |
|
171 | - 'carousel' => 1, |
|
172 | - 'featured' => 0, |
|
173 | - ); |
|
151 | + public function form( $instance ) { |
|
152 | + $defaults = array( |
|
153 | + 'title' => 'Team Members', |
|
154 | + 'title_link' => '', |
|
155 | + 'tagline' => '', |
|
156 | + 'columns' => '1', |
|
157 | + 'orderby' => 'name', |
|
158 | + 'order' => 'ASC', |
|
159 | + 'role' => '', |
|
160 | + 'limit' => '', |
|
161 | + 'include' => '', |
|
162 | + 'display' => 'excerpt', |
|
163 | + 'size' => 'lsx-team-archive', |
|
164 | + 'show_link' => 0, |
|
165 | + 'show_image' => 1, |
|
166 | + 'show_roles' => 0, |
|
167 | + 'show_job_title' => 1, |
|
168 | + 'show_desc' => 1, |
|
169 | + 'show_social' => 1, |
|
170 | + 'button_text' => '', |
|
171 | + 'carousel' => 1, |
|
172 | + 'featured' => 0, |
|
173 | + ); |
|
174 | 174 | |
175 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
175 | + $instance = wp_parse_args( (array) $instance, $defaults ); |
|
176 | 176 | |
177 | - $title = esc_attr( $instance['title'] ); |
|
178 | - $title_link = esc_attr( $instance['title_link'] ); |
|
179 | - $tagline = esc_attr( $instance['tagline'] ); |
|
180 | - $columns = esc_attr( $instance['columns'] ); |
|
181 | - $orderby = esc_attr( $instance['orderby'] ); |
|
182 | - $order = esc_attr( $instance['order'] ); |
|
183 | - $role = esc_attr( $instance['role'] ); |
|
184 | - $limit = esc_attr( $instance['limit'] ); |
|
185 | - $include = esc_attr( $instance['include'] ); |
|
186 | - $display = esc_attr( $instance['display'] ); |
|
187 | - $size = esc_attr( $instance['size'] ); |
|
188 | - $show_link = esc_attr( $instance['show_link'] ); |
|
189 | - $show_image = esc_attr( $instance['show_image'] ); |
|
190 | - $show_roles = esc_attr( $instance['show_roles'] ); |
|
191 | - $show_job_title = esc_attr( $instance['show_job_title'] ); |
|
192 | - $show_desc = esc_attr( $instance['show_desc'] ); |
|
193 | - $show_social = esc_attr( $instance['show_social'] ); |
|
194 | - $button_text = esc_attr( $instance['button_text'] ); |
|
195 | - $carousel = esc_attr( $instance['carousel'] ); |
|
196 | - $featured = esc_attr( $instance['featured'] ); |
|
197 | - ?> |
|
177 | + $title = esc_attr( $instance['title'] ); |
|
178 | + $title_link = esc_attr( $instance['title_link'] ); |
|
179 | + $tagline = esc_attr( $instance['tagline'] ); |
|
180 | + $columns = esc_attr( $instance['columns'] ); |
|
181 | + $orderby = esc_attr( $instance['orderby'] ); |
|
182 | + $order = esc_attr( $instance['order'] ); |
|
183 | + $role = esc_attr( $instance['role'] ); |
|
184 | + $limit = esc_attr( $instance['limit'] ); |
|
185 | + $include = esc_attr( $instance['include'] ); |
|
186 | + $display = esc_attr( $instance['display'] ); |
|
187 | + $size = esc_attr( $instance['size'] ); |
|
188 | + $show_link = esc_attr( $instance['show_link'] ); |
|
189 | + $show_image = esc_attr( $instance['show_image'] ); |
|
190 | + $show_roles = esc_attr( $instance['show_roles'] ); |
|
191 | + $show_job_title = esc_attr( $instance['show_job_title'] ); |
|
192 | + $show_desc = esc_attr( $instance['show_desc'] ); |
|
193 | + $show_social = esc_attr( $instance['show_social'] ); |
|
194 | + $button_text = esc_attr( $instance['button_text'] ); |
|
195 | + $carousel = esc_attr( $instance['carousel'] ); |
|
196 | + $featured = esc_attr( $instance['featured'] ); |
|
197 | + ?> |
|
198 | 198 | <p> |
199 | 199 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-team' ); ?></label> |
200 | 200 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> |
@@ -213,63 +213,63 @@ discard block |
||
213 | 213 | <label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-team' ); ?></label> |
214 | 214 | <select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat layout"> |
215 | 215 | <?php |
216 | - $options = array( '1', '2', '3', '4' ); |
|
216 | + $options = array( '1', '2', '3', '4' ); |
|
217 | 217 | |
218 | - foreach ( $options as $option ) { |
|
219 | - echo '<option value="' . lcfirst( esc_attr( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
|
220 | - } |
|
221 | - ?> |
|
218 | + foreach ( $options as $option ) { |
|
219 | + echo '<option value="' . lcfirst( esc_attr( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </select> |
223 | 223 | </p> |
224 | 224 | <p> |
225 | 225 | <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-team' ); ?></label> |
226 | 226 | <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat"> |
227 | 227 | <?php |
228 | - $options = array( |
|
229 | - esc_html__( 'None', 'lsx-team' ) => 'none', |
|
230 | - esc_html__( 'ID', 'lsx-team' ) => 'ID', |
|
231 | - esc_html__( 'Name', 'lsx-team' ) => 'name', |
|
232 | - esc_html__( 'Date', 'lsx-team' ) => 'date', |
|
233 | - esc_html__( 'Modified Date', 'lsx-team' ) => 'modified', |
|
234 | - esc_html__( 'Random', 'lsx-team' ) => 'rand', |
|
235 | - esc_html__( 'Menu (WP dashboard order)', 'lsx-team' ) => 'menu_order', |
|
236 | - ); |
|
228 | + $options = array( |
|
229 | + esc_html__( 'None', 'lsx-team' ) => 'none', |
|
230 | + esc_html__( 'ID', 'lsx-team' ) => 'ID', |
|
231 | + esc_html__( 'Name', 'lsx-team' ) => 'name', |
|
232 | + esc_html__( 'Date', 'lsx-team' ) => 'date', |
|
233 | + esc_html__( 'Modified Date', 'lsx-team' ) => 'modified', |
|
234 | + esc_html__( 'Random', 'lsx-team' ) => 'rand', |
|
235 | + esc_html__( 'Menu (WP dashboard order)', 'lsx-team' ) => 'menu_order', |
|
236 | + ); |
|
237 | 237 | |
238 | - foreach ( $options as $name => $value ) { |
|
239 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
240 | - } |
|
241 | - ?> |
|
238 | + foreach ( $options as $name => $value ) { |
|
239 | + echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
240 | + } |
|
241 | + ?> |
|
242 | 242 | </select> |
243 | 243 | </p> |
244 | 244 | <p> |
245 | 245 | <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-team' ); ?></label> |
246 | 246 | <select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat"> |
247 | 247 | <?php |
248 | - $options = array( |
|
249 | - esc_html__( 'Ascending', 'lsx-team' ) => 'ASC', |
|
250 | - esc_html__( 'Descending', 'lsx-team' ) => 'DESC', |
|
251 | - ); |
|
248 | + $options = array( |
|
249 | + esc_html__( 'Ascending', 'lsx-team' ) => 'ASC', |
|
250 | + esc_html__( 'Descending', 'lsx-team' ) => 'DESC', |
|
251 | + ); |
|
252 | 252 | |
253 | - foreach ( $options as $name => $value ) { |
|
254 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
255 | - } |
|
256 | - ?> |
|
253 | + foreach ( $options as $name => $value ) { |
|
254 | + echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
255 | + } |
|
256 | + ?> |
|
257 | 257 | </select> |
258 | 258 | </p> |
259 | 259 | <p> |
260 | 260 | <label for="<?php echo esc_attr( $this->get_field_id( 'role' ) ); ?>"><?php esc_html_e( 'Role:', 'lsx-team' ); ?></label> |
261 | 261 | <select name="<?php echo esc_attr( $this->get_field_name( 'role' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'role' ) ); ?>" class="widefat"> |
262 | 262 | <?php |
263 | - $options = get_terms( 'team_role' ); |
|
264 | - ?> |
|
263 | + $options = get_terms( 'team_role' ); |
|
264 | + ?> |
|
265 | 265 | <option value="all" id="all"> |
266 | 266 | <?php esc_html_e( 'All Roles', 'lsx-team' ); ?> |
267 | 267 | </option> |
268 | 268 | <?php |
269 | - foreach ( $options as $option ) { |
|
270 | - echo '<option value="' . esc_attr( $option->slug ) . '" id="' . esc_attr( $option->slug ) . '"', $role == $option->slug ? ' selected="selected"' : '', '>', esc_html( $option->name ), '</option>'; |
|
271 | - } |
|
272 | - ?> |
|
269 | + foreach ( $options as $option ) { |
|
270 | + echo '<option value="' . esc_attr( $option->slug ) . '" id="' . esc_attr( $option->slug ) . '"', $role == $option->slug ? ' selected="selected"' : '', '>', esc_html( $option->name ), '</option>'; |
|
271 | + } |
|
272 | + ?> |
|
273 | 273 | </select> |
274 | 274 | <small><?php esc_html_e( 'Display team members within a specific role', 'lsx-team' ); ?></small> |
275 | 275 | </p> |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | <label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-team' ); ?></label> |
288 | 288 | <select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat"> |
289 | 289 | <?php |
290 | - $options = array( |
|
291 | - esc_html__( 'Excerpt', 'lsx-team' ) => 'excerpt', |
|
292 | - esc_html__( 'Full Content', 'lsx-team' ) => 'full', |
|
293 | - ); |
|
290 | + $options = array( |
|
291 | + esc_html__( 'Excerpt', 'lsx-team' ) => 'excerpt', |
|
292 | + esc_html__( 'Full Content', 'lsx-team' ) => 'full', |
|
293 | + ); |
|
294 | 294 | |
295 | - foreach ( $options as $name => $value ) { |
|
296 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
297 | - } |
|
298 | - ?> |
|
295 | + foreach ( $options as $name => $value ) { |
|
296 | + echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
297 | + } |
|
298 | + ?> |
|
299 | 299 | </select> |
300 | 300 | </p> |
301 | 301 | <p> |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | <label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-team' ); ?></label> |
341 | 341 | </p> |
342 | 342 | <?php |
343 | - } |
|
343 | + } |
|
344 | 344 | |
345 | 345 | } |
346 | 346 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * Registers the Widget |
349 | 349 | */ |
350 | 350 | function lsx_team_widget() { |
351 | - register_widget( 'LSX_Team_Widget' ); |
|
351 | + register_widget( 'LSX_Team_Widget' ); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | add_action( 'widgets_init', 'lsx_team_widget' ); |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | 'classname' => 'lsx-team', |
16 | 16 | ); |
17 | 17 | |
18 | - parent::__construct( 'LSX_Team_Widget', esc_html__( 'LSX Team Members', 'lsx-team' ), $widget_ops ); |
|
18 | + parent::__construct('LSX_Team_Widget', esc_html__('LSX Team Members', 'lsx-team'), $widget_ops); |
|
19 | 19 | } |
20 | 20 | |
21 | - public function widget( $args, $instance ) { |
|
22 | - extract( $args ); |
|
21 | + public function widget($args, $instance) { |
|
22 | + extract($args); |
|
23 | 23 | |
24 | 24 | $title = $instance['title']; |
25 | 25 | $title_link = $instance['title_link']; |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | $featured = $instance['featured']; |
44 | 44 | |
45 | 45 | // If limit not set, display 99 posts |
46 | - if ( empty( $limit ) ) { |
|
46 | + if (empty($limit)) { |
|
47 | 47 | $limit = '99'; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // If specific posts included, display 99 posts |
51 | - if ( ! empty( $include ) ) { |
|
51 | + if (!empty($include)) { |
|
52 | 52 | $limit = '99'; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Disregard specific ID setting if specific role is defined |
56 | - if ( 'all' !== $role ) { |
|
56 | + if ('all' !== $role) { |
|
57 | 57 | $include = ''; |
58 | 58 | } else { |
59 | 59 | $role = ''; |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | $carousel = '1' == $carousel ? 'true' : 'false'; |
69 | 69 | $featured = '1' == $featured ? 'true' : 'false'; |
70 | 70 | |
71 | - if ( $title_link ) { |
|
71 | + if ($title_link) { |
|
72 | 72 | //$link_open = '<a href="' . $title_link . '">'; |
73 | 73 | $link_open = ''; |
74 | - $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
|
74 | + $link_btn_open = '<a href="'.$title_link.'" class="btn border-btn">'; |
|
75 | 75 | //$link_close = '</a>'; |
76 | 76 | $link_close = ''; |
77 | 77 | $link_btn_close = '</a>'; |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | $link_btn_close = ''; |
83 | 83 | } |
84 | 84 | |
85 | - echo wp_kses_post( $before_widget ); |
|
85 | + echo wp_kses_post($before_widget); |
|
86 | 86 | |
87 | - if ( $title ) { |
|
88 | - echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
|
87 | + if ($title) { |
|
88 | + echo wp_kses_post($before_title.$link_open.$title.$link_close.$after_title); |
|
89 | 89 | } |
90 | 90 | |
91 | - if ( $tagline ) { |
|
92 | - echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
|
91 | + if ($tagline) { |
|
92 | + echo '<p class="tagline text-center">'.esc_html($tagline).'</p>'; |
|
93 | 93 | } |
94 | 94 | |
95 | - if ( class_exists( 'LSX_Team' ) ) { |
|
96 | - lsx_team( array( |
|
95 | + if (class_exists('LSX_Team')) { |
|
96 | + lsx_team(array( |
|
97 | 97 | 'columns' => $columns, |
98 | 98 | 'orderby' => $orderby, |
99 | 99 | 'order' => $order, |
@@ -110,45 +110,45 @@ discard block |
||
110 | 110 | 'show_social' => $show_social, |
111 | 111 | 'carousel' => $carousel, |
112 | 112 | 'featured' => $featured, |
113 | - ) ); |
|
113 | + )); |
|
114 | 114 | |
115 | 115 | }; |
116 | 116 | |
117 | - if ( $button_text && $title_link ) { |
|
118 | - echo wp_kses_post( '<p class="text-center lsx-team-archive-link-wrap"><span class="lsx-team-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
|
117 | + if ($button_text && $title_link) { |
|
118 | + echo wp_kses_post('<p class="text-center lsx-team-archive-link-wrap"><span class="lsx-team-archive-link">'.$link_btn_open.$button_text.' <i class="fa fa-angle-right"></i>'.$link_btn_close.'</span></p>'); |
|
119 | 119 | } |
120 | 120 | |
121 | - echo wp_kses_post( $after_widget ); |
|
121 | + echo wp_kses_post($after_widget); |
|
122 | 122 | } |
123 | 123 | |
124 | - public function update( $new_instance, $old_instance ) { |
|
124 | + public function update($new_instance, $old_instance) { |
|
125 | 125 | $instance = $old_instance; |
126 | 126 | |
127 | - $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
|
128 | - $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
|
129 | - $instance['tagline'] = strip_tags( $new_instance['tagline'] ); |
|
130 | - $instance['columns'] = strip_tags( $new_instance['columns'] ); |
|
131 | - $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
|
132 | - $instance['order'] = strip_tags( $new_instance['order'] ); |
|
133 | - $instance['role'] = strip_tags( $new_instance['role'] ); |
|
134 | - $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
135 | - $instance['include'] = strip_tags( $new_instance['include'] ); |
|
136 | - $instance['display'] = strip_tags( $new_instance['display'] ); |
|
137 | - $instance['size'] = strip_tags( $new_instance['size'] ); |
|
138 | - $instance['show_link'] = strip_tags( $new_instance['show_link'] ); |
|
139 | - $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
|
140 | - $instance['show_roles'] = strip_tags( $new_instance['show_roles'] ); |
|
141 | - $instance['show_job_title'] = strip_tags( $new_instance['show_job_title'] ); |
|
142 | - $instance['show_desc'] = strip_tags( $new_instance['show_desc'] ); |
|
143 | - $instance['show_social'] = strip_tags( $new_instance['show_social'] ); |
|
144 | - $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
|
145 | - $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
|
146 | - $instance['featured'] = strip_tags( $new_instance['featured'] ); |
|
127 | + $instance['title'] = wp_kses_post(force_balance_tags($new_instance['title'])); |
|
128 | + $instance['title_link'] = strip_tags($new_instance['title_link']); |
|
129 | + $instance['tagline'] = strip_tags($new_instance['tagline']); |
|
130 | + $instance['columns'] = strip_tags($new_instance['columns']); |
|
131 | + $instance['orderby'] = strip_tags($new_instance['orderby']); |
|
132 | + $instance['order'] = strip_tags($new_instance['order']); |
|
133 | + $instance['role'] = strip_tags($new_instance['role']); |
|
134 | + $instance['limit'] = strip_tags($new_instance['limit']); |
|
135 | + $instance['include'] = strip_tags($new_instance['include']); |
|
136 | + $instance['display'] = strip_tags($new_instance['display']); |
|
137 | + $instance['size'] = strip_tags($new_instance['size']); |
|
138 | + $instance['show_link'] = strip_tags($new_instance['show_link']); |
|
139 | + $instance['show_image'] = strip_tags($new_instance['show_image']); |
|
140 | + $instance['show_roles'] = strip_tags($new_instance['show_roles']); |
|
141 | + $instance['show_job_title'] = strip_tags($new_instance['show_job_title']); |
|
142 | + $instance['show_desc'] = strip_tags($new_instance['show_desc']); |
|
143 | + $instance['show_social'] = strip_tags($new_instance['show_social']); |
|
144 | + $instance['button_text'] = strip_tags($new_instance['button_text']); |
|
145 | + $instance['carousel'] = strip_tags($new_instance['carousel']); |
|
146 | + $instance['featured'] = strip_tags($new_instance['featured']); |
|
147 | 147 | |
148 | 148 | return $instance; |
149 | 149 | } |
150 | 150 | |
151 | - public function form( $instance ) { |
|
151 | + public function form($instance) { |
|
152 | 152 | $defaults = array( |
153 | 153 | 'title' => 'Team Members', |
154 | 154 | 'title_link' => '', |
@@ -172,172 +172,172 @@ discard block |
||
172 | 172 | 'featured' => 0, |
173 | 173 | ); |
174 | 174 | |
175 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
175 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
176 | 176 | |
177 | - $title = esc_attr( $instance['title'] ); |
|
178 | - $title_link = esc_attr( $instance['title_link'] ); |
|
179 | - $tagline = esc_attr( $instance['tagline'] ); |
|
180 | - $columns = esc_attr( $instance['columns'] ); |
|
181 | - $orderby = esc_attr( $instance['orderby'] ); |
|
182 | - $order = esc_attr( $instance['order'] ); |
|
183 | - $role = esc_attr( $instance['role'] ); |
|
184 | - $limit = esc_attr( $instance['limit'] ); |
|
185 | - $include = esc_attr( $instance['include'] ); |
|
186 | - $display = esc_attr( $instance['display'] ); |
|
187 | - $size = esc_attr( $instance['size'] ); |
|
188 | - $show_link = esc_attr( $instance['show_link'] ); |
|
189 | - $show_image = esc_attr( $instance['show_image'] ); |
|
190 | - $show_roles = esc_attr( $instance['show_roles'] ); |
|
191 | - $show_job_title = esc_attr( $instance['show_job_title'] ); |
|
192 | - $show_desc = esc_attr( $instance['show_desc'] ); |
|
193 | - $show_social = esc_attr( $instance['show_social'] ); |
|
194 | - $button_text = esc_attr( $instance['button_text'] ); |
|
195 | - $carousel = esc_attr( $instance['carousel'] ); |
|
196 | - $featured = esc_attr( $instance['featured'] ); |
|
177 | + $title = esc_attr($instance['title']); |
|
178 | + $title_link = esc_attr($instance['title_link']); |
|
179 | + $tagline = esc_attr($instance['tagline']); |
|
180 | + $columns = esc_attr($instance['columns']); |
|
181 | + $orderby = esc_attr($instance['orderby']); |
|
182 | + $order = esc_attr($instance['order']); |
|
183 | + $role = esc_attr($instance['role']); |
|
184 | + $limit = esc_attr($instance['limit']); |
|
185 | + $include = esc_attr($instance['include']); |
|
186 | + $display = esc_attr($instance['display']); |
|
187 | + $size = esc_attr($instance['size']); |
|
188 | + $show_link = esc_attr($instance['show_link']); |
|
189 | + $show_image = esc_attr($instance['show_image']); |
|
190 | + $show_roles = esc_attr($instance['show_roles']); |
|
191 | + $show_job_title = esc_attr($instance['show_job_title']); |
|
192 | + $show_desc = esc_attr($instance['show_desc']); |
|
193 | + $show_social = esc_attr($instance['show_social']); |
|
194 | + $button_text = esc_attr($instance['button_text']); |
|
195 | + $carousel = esc_attr($instance['carousel']); |
|
196 | + $featured = esc_attr($instance['featured']); |
|
197 | 197 | ?> |
198 | 198 | <p> |
199 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-team' ); ?></label> |
|
200 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> |
|
199 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'lsx-team'); ?></label> |
|
200 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" /> |
|
201 | 201 | </p> |
202 | 202 | <p> |
203 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>"><?php esc_html_e( 'Page Link:', 'lsx-team' ); ?></label> |
|
204 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title_link' ) ); ?>" type="text" value="<?php echo esc_attr( $title_link ); ?>" /> |
|
205 | - <small><?php esc_html_e( 'Link the widget to a page', 'lsx-team' ); ?></small> |
|
203 | + <label for="<?php echo esc_attr($this->get_field_id('title_link')); ?>"><?php esc_html_e('Page Link:', 'lsx-team'); ?></label> |
|
204 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title_link')); ?>" name="<?php echo esc_attr($this->get_field_name('title_link')); ?>" type="text" value="<?php echo esc_attr($title_link); ?>" /> |
|
205 | + <small><?php esc_html_e('Link the widget to a page', 'lsx-team'); ?></small> |
|
206 | 206 | </p> |
207 | 207 | <p> |
208 | - <label for="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>"><?php esc_html_e( 'Tagline:', 'lsx-team' ); ?></label> |
|
209 | - <textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tagline' ) ); ?>"><?php echo esc_html( $tagline ); ?></textarea> |
|
210 | - <small><?php esc_html_e( 'Tagline to display below the widget title', 'lsx-team' ); ?></small> |
|
208 | + <label for="<?php echo esc_attr($this->get_field_id('tagline')); ?>"><?php esc_html_e('Tagline:', 'lsx-team'); ?></label> |
|
209 | + <textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr($this->get_field_id('tagline')); ?>" name="<?php echo esc_attr($this->get_field_name('tagline')); ?>"><?php echo esc_html($tagline); ?></textarea> |
|
210 | + <small><?php esc_html_e('Tagline to display below the widget title', 'lsx-team'); ?></small> |
|
211 | 211 | </p> |
212 | 212 | <p> |
213 | - <label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-team' ); ?></label> |
|
214 | - <select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat layout"> |
|
213 | + <label for="<?php echo esc_attr($this->get_field_id('columns')); ?>"><?php esc_html_e('Columns:', 'lsx-team'); ?></label> |
|
214 | + <select name="<?php echo esc_attr($this->get_field_name('columns')); ?>" id="<?php echo esc_attr($this->get_field_id('columns')); ?>" class="widefat layout"> |
|
215 | 215 | <?php |
216 | - $options = array( '1', '2', '3', '4' ); |
|
216 | + $options = array('1', '2', '3', '4'); |
|
217 | 217 | |
218 | - foreach ( $options as $option ) { |
|
219 | - echo '<option value="' . lcfirst( esc_attr( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
|
218 | + foreach ($options as $option) { |
|
219 | + echo '<option value="'.lcfirst(esc_attr($option)).'" id="'.esc_attr($option).'"', lcfirst($option) == $columns ? ' selected="selected"' : '', '>', esc_html($option), '</option>'; |
|
220 | 220 | } |
221 | 221 | ?> |
222 | 222 | </select> |
223 | 223 | </p> |
224 | 224 | <p> |
225 | - <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-team' ); ?></label> |
|
226 | - <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat"> |
|
225 | + <label for="<?php echo esc_attr($this->get_field_id('orderby')); ?>"><?php esc_html_e('Order By:', 'lsx-team'); ?></label> |
|
226 | + <select name="<?php echo esc_attr($this->get_field_name('orderby')); ?>" id="<?php echo esc_attr($this->get_field_id('orderby')); ?>" class="widefat"> |
|
227 | 227 | <?php |
228 | 228 | $options = array( |
229 | - esc_html__( 'None', 'lsx-team' ) => 'none', |
|
230 | - esc_html__( 'ID', 'lsx-team' ) => 'ID', |
|
231 | - esc_html__( 'Name', 'lsx-team' ) => 'name', |
|
232 | - esc_html__( 'Date', 'lsx-team' ) => 'date', |
|
233 | - esc_html__( 'Modified Date', 'lsx-team' ) => 'modified', |
|
234 | - esc_html__( 'Random', 'lsx-team' ) => 'rand', |
|
235 | - esc_html__( 'Menu (WP dashboard order)', 'lsx-team' ) => 'menu_order', |
|
229 | + esc_html__('None', 'lsx-team') => 'none', |
|
230 | + esc_html__('ID', 'lsx-team') => 'ID', |
|
231 | + esc_html__('Name', 'lsx-team') => 'name', |
|
232 | + esc_html__('Date', 'lsx-team') => 'date', |
|
233 | + esc_html__('Modified Date', 'lsx-team') => 'modified', |
|
234 | + esc_html__('Random', 'lsx-team') => 'rand', |
|
235 | + esc_html__('Menu (WP dashboard order)', 'lsx-team') => 'menu_order', |
|
236 | 236 | ); |
237 | 237 | |
238 | - foreach ( $options as $name => $value ) { |
|
239 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
238 | + foreach ($options as $name => $value) { |
|
239 | + echo '<option value="'.esc_attr($value).'" id="'.esc_attr($value).'"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>'; |
|
240 | 240 | } |
241 | 241 | ?> |
242 | 242 | </select> |
243 | 243 | </p> |
244 | 244 | <p> |
245 | - <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-team' ); ?></label> |
|
246 | - <select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat"> |
|
245 | + <label for="<?php echo esc_attr($this->get_field_id('order')); ?>"><?php esc_html_e('Order:', 'lsx-team'); ?></label> |
|
246 | + <select name="<?php echo esc_attr($this->get_field_name('order')); ?>" id="<?php echo esc_attr($this->get_field_id('order')); ?>" class="widefat"> |
|
247 | 247 | <?php |
248 | 248 | $options = array( |
249 | - esc_html__( 'Ascending', 'lsx-team' ) => 'ASC', |
|
250 | - esc_html__( 'Descending', 'lsx-team' ) => 'DESC', |
|
249 | + esc_html__('Ascending', 'lsx-team') => 'ASC', |
|
250 | + esc_html__('Descending', 'lsx-team') => 'DESC', |
|
251 | 251 | ); |
252 | 252 | |
253 | - foreach ( $options as $name => $value ) { |
|
254 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
253 | + foreach ($options as $name => $value) { |
|
254 | + echo '<option value="'.esc_attr($value).'" id="'.esc_attr($value).'"', $order == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>'; |
|
255 | 255 | } |
256 | 256 | ?> |
257 | 257 | </select> |
258 | 258 | </p> |
259 | 259 | <p> |
260 | - <label for="<?php echo esc_attr( $this->get_field_id( 'role' ) ); ?>"><?php esc_html_e( 'Role:', 'lsx-team' ); ?></label> |
|
261 | - <select name="<?php echo esc_attr( $this->get_field_name( 'role' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'role' ) ); ?>" class="widefat"> |
|
260 | + <label for="<?php echo esc_attr($this->get_field_id('role')); ?>"><?php esc_html_e('Role:', 'lsx-team'); ?></label> |
|
261 | + <select name="<?php echo esc_attr($this->get_field_name('role')); ?>" id="<?php echo esc_attr($this->get_field_id('role')); ?>" class="widefat"> |
|
262 | 262 | <?php |
263 | - $options = get_terms( 'team_role' ); |
|
263 | + $options = get_terms('team_role'); |
|
264 | 264 | ?> |
265 | 265 | <option value="all" id="all"> |
266 | - <?php esc_html_e( 'All Roles', 'lsx-team' ); ?> |
|
266 | + <?php esc_html_e('All Roles', 'lsx-team'); ?> |
|
267 | 267 | </option> |
268 | 268 | <?php |
269 | - foreach ( $options as $option ) { |
|
270 | - echo '<option value="' . esc_attr( $option->slug ) . '" id="' . esc_attr( $option->slug ) . '"', $role == $option->slug ? ' selected="selected"' : '', '>', esc_html( $option->name ), '</option>'; |
|
269 | + foreach ($options as $option) { |
|
270 | + echo '<option value="'.esc_attr($option->slug).'" id="'.esc_attr($option->slug).'"', $role == $option->slug ? ' selected="selected"' : '', '>', esc_html($option->name), '</option>'; |
|
271 | 271 | } |
272 | 272 | ?> |
273 | 273 | </select> |
274 | - <small><?php esc_html_e( 'Display team members within a specific role', 'lsx-team' ); ?></small> |
|
274 | + <small><?php esc_html_e('Display team members within a specific role', 'lsx-team'); ?></small> |
|
275 | 275 | </p> |
276 | 276 | <p> |
277 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Maximum amount:', 'lsx-team' ); ?></label> |
|
278 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" /> |
|
279 | - <small><?php esc_html_e( 'Leave empty to display all', 'lsx-team' ); ?></small> |
|
277 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php esc_html_e('Maximum amount:', 'lsx-team'); ?></label> |
|
278 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" type="text" value="<?php echo esc_attr($limit); ?>" /> |
|
279 | + <small><?php esc_html_e('Leave empty to display all', 'lsx-team'); ?></small> |
|
280 | 280 | </p> |
281 | 281 | <p> |
282 | - <label for="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>"><?php esc_html_e( 'Specify Team Members by ID:', 'lsx-team' ); ?></label> |
|
283 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include' ) ); ?>" type="text" value="<?php echo esc_attr( $include ); ?>" /> |
|
284 | - <small><?php esc_html_e( 'Comma separated list, overrides limit setting', 'lsx-team' ); ?></small> |
|
282 | + <label for="<?php echo esc_attr($this->get_field_id('include')); ?>"><?php esc_html_e('Specify Team Members by ID:', 'lsx-team'); ?></label> |
|
283 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('include')); ?>" name="<?php echo esc_attr($this->get_field_name('include')); ?>" type="text" value="<?php echo esc_attr($include); ?>" /> |
|
284 | + <small><?php esc_html_e('Comma separated list, overrides limit setting', 'lsx-team'); ?></small> |
|
285 | 285 | </p> |
286 | 286 | <p> |
287 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-team' ); ?></label> |
|
288 | - <select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat"> |
|
287 | + <label for="<?php echo esc_attr($this->get_field_id('display')); ?>"><?php esc_html_e('Display:', 'lsx-team'); ?></label> |
|
288 | + <select name="<?php echo esc_attr($this->get_field_name('display')); ?>" id="<?php echo esc_attr($this->get_field_id('display')); ?>" class="widefat"> |
|
289 | 289 | <?php |
290 | 290 | $options = array( |
291 | - esc_html__( 'Excerpt', 'lsx-team' ) => 'excerpt', |
|
292 | - esc_html__( 'Full Content', 'lsx-team' ) => 'full', |
|
291 | + esc_html__('Excerpt', 'lsx-team') => 'excerpt', |
|
292 | + esc_html__('Full Content', 'lsx-team') => 'full', |
|
293 | 293 | ); |
294 | 294 | |
295 | - foreach ( $options as $name => $value ) { |
|
296 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
295 | + foreach ($options as $name => $value) { |
|
296 | + echo '<option value="'.esc_attr($value).'" id="'.esc_attr($value).'"', $display == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>'; |
|
297 | 297 | } |
298 | 298 | ?> |
299 | 299 | </select> |
300 | 300 | </p> |
301 | 301 | <p> |
302 | - <label for="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>"><?php esc_html_e( 'Image size:', 'lsx-team' ); ?></label> |
|
303 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'size' ) ); ?>" type="text" value="<?php echo esc_attr( $size ); ?>" /> |
|
302 | + <label for="<?php echo esc_attr($this->get_field_id('size')); ?>"><?php esc_html_e('Image size:', 'lsx-team'); ?></label> |
|
303 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('size')); ?>" name="<?php echo esc_attr($this->get_field_name('size')); ?>" type="text" value="<?php echo esc_attr($size); ?>" /> |
|
304 | 304 | </p> |
305 | 305 | <p> |
306 | - <label for="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>"><?php esc_html_e( 'Button "view all" text:', 'lsx-team' ); ?></label> |
|
307 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_text' ) ); ?>" type="text" value="<?php echo esc_attr( $button_text ); ?>" /> |
|
308 | - <small><?php esc_html_e( 'Leave empty to not display the button', 'lsx-team' ); ?></small> |
|
306 | + <label for="<?php echo esc_attr($this->get_field_id('button_text')); ?>"><?php esc_html_e('Button "view all" text:', 'lsx-team'); ?></label> |
|
307 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('button_text')); ?>" name="<?php echo esc_attr($this->get_field_name('button_text')); ?>" type="text" value="<?php echo esc_attr($button_text); ?>" /> |
|
308 | + <small><?php esc_html_e('Leave empty to not display the button', 'lsx-team'); ?></small> |
|
309 | 309 | </p> |
310 | 310 | <p> |
311 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_link' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_link ); ?> /> |
|
312 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_link' ) ); ?>"><?php esc_html_e( 'Link to Single', 'lsx-team' ); ?></label> |
|
311 | + <input id="<?php echo esc_attr($this->get_field_id('show_link')); ?>" name="<?php echo esc_attr($this->get_field_name('show_link')); ?>" type="checkbox" value="1" <?php checked('1', $show_link); ?> /> |
|
312 | + <label for="<?php echo esc_attr($this->get_field_id('show_link')); ?>"><?php esc_html_e('Link to Single', 'lsx-team'); ?></label> |
|
313 | 313 | </p> |
314 | 314 | <p> |
315 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_image' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_image ); ?> /> |
|
316 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>"><?php esc_html_e( 'Show Images', 'lsx-team' ); ?></label> |
|
315 | + <input id="<?php echo esc_attr($this->get_field_id('show_image')); ?>" name="<?php echo esc_attr($this->get_field_name('show_image')); ?>" type="checkbox" value="1" <?php checked('1', $show_image); ?> /> |
|
316 | + <label for="<?php echo esc_attr($this->get_field_id('show_image')); ?>"><?php esc_html_e('Show Images', 'lsx-team'); ?></label> |
|
317 | 317 | </p> |
318 | 318 | <p> |
319 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_roles' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_roles' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_roles ); ?> /> |
|
320 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_roles' ) ); ?>"><?php esc_html_e( 'Show Roles', 'lsx-team' ); ?></label> |
|
319 | + <input id="<?php echo esc_attr($this->get_field_id('show_roles')); ?>" name="<?php echo esc_attr($this->get_field_name('show_roles')); ?>" type="checkbox" value="1" <?php checked('1', $show_roles); ?> /> |
|
320 | + <label for="<?php echo esc_attr($this->get_field_id('show_roles')); ?>"><?php esc_html_e('Show Roles', 'lsx-team'); ?></label> |
|
321 | 321 | </p> |
322 | 322 | <p> |
323 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_job_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_job_title' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_job_title ); ?> /> |
|
324 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_job_title' ) ); ?>"><?php esc_html_e( 'Show Job Title', 'lsx-team' ); ?></label> |
|
323 | + <input id="<?php echo esc_attr($this->get_field_id('show_job_title')); ?>" name="<?php echo esc_attr($this->get_field_name('show_job_title')); ?>" type="checkbox" value="1" <?php checked('1', $show_job_title); ?> /> |
|
324 | + <label for="<?php echo esc_attr($this->get_field_id('show_job_title')); ?>"><?php esc_html_e('Show Job Title', 'lsx-team'); ?></label> |
|
325 | 325 | </p> |
326 | 326 | <p> |
327 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_desc' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_desc' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_desc ); ?> /> |
|
328 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_desc' ) ); ?>"><?php esc_html_e( 'Show Description', 'lsx-team' ); ?></label> |
|
327 | + <input id="<?php echo esc_attr($this->get_field_id('show_desc')); ?>" name="<?php echo esc_attr($this->get_field_name('show_desc')); ?>" type="checkbox" value="1" <?php checked('1', $show_desc); ?> /> |
|
328 | + <label for="<?php echo esc_attr($this->get_field_id('show_desc')); ?>"><?php esc_html_e('Show Description', 'lsx-team'); ?></label> |
|
329 | 329 | </p> |
330 | 330 | <p> |
331 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_social' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_social' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_social ); ?> /> |
|
332 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_social' ) ); ?>"><?php esc_html_e( 'Show Social Icons', 'lsx-team' ); ?></label> |
|
331 | + <input id="<?php echo esc_attr($this->get_field_id('show_social')); ?>" name="<?php echo esc_attr($this->get_field_name('show_social')); ?>" type="checkbox" value="1" <?php checked('1', $show_social); ?> /> |
|
332 | + <label for="<?php echo esc_attr($this->get_field_id('show_social')); ?>"><?php esc_html_e('Show Social Icons', 'lsx-team'); ?></label> |
|
333 | 333 | </p> |
334 | 334 | <p> |
335 | - <input id="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'carousel' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $carousel ); ?> /> |
|
336 | - <label for="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>"><?php esc_html_e( 'Carousel', 'lsx-team' ); ?></label> |
|
335 | + <input id="<?php echo esc_attr($this->get_field_id('carousel')); ?>" name="<?php echo esc_attr($this->get_field_name('carousel')); ?>" type="checkbox" value="1" <?php checked('1', $carousel); ?> /> |
|
336 | + <label for="<?php echo esc_attr($this->get_field_id('carousel')); ?>"><?php esc_html_e('Carousel', 'lsx-team'); ?></label> |
|
337 | 337 | </p> |
338 | 338 | <p> |
339 | - <input id="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'featured' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $featured ); ?> /> |
|
340 | - <label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-team' ); ?></label> |
|
339 | + <input id="<?php echo esc_attr($this->get_field_id('featured')); ?>" name="<?php echo esc_attr($this->get_field_name('featured')); ?>" type="checkbox" value="1" <?php checked('1', $featured); ?> /> |
|
340 | + <label for="<?php echo esc_attr($this->get_field_id('featured')); ?>"><?php esc_html_e('Featured posts', 'lsx-team'); ?></label> |
|
341 | 341 | </p> |
342 | 342 | <?php |
343 | 343 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * Registers the Widget |
349 | 349 | */ |
350 | 350 | function lsx_team_widget() { |
351 | - register_widget( 'LSX_Team_Widget' ); |
|
351 | + register_widget('LSX_Team_Widget'); |
|
352 | 352 | } |
353 | 353 | |
354 | -add_action( 'widgets_init', 'lsx_team_widget' ); |
|
354 | +add_action('widgets_init', 'lsx_team_widget'); |
@@ -7,86 +7,86 @@ |
||
7 | 7 | */ |
8 | 8 | class LSX_Team_Core { |
9 | 9 | |
10 | - /** |
|
11 | - * Holds class instance |
|
12 | - * |
|
13 | - * @since 1.0.0 |
|
14 | - * |
|
15 | - * @var object LSX_Team_Core() |
|
16 | - */ |
|
17 | - protected static $instance = null; |
|
10 | + /** |
|
11 | + * Holds class instance |
|
12 | + * |
|
13 | + * @since 1.0.0 |
|
14 | + * |
|
15 | + * @var object LSX_Team_Core() |
|
16 | + */ |
|
17 | + protected static $instance = null; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Holds class instance |
|
21 | - * |
|
22 | - * @since 1.0.0 |
|
23 | - * |
|
24 | - * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
25 | - */ |
|
26 | - public $cmb2_post_search_ajax = false; |
|
19 | + /** |
|
20 | + * Holds class instance |
|
21 | + * |
|
22 | + * @since 1.0.0 |
|
23 | + * |
|
24 | + * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
25 | + */ |
|
26 | + public $cmb2_post_search_ajax = false; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Contructor |
|
30 | - */ |
|
31 | - public function __construct() { |
|
32 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
33 | - $this->load_vendors(); |
|
34 | - } |
|
28 | + /** |
|
29 | + * Contructor |
|
30 | + */ |
|
31 | + public function __construct() { |
|
32 | + add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
33 | + $this->load_vendors(); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Return an instance of this class. |
|
38 | - * |
|
39 | - * @since 1.0.0 |
|
40 | - * |
|
41 | - * @return object \lsx_team\classes\Core() A single instance of this class. |
|
42 | - */ |
|
43 | - public static function get_instance() { |
|
36 | + /** |
|
37 | + * Return an instance of this class. |
|
38 | + * |
|
39 | + * @since 1.0.0 |
|
40 | + * |
|
41 | + * @return object \lsx_team\classes\Core() A single instance of this class. |
|
42 | + */ |
|
43 | + public static function get_instance() { |
|
44 | 44 | |
45 | - // If the single instance hasn't been set, set it now. |
|
46 | - if ( null === self::$instance ) { |
|
47 | - self::$instance = new self(); |
|
48 | - } |
|
45 | + // If the single instance hasn't been set, set it now. |
|
46 | + if ( null === self::$instance ) { |
|
47 | + self::$instance = new self(); |
|
48 | + } |
|
49 | 49 | |
50 | - return self::$instance; |
|
50 | + return self::$instance; |
|
51 | 51 | |
52 | - } |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Loads the plugin functions. |
|
56 | - */ |
|
57 | - private function load_vendors() { |
|
58 | - // Configure custom fields. |
|
59 | - if ( ! class_exists( 'CMB2' ) ) { |
|
60 | - require_once LSX_TEAM_PATH . 'vendor/CMB2/init.php'; |
|
61 | - } |
|
62 | - } |
|
54 | + /** |
|
55 | + * Loads the plugin functions. |
|
56 | + */ |
|
57 | + private function load_vendors() { |
|
58 | + // Configure custom fields. |
|
59 | + if ( ! class_exists( 'CMB2' ) ) { |
|
60 | + require_once LSX_TEAM_PATH . 'vendor/CMB2/init.php'; |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Returns the post types currently active |
|
66 | - * |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public function get_post_types() { |
|
70 | - $post_types = apply_filters( 'lsx_team_post_types', isset( $this->post_types ) ); |
|
71 | - foreach ( $post_types as $index => $post_type ) { |
|
72 | - $is_disabled = \cmb2_get_option( 'lsx_team_options', $post_type . '_disabled', false ); |
|
73 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
74 | - unset( $post_types[ $index ] ); |
|
75 | - } |
|
76 | - } |
|
77 | - return $post_types; |
|
78 | - } |
|
64 | + /** |
|
65 | + * Returns the post types currently active |
|
66 | + * |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public function get_post_types() { |
|
70 | + $post_types = apply_filters( 'lsx_team_post_types', isset( $this->post_types ) ); |
|
71 | + foreach ( $post_types as $index => $post_type ) { |
|
72 | + $is_disabled = \cmb2_get_option( 'lsx_team_options', $post_type . '_disabled', false ); |
|
73 | + if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
74 | + unset( $post_types[ $index ] ); |
|
75 | + } |
|
76 | + } |
|
77 | + return $post_types; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Includes the Post Search Ajax if it is there. |
|
82 | - * |
|
83 | - * @return void |
|
84 | - */ |
|
85 | - public function cmb2_post_search_ajax() { |
|
86 | - require_once LSX_TEAM_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
87 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
88 | - $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
89 | - } |
|
90 | - } |
|
80 | + /** |
|
81 | + * Includes the Post Search Ajax if it is there. |
|
82 | + * |
|
83 | + * @return void |
|
84 | + */ |
|
85 | + public function cmb2_post_search_ajax() { |
|
86 | + require_once LSX_TEAM_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
87 | + if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
88 | + $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | LSX_Team_Core::get_instance(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * Contructor |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
32 | + add_action('init', array($this, 'cmb2_post_search_ajax')); |
|
33 | 33 | $this->load_vendors(); |
34 | 34 | } |
35 | 35 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public static function get_instance() { |
44 | 44 | |
45 | 45 | // If the single instance hasn't been set, set it now. |
46 | - if ( null === self::$instance ) { |
|
46 | + if (null === self::$instance) { |
|
47 | 47 | self::$instance = new self(); |
48 | 48 | } |
49 | 49 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | private function load_vendors() { |
58 | 58 | // Configure custom fields. |
59 | - if ( ! class_exists( 'CMB2' ) ) { |
|
60 | - require_once LSX_TEAM_PATH . 'vendor/CMB2/init.php'; |
|
59 | + if (!class_exists('CMB2')) { |
|
60 | + require_once LSX_TEAM_PATH.'vendor/CMB2/init.php'; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public function get_post_types() { |
70 | - $post_types = apply_filters( 'lsx_team_post_types', isset( $this->post_types ) ); |
|
71 | - foreach ( $post_types as $index => $post_type ) { |
|
72 | - $is_disabled = \cmb2_get_option( 'lsx_team_options', $post_type . '_disabled', false ); |
|
73 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
74 | - unset( $post_types[ $index ] ); |
|
70 | + $post_types = apply_filters('lsx_team_post_types', isset($this->post_types)); |
|
71 | + foreach ($post_types as $index => $post_type) { |
|
72 | + $is_disabled = \cmb2_get_option('lsx_team_options', $post_type.'_disabled', false); |
|
73 | + if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) { |
|
74 | + unset($post_types[$index]); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | return $post_types; |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * @return void |
84 | 84 | */ |
85 | 85 | public function cmb2_post_search_ajax() { |
86 | - require_once LSX_TEAM_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
87 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
86 | + require_once LSX_TEAM_PATH.'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
87 | + if (method_exists('MAG_CMB2_Field_Post_Search_Ajax', 'get_instance')) { |
|
88 | 88 | $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
89 | 89 | } |
90 | 90 | } |
@@ -9,186 +9,186 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class Settings_Theme { |
11 | 11 | |
12 | - /** |
|
13 | - * Holds class instance |
|
14 | - * |
|
15 | - * @since 1.0.0 |
|
16 | - * |
|
17 | - * @var object \lsx_team\classes\admin\Settings_Theme() |
|
18 | - */ |
|
19 | - protected static $instance = null; |
|
12 | + /** |
|
13 | + * Holds class instance |
|
14 | + * |
|
15 | + * @since 1.0.0 |
|
16 | + * |
|
17 | + * @var object \lsx_team\classes\admin\Settings_Theme() |
|
18 | + */ |
|
19 | + protected static $instance = null; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Will return true if this is the LSX Search settings page. |
|
23 | - * |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - public $is_options_page = false; |
|
21 | + /** |
|
22 | + * Will return true if this is the LSX Search settings page. |
|
23 | + * |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + public $is_options_page = false; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Holds the id and labels for the navigation. |
|
30 | - * |
|
31 | - * @var array |
|
32 | - */ |
|
33 | - public $navigation = array(); |
|
28 | + /** |
|
29 | + * Holds the id and labels for the navigation. |
|
30 | + * |
|
31 | + * @var array |
|
32 | + */ |
|
33 | + public $navigation = array(); |
|
34 | 34 | |
35 | - /** |
|
36 | - * Contructor |
|
37 | - */ |
|
38 | - public function __construct() { |
|
39 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
40 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
41 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
42 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
43 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
44 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
45 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
46 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
47 | - } |
|
35 | + /** |
|
36 | + * Contructor |
|
37 | + */ |
|
38 | + public function __construct() { |
|
39 | + add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
40 | + add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
41 | + add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
42 | + add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
43 | + add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
44 | + add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
45 | + add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
46 | + add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Return an instance of this class. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * |
|
54 | - * @return object \lsx_team\classes\admin\Settings_Theme() A single instance of this class. |
|
55 | - */ |
|
56 | - public static function get_instance() { |
|
57 | - // If the single instance hasn't been set, set it now. |
|
58 | - if ( null == self::$instance ) { |
|
59 | - self::$instance = new self(); |
|
60 | - } |
|
61 | - return self::$instance; |
|
62 | - } |
|
49 | + /** |
|
50 | + * Return an instance of this class. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * |
|
54 | + * @return object \lsx_team\classes\admin\Settings_Theme() A single instance of this class. |
|
55 | + */ |
|
56 | + public static function get_instance() { |
|
57 | + // If the single instance hasn't been set, set it now. |
|
58 | + if ( null == self::$instance ) { |
|
59 | + self::$instance = new self(); |
|
60 | + } |
|
61 | + return self::$instance; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Disable CMB2 styles on front end forms. |
|
66 | - * |
|
67 | - * @return bool $enabled Whether to enable (enqueue) styles. |
|
68 | - */ |
|
69 | - public function disable_cmb2_styles( $enabled ) { |
|
70 | - if ( is_admin() ) { |
|
71 | - $current_screen = get_current_screen(); |
|
72 | - if ( is_object( $current_screen ) && 'team_page_lsx_team_options' === $current_screen->id ) { |
|
73 | - $enabled = false; |
|
74 | - } |
|
75 | - } |
|
76 | - return $enabled; |
|
77 | - } |
|
64 | + /** |
|
65 | + * Disable CMB2 styles on front end forms. |
|
66 | + * |
|
67 | + * @return bool $enabled Whether to enable (enqueue) styles. |
|
68 | + */ |
|
69 | + public function disable_cmb2_styles( $enabled ) { |
|
70 | + if ( is_admin() ) { |
|
71 | + $current_screen = get_current_screen(); |
|
72 | + if ( is_object( $current_screen ) && 'team_page_lsx_team_options' === $current_screen->id ) { |
|
73 | + $enabled = false; |
|
74 | + } |
|
75 | + } |
|
76 | + return $enabled; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Generates the tabbed navigation for the settings page. |
|
81 | - * |
|
82 | - * @param string $cmb_id |
|
83 | - * @param string $object_id |
|
84 | - * @param string $object_type |
|
85 | - * @param object $cmb2_obj |
|
86 | - * @return void |
|
87 | - */ |
|
88 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
89 | - if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) { |
|
90 | - $this->navigation = array(); |
|
91 | - $this->is_options_page = true; |
|
92 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
93 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
94 | - if ( 'title' === $field['type'] ) { |
|
95 | - $this->navigation[ $field_index ] = $field['name']; |
|
96 | - } |
|
97 | - } |
|
98 | - } |
|
99 | - $this->output_navigation(); |
|
100 | - } |
|
101 | - } |
|
79 | + /** |
|
80 | + * Generates the tabbed navigation for the settings page. |
|
81 | + * |
|
82 | + * @param string $cmb_id |
|
83 | + * @param string $object_id |
|
84 | + * @param string $object_type |
|
85 | + * @param object $cmb2_obj |
|
86 | + * @return void |
|
87 | + */ |
|
88 | + public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
89 | + if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) { |
|
90 | + $this->navigation = array(); |
|
91 | + $this->is_options_page = true; |
|
92 | + if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
93 | + foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
94 | + if ( 'title' === $field['type'] ) { |
|
95 | + $this->navigation[ $field_index ] = $field['name']; |
|
96 | + } |
|
97 | + } |
|
98 | + } |
|
99 | + $this->output_navigation(); |
|
100 | + } |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Outputs the WP style navigation for the Settings page. |
|
105 | - * |
|
106 | - * @return void |
|
107 | - */ |
|
108 | - public function output_navigation() { |
|
109 | - if ( ! empty( $this->navigation ) ) { |
|
110 | - ?> |
|
103 | + /** |
|
104 | + * Outputs the WP style navigation for the Settings page. |
|
105 | + * |
|
106 | + * @return void |
|
107 | + */ |
|
108 | + public function output_navigation() { |
|
109 | + if ( ! empty( $this->navigation ) ) { |
|
110 | + ?> |
|
111 | 111 | <div class="wp-filter hide-if-no-js"> |
112 | 112 | <ul class="filter-links"> |
113 | 113 | <?php |
114 | - $first_tab = true; |
|
115 | - $total = count( $this->navigation ); |
|
116 | - $count = 0; |
|
117 | - $separator = ' |'; |
|
118 | - $selected_tab = ''; |
|
119 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
120 | - $selected_tab = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) ); |
|
121 | - $selected_tab = 'settings_' . $selected_tab; |
|
122 | - } |
|
123 | - foreach ( $this->navigation as $key => $label ) { |
|
124 | - $count++; |
|
125 | - $current_css = ''; |
|
126 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
127 | - $first_tab = false; |
|
128 | - $current_css = 'current'; |
|
129 | - } |
|
130 | - if ( $count === $total ) { |
|
131 | - $separator = ''; |
|
132 | - } |
|
133 | - ?> |
|
114 | + $first_tab = true; |
|
115 | + $total = count( $this->navigation ); |
|
116 | + $count = 0; |
|
117 | + $separator = ' |'; |
|
118 | + $selected_tab = ''; |
|
119 | + if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
120 | + $selected_tab = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) ); |
|
121 | + $selected_tab = 'settings_' . $selected_tab; |
|
122 | + } |
|
123 | + foreach ( $this->navigation as $key => $label ) { |
|
124 | + $count++; |
|
125 | + $current_css = ''; |
|
126 | + if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
127 | + $first_tab = false; |
|
128 | + $current_css = 'current'; |
|
129 | + } |
|
130 | + if ( $count === $total ) { |
|
131 | + $separator = ''; |
|
132 | + } |
|
133 | + ?> |
|
134 | 134 | <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
135 | 135 | <?php |
136 | - } |
|
137 | - ?> |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </ul> |
139 | 139 | </div> |
140 | 140 | <?php |
141 | - } |
|
142 | - } |
|
141 | + } |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * Outputs the opening tab div. |
|
146 | - * |
|
147 | - * @param object $field CMB2_Field(); |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - public function output_tab_open_div( $field ) { |
|
151 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
152 | - ?> |
|
144 | + /** |
|
145 | + * Outputs the opening tab div. |
|
146 | + * |
|
147 | + * @param object $field CMB2_Field(); |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + public function output_tab_open_div( $field ) { |
|
151 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
152 | + ?> |
|
153 | 153 | <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
154 | 154 | <?php |
155 | - } |
|
156 | - } |
|
155 | + } |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Outputs the opening closing div. |
|
160 | - * |
|
161 | - * @param object $field CMB2_Field(); |
|
162 | - * @return void |
|
163 | - */ |
|
164 | - public function output_tab_closing_div( $field ) { |
|
165 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
166 | - ?> |
|
158 | + /** |
|
159 | + * Outputs the opening closing div. |
|
160 | + * |
|
161 | + * @param object $field CMB2_Field(); |
|
162 | + * @return void |
|
163 | + */ |
|
164 | + public function output_tab_closing_div( $field ) { |
|
165 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
166 | + ?> |
|
167 | 167 | </div> |
168 | 168 | <?php |
169 | - } |
|
170 | - } |
|
169 | + } |
|
170 | + } |
|
171 | 171 | |
172 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
173 | - return; |
|
174 | - } |
|
172 | + public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
173 | + return; |
|
174 | + } |
|
175 | 175 | |
176 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
177 | - return ''; |
|
178 | - } |
|
176 | + public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
177 | + return ''; |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Outputs the Script for the tabbed navigation. |
|
182 | - * |
|
183 | - * @param string $cmb_id |
|
184 | - * @param string $object_id |
|
185 | - * @param string $object_type |
|
186 | - * @param object $cmb2_obj |
|
187 | - * @return void |
|
188 | - */ |
|
189 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
190 | - if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) { |
|
191 | - ?> |
|
180 | + /** |
|
181 | + * Outputs the Script for the tabbed navigation. |
|
182 | + * |
|
183 | + * @param string $cmb_id |
|
184 | + * @param string $object_id |
|
185 | + * @param string $object_type |
|
186 | + * @param object $cmb2_obj |
|
187 | + * @return void |
|
188 | + */ |
|
189 | + public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
190 | + if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) { |
|
191 | + ?> |
|
192 | 192 | <script> |
193 | 193 | var LSX_TEAM_CMB2 = Object.create( null ); |
194 | 194 | |
@@ -261,25 +261,25 @@ discard block |
||
261 | 261 | } )( jQuery, window, document ); |
262 | 262 | </script> |
263 | 263 | <?php |
264 | - } |
|
265 | - } |
|
264 | + } |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * This will add the tab selection to the url. |
|
269 | - * |
|
270 | - * @param string $url |
|
271 | - * @return void |
|
272 | - */ |
|
273 | - public function add_tab_argument( $url ) { |
|
274 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
275 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
276 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
277 | - if ( 'single' !== $tab_selection ) { |
|
278 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
279 | - } else { |
|
280 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
281 | - } |
|
282 | - } |
|
283 | - return $url; |
|
284 | - } |
|
267 | + /** |
|
268 | + * This will add the tab selection to the url. |
|
269 | + * |
|
270 | + * @param string $url |
|
271 | + * @return void |
|
272 | + */ |
|
273 | + public function add_tab_argument( $url ) { |
|
274 | + if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
275 | + $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
276 | + $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
277 | + if ( 'single' !== $tab_selection ) { |
|
278 | + $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
279 | + } else { |
|
280 | + $url = remove_query_arg( 'cmb_tab', $url ); |
|
281 | + } |
|
282 | + } |
|
283 | + return $url; |
|
284 | + } |
|
285 | 285 | } |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | * Contructor |
37 | 37 | */ |
38 | 38 | public function __construct() { |
39 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
40 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
41 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
42 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
43 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
44 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
45 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
46 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
39 | + add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1); |
|
40 | + add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4); |
|
41 | + add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1); |
|
42 | + add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1); |
|
43 | + add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5); |
|
44 | + add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2); |
|
45 | + add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4); |
|
46 | + add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function get_instance() { |
57 | 57 | // If the single instance hasn't been set, set it now. |
58 | - if ( null == self::$instance ) { |
|
58 | + if (null == self::$instance) { |
|
59 | 59 | self::$instance = new self(); |
60 | 60 | } |
61 | 61 | return self::$instance; |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return bool $enabled Whether to enable (enqueue) styles. |
68 | 68 | */ |
69 | - public function disable_cmb2_styles( $enabled ) { |
|
70 | - if ( is_admin() ) { |
|
69 | + public function disable_cmb2_styles($enabled) { |
|
70 | + if (is_admin()) { |
|
71 | 71 | $current_screen = get_current_screen(); |
72 | - if ( is_object( $current_screen ) && 'team_page_lsx_team_options' === $current_screen->id ) { |
|
72 | + if (is_object($current_screen) && 'team_page_lsx_team_options' === $current_screen->id) { |
|
73 | 73 | $enabled = false; |
74 | 74 | } |
75 | 75 | } |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | * @param object $cmb2_obj |
86 | 86 | * @return void |
87 | 87 | */ |
88 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
89 | - if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) { |
|
88 | + public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
89 | + if ('lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type) { |
|
90 | 90 | $this->navigation = array(); |
91 | 91 | $this->is_options_page = true; |
92 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
93 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
94 | - if ( 'title' === $field['type'] ) { |
|
95 | - $this->navigation[ $field_index ] = $field['name']; |
|
92 | + if (isset($cmb2_obj->meta_box['fields']) && !empty($cmb2_obj->meta_box['fields'])) { |
|
93 | + foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) { |
|
94 | + if ('title' === $field['type']) { |
|
95 | + $this->navigation[$field_index] = $field['name']; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -106,32 +106,32 @@ discard block |
||
106 | 106 | * @return void |
107 | 107 | */ |
108 | 108 | public function output_navigation() { |
109 | - if ( ! empty( $this->navigation ) ) { |
|
109 | + if (!empty($this->navigation)) { |
|
110 | 110 | ?> |
111 | 111 | <div class="wp-filter hide-if-no-js"> |
112 | 112 | <ul class="filter-links"> |
113 | 113 | <?php |
114 | 114 | $first_tab = true; |
115 | - $total = count( $this->navigation ); |
|
115 | + $total = count($this->navigation); |
|
116 | 116 | $count = 0; |
117 | 117 | $separator = ' |'; |
118 | 118 | $selected_tab = ''; |
119 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
120 | - $selected_tab = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) ); |
|
121 | - $selected_tab = 'settings_' . $selected_tab; |
|
119 | + if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) { |
|
120 | + $selected_tab = sanitize_text_field(wp_unslash($_GET['cmb_tab'])); |
|
121 | + $selected_tab = 'settings_'.$selected_tab; |
|
122 | 122 | } |
123 | - foreach ( $this->navigation as $key => $label ) { |
|
123 | + foreach ($this->navigation as $key => $label) { |
|
124 | 124 | $count++; |
125 | 125 | $current_css = ''; |
126 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
126 | + if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) { |
|
127 | 127 | $first_tab = false; |
128 | 128 | $current_css = 'current'; |
129 | 129 | } |
130 | - if ( $count === $total ) { |
|
130 | + if ($count === $total) { |
|
131 | 131 | $separator = ''; |
132 | 132 | } |
133 | 133 | ?> |
134 | - <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
|
134 | + <li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li> |
|
135 | 135 | <?php |
136 | 136 | } |
137 | 137 | ?> |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param object $field CMB2_Field(); |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function output_tab_open_div( $field ) { |
|
151 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
150 | + public function output_tab_open_div($field) { |
|
151 | + if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) { |
|
152 | 152 | ?> |
153 | - <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
|
153 | + <div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden"> |
|
154 | 154 | <?php |
155 | 155 | } |
156 | 156 | } |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | * @param object $field CMB2_Field(); |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - public function output_tab_closing_div( $field ) { |
|
165 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
164 | + public function output_tab_closing_div($field) { |
|
165 | + if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) { |
|
166 | 166 | ?> |
167 | 167 | </div> |
168 | 168 | <?php |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
172 | + public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
176 | + public function cmb2_sanitize_tab_closing_callback($override_value, $value) { |
|
177 | 177 | return ''; |
178 | 178 | } |
179 | 179 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param object $cmb2_obj |
187 | 187 | * @return void |
188 | 188 | */ |
189 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
190 | - if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) { |
|
189 | + public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
190 | + if ('lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type) { |
|
191 | 191 | ?> |
192 | 192 | <script> |
193 | 193 | var LSX_TEAM_CMB2 = Object.create( null ); |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | * @param string $url |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_tab_argument( $url ) { |
|
274 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
275 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
276 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
277 | - if ( 'single' !== $tab_selection ) { |
|
278 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
273 | + public function add_tab_argument($url) { |
|
274 | + if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine |
|
275 | + $tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine |
|
276 | + $tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine |
|
277 | + if ('single' !== $tab_selection) { |
|
278 | + $url = add_query_arg('cmb_tab', $tab_selection, $url); |
|
279 | 279 | } else { |
280 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
280 | + $url = remove_query_arg('cmb_tab', $url); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | return $url; |
@@ -9,184 +9,184 @@ |
||
9 | 9 | |
10 | 10 | class Settings { |
11 | 11 | |
12 | - /** |
|
13 | - * Holds class instance |
|
14 | - * |
|
15 | - * @since 1.0.0 |
|
16 | - * |
|
17 | - * @var object \lsx_team\classes\admin\Settings() |
|
18 | - */ |
|
19 | - protected static $instance = null; |
|
20 | - |
|
21 | - /** |
|
22 | - * Option key, and option page slug |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $screen_id = 'lsx_team_settings'; |
|
27 | - |
|
28 | - /** |
|
29 | - * Contructor |
|
30 | - */ |
|
31 | - public function __construct() { |
|
32 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
33 | - add_action( 'lsx_team_settings_page', array( $this, 'general_settings' ), 1, 1 ); |
|
34 | - add_action( 'lsx_team_settings_page', array( $this, 'global_defaults' ), 3, 1 ); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Return an instance of this class. |
|
39 | - * |
|
40 | - * @since 1.0.0 |
|
41 | - * |
|
42 | - * @return object Settings() A single instance of this class. |
|
43 | - */ |
|
44 | - public static function get_instance() { |
|
45 | - // If the single instance hasn't been set, set it now. |
|
46 | - if ( null === self::$instance ) { |
|
47 | - self::$instance = new self(); |
|
48 | - } |
|
49 | - return self::$instance; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Hook in and register a submenu options page for the Page post-type menu. |
|
54 | - */ |
|
55 | - public function register_settings_page() { |
|
56 | - $cmb = new_cmb2_box( |
|
57 | - array( |
|
58 | - 'id' => $this->screen_id, |
|
59 | - 'title' => esc_html__( 'Settings', 'lsx-team' ), |
|
60 | - 'object_types' => array( 'options-page' ), |
|
61 | - 'option_key' => 'lsx_team_options', // The option key and admin menu page slug. |
|
62 | - 'parent_slug' => 'edit.php?post_type=team', // Make options page a submenu item of the themes menu. |
|
63 | - 'capability' => 'manage_options', // Cap required to view options-page. |
|
64 | - ) |
|
65 | - ); |
|
66 | - do_action( 'lsx_team_settings_page', $cmb ); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Registers the general settings. |
|
71 | - * |
|
72 | - * @param object $cmb new_cmb2_box(). |
|
73 | - * @return void |
|
74 | - */ |
|
75 | - public function general_settings( $cmb ) { |
|
76 | - $cmb->add_field( |
|
77 | - array( |
|
78 | - 'id' => 'settings_general_title', |
|
79 | - 'type' => 'title', |
|
80 | - 'name' => __( 'General', 'lsx-team' ), |
|
81 | - 'default' => __( 'General', 'lsx-team' ), |
|
82 | - ) |
|
83 | - ); |
|
84 | - $cmb->add_field( |
|
85 | - array( |
|
86 | - 'name' => __( 'Disable Single Posts', 'lsx-team' ), |
|
87 | - 'id' => 'team_disable_single', |
|
88 | - 'type' => 'checkbox', |
|
89 | - 'value' => 1, |
|
90 | - 'default' => 0, |
|
91 | - 'description' => __( 'Disable Single Posts.', 'lsx-health-plan' ), |
|
92 | - ) |
|
93 | - ); |
|
94 | - |
|
95 | - $cmb->add_field( |
|
96 | - array( |
|
97 | - 'name' => __( 'Group By Role', 'lsx-team' ), |
|
98 | - 'id' => 'group_by_role', |
|
99 | - 'type' => 'checkbox', |
|
100 | - 'value' => 1, |
|
101 | - 'default' => 0, |
|
102 | - 'description' => __( 'This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan' ), |
|
103 | - ) |
|
104 | - ); |
|
105 | - $cmb->add_field( array( |
|
106 | - 'name' => 'Placeholder', |
|
107 | - 'desc' => __( 'This image displays on the archive, search results and team members single if no featured image is set.', 'lsx-health-plan' ), |
|
108 | - 'id' => 'team_placeholder', |
|
109 | - 'type' => 'file', |
|
110 | - 'options' => array( |
|
111 | - 'url' => false, // Hide the text input for the url. |
|
112 | - ), |
|
113 | - 'text' => array( |
|
114 | - 'add_upload_file_text' => 'Choose Image', |
|
115 | - ), |
|
116 | - ) ); |
|
117 | - $cmb->add_field( |
|
118 | - array( |
|
119 | - 'id' => 'settings_general_closing', |
|
120 | - 'type' => 'tab_closing', |
|
121 | - ) |
|
122 | - ); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Registers the global default settings. |
|
127 | - * |
|
128 | - * @param object $cmb new_cmb2_box(). |
|
129 | - * @return void |
|
130 | - */ |
|
131 | - public function global_defaults( $cmb ) { |
|
132 | - $cmb->add_field( |
|
133 | - array( |
|
134 | - 'id' => 'global_defaults_title', |
|
135 | - 'type' => 'title', |
|
136 | - 'name' => __( 'Careers CTA', 'lsx-team' ), |
|
137 | - 'default' => __( 'Careers CTA', 'lsx-team' ), |
|
138 | - ) |
|
139 | - ); |
|
140 | - |
|
141 | - $cmb->add_field( |
|
142 | - array( |
|
143 | - 'name' => __( 'Enable careers CTA', 'lsx-team' ), |
|
144 | - 'id' => 'team_careers_cta_enable', |
|
145 | - 'type' => 'checkbox', |
|
146 | - 'value' => 1, |
|
147 | - 'default' => 0, |
|
148 | - 'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ), |
|
149 | - ) |
|
150 | - ); |
|
151 | - |
|
152 | - $cmb->add_field( |
|
153 | - array( |
|
154 | - 'name' => __( 'Title', 'lsx-team' ), |
|
155 | - 'id' => 'team_careers_cta_title', |
|
156 | - 'type' => 'text', |
|
157 | - ) |
|
158 | - ); |
|
159 | - |
|
160 | - $cmb->add_field( |
|
161 | - array( |
|
162 | - 'name' => __( 'Tagline', 'lsx-team' ), |
|
163 | - 'id' => 'team_careers_cta_tagline', |
|
164 | - 'type' => 'text', |
|
165 | - ) |
|
166 | - ); |
|
167 | - |
|
168 | - $cmb->add_field( |
|
169 | - array( |
|
170 | - 'name' => __( 'Link Text', 'lsx-team' ), |
|
171 | - 'id' => 'team_careers_cta_link_text', |
|
172 | - 'type' => 'text', |
|
173 | - ) |
|
174 | - ); |
|
175 | - |
|
176 | - $cmb->add_field( |
|
177 | - array( |
|
178 | - 'name' => __( 'Careers page link', 'lsx-team' ), |
|
179 | - 'id' => 'team_careers_cta_link', |
|
180 | - 'type' => 'text', |
|
181 | - ) |
|
182 | - ); |
|
183 | - |
|
184 | - $cmb->add_field( |
|
185 | - array( |
|
186 | - 'id' => 'settings_global_defaults_closing', |
|
187 | - 'type' => 'tab_closing', |
|
188 | - ) |
|
189 | - ); |
|
190 | - } |
|
12 | + /** |
|
13 | + * Holds class instance |
|
14 | + * |
|
15 | + * @since 1.0.0 |
|
16 | + * |
|
17 | + * @var object \lsx_team\classes\admin\Settings() |
|
18 | + */ |
|
19 | + protected static $instance = null; |
|
20 | + |
|
21 | + /** |
|
22 | + * Option key, and option page slug |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $screen_id = 'lsx_team_settings'; |
|
27 | + |
|
28 | + /** |
|
29 | + * Contructor |
|
30 | + */ |
|
31 | + public function __construct() { |
|
32 | + add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
33 | + add_action( 'lsx_team_settings_page', array( $this, 'general_settings' ), 1, 1 ); |
|
34 | + add_action( 'lsx_team_settings_page', array( $this, 'global_defaults' ), 3, 1 ); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Return an instance of this class. |
|
39 | + * |
|
40 | + * @since 1.0.0 |
|
41 | + * |
|
42 | + * @return object Settings() A single instance of this class. |
|
43 | + */ |
|
44 | + public static function get_instance() { |
|
45 | + // If the single instance hasn't been set, set it now. |
|
46 | + if ( null === self::$instance ) { |
|
47 | + self::$instance = new self(); |
|
48 | + } |
|
49 | + return self::$instance; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Hook in and register a submenu options page for the Page post-type menu. |
|
54 | + */ |
|
55 | + public function register_settings_page() { |
|
56 | + $cmb = new_cmb2_box( |
|
57 | + array( |
|
58 | + 'id' => $this->screen_id, |
|
59 | + 'title' => esc_html__( 'Settings', 'lsx-team' ), |
|
60 | + 'object_types' => array( 'options-page' ), |
|
61 | + 'option_key' => 'lsx_team_options', // The option key and admin menu page slug. |
|
62 | + 'parent_slug' => 'edit.php?post_type=team', // Make options page a submenu item of the themes menu. |
|
63 | + 'capability' => 'manage_options', // Cap required to view options-page. |
|
64 | + ) |
|
65 | + ); |
|
66 | + do_action( 'lsx_team_settings_page', $cmb ); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Registers the general settings. |
|
71 | + * |
|
72 | + * @param object $cmb new_cmb2_box(). |
|
73 | + * @return void |
|
74 | + */ |
|
75 | + public function general_settings( $cmb ) { |
|
76 | + $cmb->add_field( |
|
77 | + array( |
|
78 | + 'id' => 'settings_general_title', |
|
79 | + 'type' => 'title', |
|
80 | + 'name' => __( 'General', 'lsx-team' ), |
|
81 | + 'default' => __( 'General', 'lsx-team' ), |
|
82 | + ) |
|
83 | + ); |
|
84 | + $cmb->add_field( |
|
85 | + array( |
|
86 | + 'name' => __( 'Disable Single Posts', 'lsx-team' ), |
|
87 | + 'id' => 'team_disable_single', |
|
88 | + 'type' => 'checkbox', |
|
89 | + 'value' => 1, |
|
90 | + 'default' => 0, |
|
91 | + 'description' => __( 'Disable Single Posts.', 'lsx-health-plan' ), |
|
92 | + ) |
|
93 | + ); |
|
94 | + |
|
95 | + $cmb->add_field( |
|
96 | + array( |
|
97 | + 'name' => __( 'Group By Role', 'lsx-team' ), |
|
98 | + 'id' => 'group_by_role', |
|
99 | + 'type' => 'checkbox', |
|
100 | + 'value' => 1, |
|
101 | + 'default' => 0, |
|
102 | + 'description' => __( 'This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan' ), |
|
103 | + ) |
|
104 | + ); |
|
105 | + $cmb->add_field( array( |
|
106 | + 'name' => 'Placeholder', |
|
107 | + 'desc' => __( 'This image displays on the archive, search results and team members single if no featured image is set.', 'lsx-health-plan' ), |
|
108 | + 'id' => 'team_placeholder', |
|
109 | + 'type' => 'file', |
|
110 | + 'options' => array( |
|
111 | + 'url' => false, // Hide the text input for the url. |
|
112 | + ), |
|
113 | + 'text' => array( |
|
114 | + 'add_upload_file_text' => 'Choose Image', |
|
115 | + ), |
|
116 | + ) ); |
|
117 | + $cmb->add_field( |
|
118 | + array( |
|
119 | + 'id' => 'settings_general_closing', |
|
120 | + 'type' => 'tab_closing', |
|
121 | + ) |
|
122 | + ); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Registers the global default settings. |
|
127 | + * |
|
128 | + * @param object $cmb new_cmb2_box(). |
|
129 | + * @return void |
|
130 | + */ |
|
131 | + public function global_defaults( $cmb ) { |
|
132 | + $cmb->add_field( |
|
133 | + array( |
|
134 | + 'id' => 'global_defaults_title', |
|
135 | + 'type' => 'title', |
|
136 | + 'name' => __( 'Careers CTA', 'lsx-team' ), |
|
137 | + 'default' => __( 'Careers CTA', 'lsx-team' ), |
|
138 | + ) |
|
139 | + ); |
|
140 | + |
|
141 | + $cmb->add_field( |
|
142 | + array( |
|
143 | + 'name' => __( 'Enable careers CTA', 'lsx-team' ), |
|
144 | + 'id' => 'team_careers_cta_enable', |
|
145 | + 'type' => 'checkbox', |
|
146 | + 'value' => 1, |
|
147 | + 'default' => 0, |
|
148 | + 'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ), |
|
149 | + ) |
|
150 | + ); |
|
151 | + |
|
152 | + $cmb->add_field( |
|
153 | + array( |
|
154 | + 'name' => __( 'Title', 'lsx-team' ), |
|
155 | + 'id' => 'team_careers_cta_title', |
|
156 | + 'type' => 'text', |
|
157 | + ) |
|
158 | + ); |
|
159 | + |
|
160 | + $cmb->add_field( |
|
161 | + array( |
|
162 | + 'name' => __( 'Tagline', 'lsx-team' ), |
|
163 | + 'id' => 'team_careers_cta_tagline', |
|
164 | + 'type' => 'text', |
|
165 | + ) |
|
166 | + ); |
|
167 | + |
|
168 | + $cmb->add_field( |
|
169 | + array( |
|
170 | + 'name' => __( 'Link Text', 'lsx-team' ), |
|
171 | + 'id' => 'team_careers_cta_link_text', |
|
172 | + 'type' => 'text', |
|
173 | + ) |
|
174 | + ); |
|
175 | + |
|
176 | + $cmb->add_field( |
|
177 | + array( |
|
178 | + 'name' => __( 'Careers page link', 'lsx-team' ), |
|
179 | + 'id' => 'team_careers_cta_link', |
|
180 | + 'type' => 'text', |
|
181 | + ) |
|
182 | + ); |
|
183 | + |
|
184 | + $cmb->add_field( |
|
185 | + array( |
|
186 | + 'id' => 'settings_global_defaults_closing', |
|
187 | + 'type' => 'tab_closing', |
|
188 | + ) |
|
189 | + ); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * Contructor |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
33 | - add_action( 'lsx_team_settings_page', array( $this, 'general_settings' ), 1, 1 ); |
|
34 | - add_action( 'lsx_team_settings_page', array( $this, 'global_defaults' ), 3, 1 ); |
|
32 | + add_action('cmb2_admin_init', array($this, 'register_settings_page')); |
|
33 | + add_action('lsx_team_settings_page', array($this, 'general_settings'), 1, 1); |
|
34 | + add_action('lsx_team_settings_page', array($this, 'global_defaults'), 3, 1); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function get_instance() { |
45 | 45 | // If the single instance hasn't been set, set it now. |
46 | - if ( null === self::$instance ) { |
|
46 | + if (null === self::$instance) { |
|
47 | 47 | self::$instance = new self(); |
48 | 48 | } |
49 | 49 | return self::$instance; |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | $cmb = new_cmb2_box( |
57 | 57 | array( |
58 | 58 | 'id' => $this->screen_id, |
59 | - 'title' => esc_html__( 'Settings', 'lsx-team' ), |
|
60 | - 'object_types' => array( 'options-page' ), |
|
59 | + 'title' => esc_html__('Settings', 'lsx-team'), |
|
60 | + 'object_types' => array('options-page'), |
|
61 | 61 | 'option_key' => 'lsx_team_options', // The option key and admin menu page slug. |
62 | 62 | 'parent_slug' => 'edit.php?post_type=team', // Make options page a submenu item of the themes menu. |
63 | 63 | 'capability' => 'manage_options', // Cap required to view options-page. |
64 | 64 | ) |
65 | 65 | ); |
66 | - do_action( 'lsx_team_settings_page', $cmb ); |
|
66 | + do_action('lsx_team_settings_page', $cmb); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -72,39 +72,39 @@ discard block |
||
72 | 72 | * @param object $cmb new_cmb2_box(). |
73 | 73 | * @return void |
74 | 74 | */ |
75 | - public function general_settings( $cmb ) { |
|
75 | + public function general_settings($cmb) { |
|
76 | 76 | $cmb->add_field( |
77 | 77 | array( |
78 | 78 | 'id' => 'settings_general_title', |
79 | 79 | 'type' => 'title', |
80 | - 'name' => __( 'General', 'lsx-team' ), |
|
81 | - 'default' => __( 'General', 'lsx-team' ), |
|
80 | + 'name' => __('General', 'lsx-team'), |
|
81 | + 'default' => __('General', 'lsx-team'), |
|
82 | 82 | ) |
83 | 83 | ); |
84 | 84 | $cmb->add_field( |
85 | 85 | array( |
86 | - 'name' => __( 'Disable Single Posts', 'lsx-team' ), |
|
86 | + 'name' => __('Disable Single Posts', 'lsx-team'), |
|
87 | 87 | 'id' => 'team_disable_single', |
88 | 88 | 'type' => 'checkbox', |
89 | 89 | 'value' => 1, |
90 | 90 | 'default' => 0, |
91 | - 'description' => __( 'Disable Single Posts.', 'lsx-health-plan' ), |
|
91 | + 'description' => __('Disable Single Posts.', 'lsx-health-plan'), |
|
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | |
95 | 95 | $cmb->add_field( |
96 | 96 | array( |
97 | - 'name' => __( 'Group By Role', 'lsx-team' ), |
|
97 | + 'name' => __('Group By Role', 'lsx-team'), |
|
98 | 98 | 'id' => 'group_by_role', |
99 | 99 | 'type' => 'checkbox', |
100 | 100 | 'value' => 1, |
101 | 101 | 'default' => 0, |
102 | - 'description' => __( 'This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan' ), |
|
102 | + 'description' => __('This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan'), |
|
103 | 103 | ) |
104 | 104 | ); |
105 | - $cmb->add_field( array( |
|
105 | + $cmb->add_field(array( |
|
106 | 106 | 'name' => 'Placeholder', |
107 | - 'desc' => __( 'This image displays on the archive, search results and team members single if no featured image is set.', 'lsx-health-plan' ), |
|
107 | + 'desc' => __('This image displays on the archive, search results and team members single if no featured image is set.', 'lsx-health-plan'), |
|
108 | 108 | 'id' => 'team_placeholder', |
109 | 109 | 'type' => 'file', |
110 | 110 | 'options' => array( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'text' => array( |
114 | 114 | 'add_upload_file_text' => 'Choose Image', |
115 | 115 | ), |
116 | - ) ); |
|
116 | + )); |
|
117 | 117 | $cmb->add_field( |
118 | 118 | array( |
119 | 119 | 'id' => 'settings_general_closing', |
@@ -128,30 +128,30 @@ discard block |
||
128 | 128 | * @param object $cmb new_cmb2_box(). |
129 | 129 | * @return void |
130 | 130 | */ |
131 | - public function global_defaults( $cmb ) { |
|
131 | + public function global_defaults($cmb) { |
|
132 | 132 | $cmb->add_field( |
133 | 133 | array( |
134 | 134 | 'id' => 'global_defaults_title', |
135 | 135 | 'type' => 'title', |
136 | - 'name' => __( 'Careers CTA', 'lsx-team' ), |
|
137 | - 'default' => __( 'Careers CTA', 'lsx-team' ), |
|
136 | + 'name' => __('Careers CTA', 'lsx-team'), |
|
137 | + 'default' => __('Careers CTA', 'lsx-team'), |
|
138 | 138 | ) |
139 | 139 | ); |
140 | 140 | |
141 | 141 | $cmb->add_field( |
142 | 142 | array( |
143 | - 'name' => __( 'Enable careers CTA', 'lsx-team' ), |
|
143 | + 'name' => __('Enable careers CTA', 'lsx-team'), |
|
144 | 144 | 'id' => 'team_careers_cta_enable', |
145 | 145 | 'type' => 'checkbox', |
146 | 146 | 'value' => 1, |
147 | 147 | 'default' => 0, |
148 | - 'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ), |
|
148 | + 'description' => __('Displays careers CTA mystery man on team archive.', 'lsx-health-plan'), |
|
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | |
152 | 152 | $cmb->add_field( |
153 | 153 | array( |
154 | - 'name' => __( 'Title', 'lsx-team' ), |
|
154 | + 'name' => __('Title', 'lsx-team'), |
|
155 | 155 | 'id' => 'team_careers_cta_title', |
156 | 156 | 'type' => 'text', |
157 | 157 | ) |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | $cmb->add_field( |
161 | 161 | array( |
162 | - 'name' => __( 'Tagline', 'lsx-team' ), |
|
162 | + 'name' => __('Tagline', 'lsx-team'), |
|
163 | 163 | 'id' => 'team_careers_cta_tagline', |
164 | 164 | 'type' => 'text', |
165 | 165 | ) |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | $cmb->add_field( |
169 | 169 | array( |
170 | - 'name' => __( 'Link Text', 'lsx-team' ), |
|
170 | + 'name' => __('Link Text', 'lsx-team'), |
|
171 | 171 | 'id' => 'team_careers_cta_link_text', |
172 | 172 | 'type' => 'text', |
173 | 173 | ) |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $cmb->add_field( |
177 | 177 | array( |
178 | - 'name' => __( 'Careers page link', 'lsx-team' ), |
|
178 | + 'name' => __('Careers page link', 'lsx-team'), |
|
179 | 179 | 'id' => 'team_careers_cta_link', |
180 | 180 | 'type' => 'text', |
181 | 181 | ) |
@@ -11,445 +11,445 @@ |
||
11 | 11 | |
12 | 12 | class LSX_Team_Admin { |
13 | 13 | |
14 | - public function __construct() { |
|
15 | - $this->load_classes(); |
|
16 | - |
|
17 | - add_action( 'init', array( $this, 'post_type_setup' ) ); |
|
18 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
19 | - |
|
20 | - add_action( 'cmb2_admin_init', array( $this, 'details_metabox' ) ); |
|
21 | - add_action( 'cmb2_admin_init', array( $this, 'projects_details_metabox' ) ); |
|
22 | - add_action( 'cmb2_admin_init', array( $this, 'services_details_metabox' ) ); |
|
23 | - add_action( 'cmb2_admin_init', array( $this, 'testimonials_details_metabox' ) ); |
|
24 | - |
|
25 | - add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
26 | - |
|
27 | - add_filter( 'type_url_form_media', array( $this, 'change_attachment_field_button' ), 20, 1 ); |
|
28 | - add_filter( 'enter_title_here', array( $this, 'change_title_text' ) ); |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * Loads the admin subclasses |
|
33 | - */ |
|
34 | - private function load_classes() { |
|
35 | - require_once LSX_TEAM_PATH . 'classes/admin/class-settings.php'; |
|
36 | - $this->settings = \lsx\team\classes\admin\Settings::get_instance(); |
|
37 | - |
|
38 | - require_once LSX_TEAM_PATH . 'classes/admin/class-settings-theme.php'; |
|
39 | - $this->settings_theme = \lsx\team\classes\admin\Settings_Theme::get_instance(); |
|
40 | - } |
|
41 | - |
|
42 | - public function post_type_setup() { |
|
43 | - $labels = array( |
|
44 | - 'name' => esc_html_x( 'Team Members', 'post type general name', 'lsx-team' ), |
|
45 | - 'singular_name' => esc_html_x( 'Team Member', 'post type singular name', 'lsx-team' ), |
|
46 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-team' ), |
|
47 | - 'add_new_item' => esc_html__( 'Add New Team Member', 'lsx-team' ), |
|
48 | - 'edit_item' => esc_html__( 'Edit Team Member', 'lsx-team' ), |
|
49 | - 'new_item' => esc_html__( 'New Team Member', 'lsx-team' ), |
|
50 | - 'all_items' => esc_html__( 'All Team Members', 'lsx-team' ), |
|
51 | - 'view_item' => esc_html__( 'View Team Member', 'lsx-team' ), |
|
52 | - 'search_items' => esc_html__( 'Search Team Members', 'lsx-team' ), |
|
53 | - 'not_found' => esc_html__( 'No team members found', 'lsx-team' ), |
|
54 | - 'not_found_in_trash' => esc_html__( 'No team members found in Trash', 'lsx-team' ), |
|
55 | - 'parent_item_colon' => '', |
|
56 | - 'menu_name' => esc_html_x( 'Team Members', 'admin menu', 'lsx-team' ), |
|
57 | - ); |
|
58 | - |
|
59 | - $args = array( |
|
60 | - 'labels' => $labels, |
|
61 | - 'public' => true, |
|
62 | - 'publicly_queryable' => true, |
|
63 | - 'show_ui' => true, |
|
64 | - 'show_in_menu' => true, |
|
65 | - 'menu_icon' => 'dashicons-groups', |
|
66 | - 'query_var' => true, |
|
67 | - 'rewrite' => array( |
|
68 | - 'slug' => 'team', |
|
69 | - ), |
|
70 | - 'capability_type' => 'post', |
|
71 | - 'has_archive' => 'team', |
|
72 | - 'hierarchical' => false, |
|
73 | - 'menu_position' => null, |
|
74 | - 'supports' => array( |
|
75 | - 'title', |
|
76 | - 'editor', |
|
77 | - 'excerpt', |
|
78 | - 'thumbnail', |
|
79 | - 'custom-fields', |
|
80 | - ), |
|
81 | - 'show_in_rest' => true, |
|
82 | - ); |
|
83 | - |
|
84 | - register_post_type( 'team', $args ); |
|
85 | - } |
|
86 | - |
|
87 | - public function taxonomy_setup() { |
|
88 | - $labels = array( |
|
89 | - 'name' => esc_html_x( 'Roles', 'taxonomy general name', 'lsx-team' ), |
|
90 | - 'singular_name' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
91 | - 'search_items' => esc_html__( 'Search Roles', 'lsx-team' ), |
|
92 | - 'all_items' => esc_html__( 'All Roles', 'lsx-team' ), |
|
93 | - 'parent_item' => esc_html__( 'Parent Role', 'lsx-team' ), |
|
94 | - 'parent_item_colon' => esc_html__( 'Parent Role:', 'lsx-team' ), |
|
95 | - 'edit_item' => esc_html__( 'Edit Role', 'lsx-team' ), |
|
96 | - 'update_item' => esc_html__( 'Update Role', 'lsx-team' ), |
|
97 | - 'add_new_item' => esc_html__( 'Add New Role', 'lsx-team' ), |
|
98 | - 'new_item_name' => esc_html__( 'New Role Name', 'lsx-team' ), |
|
99 | - 'menu_name' => esc_html__( 'Roles', 'lsx-team' ), |
|
100 | - ); |
|
101 | - |
|
102 | - $args = array( |
|
103 | - 'hierarchical' => true, |
|
104 | - 'labels' => $labels, |
|
105 | - 'show_ui' => true, |
|
106 | - 'show_admin_column' => true, |
|
107 | - 'query_var' => true, |
|
108 | - 'rewrite' => array( |
|
109 | - 'slug' => 'team-role', |
|
110 | - ), |
|
111 | - 'show_in_rest' => true, |
|
112 | - ); |
|
113 | - |
|
114 | - register_taxonomy( 'team_role', array( 'team' ), $args ); |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Define the metabox and field configurations. |
|
119 | - */ |
|
120 | - public function details_metabox() { |
|
121 | - |
|
122 | - $prefix = 'lsx_'; |
|
123 | - |
|
124 | - $users = get_transient( 'lsx_team_users' ); |
|
125 | - |
|
126 | - if ( false === $users || '' === $users ) { |
|
127 | - $users = get_users( array( |
|
128 | - 'role__in' => array( 'administrator', 'editor', 'author' ), |
|
129 | - ) ); |
|
130 | - set_transient( 'lsx_team_users', $users, 5 * 60 ); |
|
131 | - } |
|
132 | - |
|
133 | - foreach ( $users as $user ) { |
|
134 | - $user_array[$user->ID] = $user->user_login; |
|
135 | - } |
|
136 | - |
|
137 | - $cmb = new_cmb2_box( |
|
138 | - array( |
|
139 | - 'id' => $prefix . '_team', |
|
140 | - 'title' => esc_html__( 'Team Member Details', 'lsx-team' ), |
|
141 | - 'object_types' => 'team', |
|
142 | - 'context' => 'normal', |
|
143 | - 'priority' => 'low', |
|
144 | - 'show_names' => true, |
|
145 | - ) |
|
146 | - ); |
|
147 | - |
|
148 | - $cmb->add_field( |
|
149 | - array( |
|
150 | - 'name' => esc_html__( 'Featured:', 'lsx-team' ), |
|
151 | - 'id' => $prefix . 'featured', |
|
152 | - 'type' => 'checkbox', |
|
153 | - 'value' => 1, |
|
154 | - 'default' => 0, |
|
155 | - 'show_in_rest' => true, |
|
156 | - ) |
|
157 | - ); |
|
158 | - |
|
159 | - $cmb->add_field( |
|
160 | - array( |
|
161 | - 'name' => esc_html__( 'Site User', 'lsx-team' ), |
|
162 | - 'id' => $prefix . 'site_user', |
|
163 | - 'allow_none' => true, |
|
164 | - 'type' => 'select', |
|
165 | - 'options' => $user_array, |
|
166 | - 'show_in_rest' => true, |
|
167 | - ) |
|
168 | - ); |
|
169 | - |
|
170 | - $cmb->add_field( |
|
171 | - array( |
|
172 | - 'name' => esc_html__( 'Job Title:', 'lsx-team' ), |
|
173 | - 'id' => $prefix . 'job_title', |
|
174 | - 'type' => 'text', |
|
175 | - 'show_in_rest' => true, |
|
176 | - ) |
|
177 | - ); |
|
178 | - |
|
179 | - $cmb->add_field( |
|
180 | - array( |
|
181 | - 'name' => esc_html__( 'Location:', 'lsx-team' ), |
|
182 | - 'id' => $prefix . 'location', |
|
183 | - 'type' => 'text', |
|
184 | - 'show_in_rest' => true, |
|
185 | - ) |
|
186 | - ); |
|
187 | - |
|
188 | - $cmb->add_field( |
|
189 | - array( |
|
190 | - 'name' => esc_html__( 'Contact Email Address:', 'lsx-team' ), |
|
191 | - 'id' => $prefix . 'email_contact', |
|
192 | - 'type' => 'text', |
|
193 | - 'show_in_rest' => true, |
|
194 | - ) |
|
195 | - ); |
|
196 | - |
|
197 | - $cmb->add_field( |
|
198 | - array( |
|
199 | - 'name' => esc_html__( 'Gravatar Email Address:', 'lsx-team' ), |
|
200 | - 'desc' => esc_html__( 'Used for Gravatar if a featured image is not set', 'lsx-team' ), |
|
201 | - 'id' => $prefix . 'email_gravatar', |
|
202 | - 'type' => 'text', |
|
203 | - 'show_in_rest' => true, |
|
204 | - ) |
|
205 | - ); |
|
206 | - |
|
207 | - $cmb->add_field( |
|
208 | - array( |
|
209 | - 'name' => esc_html__( 'Telephone Number:', 'lsx-team' ), |
|
210 | - 'id' => $prefix . 'tel', |
|
211 | - 'type' => 'text', |
|
212 | - 'show_in_rest' => true, |
|
213 | - ) |
|
214 | - ); |
|
215 | - |
|
216 | - $cmb->add_field( |
|
217 | - array( |
|
218 | - 'name' => esc_html__( 'Skype Name:', 'lsx-team' ), |
|
219 | - 'id' => $prefix . 'skype', |
|
220 | - 'type' => 'text', |
|
221 | - 'show_in_rest' => true, |
|
222 | - ) |
|
223 | - ); |
|
224 | - |
|
225 | - $cmb->add_field( |
|
226 | - array( |
|
227 | - 'name' => esc_html__( 'Facebook URL', 'lsx-team' ), |
|
228 | - 'id' => $prefix . 'facebook', |
|
229 | - 'type' => 'text_url', |
|
230 | - 'show_in_rest' => true, |
|
231 | - ) |
|
232 | - ); |
|
233 | - |
|
234 | - $cmb->add_field( |
|
235 | - array( |
|
236 | - 'name' => esc_html__( 'Twitter URL', 'lsx-team' ), |
|
237 | - 'id' => $prefix . 'twitter', |
|
238 | - 'type' => 'text_url', |
|
239 | - 'show_in_rest' => true, |
|
240 | - ) |
|
241 | - ); |
|
242 | - |
|
243 | - $cmb->add_field( |
|
244 | - array( |
|
245 | - 'name' => esc_html__( 'LinkedIn URL', 'lsx-team' ), |
|
246 | - 'id' => $prefix . 'linkedin', |
|
247 | - 'type' => 'text_url', |
|
248 | - 'show_in_rest' => true, |
|
249 | - ) |
|
250 | - ); |
|
251 | - |
|
252 | - $cmb->add_field( |
|
253 | - array( |
|
254 | - 'name' => esc_html__( 'Github URL', 'lsx-team' ), |
|
255 | - 'id' => $prefix . 'github', |
|
256 | - 'type' => 'text_url', |
|
257 | - 'show_in_rest' => true, |
|
258 | - ) |
|
259 | - ); |
|
260 | - |
|
261 | - $cmb->add_field( |
|
262 | - array( |
|
263 | - 'name' => esc_html__( 'WordPress URL', 'lsx-team' ), |
|
264 | - 'id' => $prefix . 'wordpress', |
|
265 | - 'type' => 'text_url', |
|
266 | - 'show_in_rest' => true, |
|
267 | - ) |
|
268 | - ); |
|
269 | - } |
|
270 | - |
|
271 | - /** |
|
272 | - * Define the metabox and field configurations. |
|
273 | - */ |
|
274 | - public function projects_details_metabox() { |
|
275 | - |
|
276 | - if ( class_exists( 'LSX_Projects' ) ) { |
|
277 | - |
|
278 | - $prefix = 'lsx_'; |
|
279 | - |
|
280 | - $cmb = new_cmb2_box( |
|
281 | - array( |
|
282 | - 'id' => $prefix . '_team', |
|
283 | - 'context' => 'normal', |
|
284 | - 'priority' => 'low', |
|
285 | - 'show_names' => true, |
|
286 | - 'object_types' => array( 'team' ), |
|
287 | - ) |
|
288 | - ); |
|
289 | - $cmb->add_field( |
|
290 | - array( |
|
291 | - 'name' => __( 'Projects:', 'lsx-team' ), |
|
292 | - 'id' => 'project_to_team', |
|
293 | - 'type' => 'post_search_ajax', |
|
294 | - 'limit' => 15, |
|
295 | - 'sortable' => true, |
|
296 | - 'query_args' => array( |
|
297 | - 'post_type' => array( 'project' ), |
|
298 | - 'post_status' => array( 'publish' ), |
|
299 | - 'posts_per_page' => -1, |
|
300 | - ), |
|
301 | - ) |
|
302 | - ); |
|
303 | - } |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * Define the metabox and field configurations. |
|
308 | - */ |
|
309 | - public function services_details_metabox() { |
|
310 | - |
|
311 | - if ( class_exists( 'LSX_Services' ) ) { |
|
312 | - |
|
313 | - $prefix = 'lsx_'; |
|
314 | - |
|
315 | - $cmb = new_cmb2_box( |
|
316 | - array( |
|
317 | - 'id' => $prefix . '_team', |
|
318 | - 'context' => 'normal', |
|
319 | - 'priority' => 'low', |
|
320 | - 'show_names' => true, |
|
321 | - 'object_types' => array( 'team' ), |
|
322 | - ) |
|
323 | - ); |
|
324 | - $cmb->add_field( |
|
325 | - array( |
|
326 | - 'name' => __( 'Services:', 'lsx-team' ), |
|
327 | - 'id' => 'service_to_team', |
|
328 | - 'type' => 'post_search_ajax', |
|
329 | - 'limit' => 15, |
|
330 | - 'sortable' => true, |
|
331 | - 'query_args' => array( |
|
332 | - 'post_type' => array( 'service' ), |
|
333 | - 'post_status' => array( 'publish' ), |
|
334 | - 'posts_per_page' => -1, |
|
335 | - ), |
|
336 | - ) |
|
337 | - ); |
|
338 | - } |
|
339 | - } |
|
340 | - |
|
341 | - /** |
|
342 | - * Define the metabox and field configurations. |
|
343 | - */ |
|
344 | - public function testimonials_details_metabox() { |
|
345 | - |
|
346 | - if ( class_exists( 'LSX_Testimonials' ) ) { |
|
347 | - |
|
348 | - $prefix = 'lsx_'; |
|
349 | - |
|
350 | - $cmb = new_cmb2_box( |
|
351 | - array( |
|
352 | - 'id' => $prefix . '_team', |
|
353 | - 'context' => 'normal', |
|
354 | - 'priority' => 'low', |
|
355 | - 'show_names' => true, |
|
356 | - 'object_types' => array( 'team' ), |
|
357 | - ) |
|
358 | - ); |
|
359 | - $cmb->add_field( |
|
360 | - array( |
|
361 | - 'name' => __( 'Testimonials:', 'lsx-team' ), |
|
362 | - 'id' => 'testimonial_to_team', |
|
363 | - 'type' => 'post_search_ajax', |
|
364 | - 'limit' => 15, |
|
365 | - 'sortable' => true, |
|
366 | - 'query_args' => array( |
|
367 | - 'post_type' => array( 'testimonial' ), |
|
368 | - 'post_status' => array( 'publish' ), |
|
369 | - 'posts_per_page' => -1, |
|
370 | - ), |
|
371 | - ) |
|
372 | - ); |
|
373 | - } |
|
374 | - |
|
375 | - } |
|
376 | - |
|
377 | - /** |
|
378 | - * Sets up the "post relations". |
|
379 | - */ |
|
380 | - public function post_relations( $post_id, $field, $value ) { |
|
381 | - $connections = array( |
|
382 | - 'team_to_testimonial', |
|
383 | - 'testimonial_to_team', |
|
384 | - |
|
385 | - 'team_to_project', |
|
386 | - 'project_to_team', |
|
387 | - |
|
388 | - 'team_to_service', |
|
389 | - 'service_to_team', |
|
390 | - ); |
|
391 | - |
|
392 | - if ( in_array( $field['id'], $connections ) ) { |
|
393 | - $this->save_related_post( $connections, $post_id, $field, $value ); |
|
394 | - } |
|
395 | - } |
|
396 | - |
|
397 | - /** |
|
398 | - * Save the reverse post relation. |
|
399 | - */ |
|
400 | - public function save_related_post( $connections, $post_id, $field, $value ) { |
|
401 | - $ids = explode( '_to_', $field['id'] ); |
|
402 | - $relation = $ids[1] . '_to_' . $ids[0]; |
|
403 | - |
|
404 | - if ( in_array( $relation, $connections ) ) { |
|
405 | - $previous_values = get_post_meta( $post_id, $field['id'], false ); |
|
406 | - |
|
407 | - if ( ! empty( $previous_values ) ) { |
|
408 | - foreach ( $previous_values as $v ) { |
|
409 | - delete_post_meta( $v, $relation, $post_id ); |
|
410 | - } |
|
411 | - } |
|
412 | - |
|
413 | - if ( is_array( $value ) ) { |
|
414 | - foreach ( $value as $v ) { |
|
415 | - if ( ! empty( $v ) ) { |
|
416 | - add_post_meta( $v, $relation, $post_id ); |
|
417 | - } |
|
418 | - } |
|
419 | - } |
|
420 | - } |
|
421 | - } |
|
422 | - |
|
423 | - public function assets() { |
|
424 | - //wp_enqueue_media(); |
|
425 | - wp_enqueue_script( 'media-upload' ); |
|
426 | - wp_enqueue_script( 'thickbox' ); |
|
427 | - wp_enqueue_style( 'thickbox' ); |
|
428 | - |
|
429 | - wp_enqueue_script( 'lsx-team-admin', LSX_TEAM_URL . 'assets/js/lsx-team-admin.min.js', array( 'jquery' ), LSX_TEAM_VER ); |
|
430 | - wp_enqueue_style( 'lsx-team-admin', LSX_TEAM_URL . 'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER ); |
|
431 | - } |
|
432 | - |
|
433 | - /** |
|
434 | - * Change the "Insert into Post" button text when media modal is used for feature images |
|
435 | - */ |
|
436 | - public function change_attachment_field_button( $html ) { |
|
437 | - if ( isset( $_GET['feature_image_text_button'] ) ) { |
|
438 | - $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-team' ) ), $html ); |
|
439 | - } |
|
440 | - |
|
441 | - return $html; |
|
442 | - } |
|
443 | - |
|
444 | - public function change_title_text( $title ) { |
|
445 | - $screen = get_current_screen(); |
|
446 | - |
|
447 | - if ( 'team' === $screen->post_type ) { |
|
448 | - $title = esc_attr__( 'Enter team member name', 'lsx-team' ); |
|
449 | - } |
|
450 | - |
|
451 | - return $title; |
|
452 | - } |
|
14 | + public function __construct() { |
|
15 | + $this->load_classes(); |
|
16 | + |
|
17 | + add_action( 'init', array( $this, 'post_type_setup' ) ); |
|
18 | + add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
19 | + |
|
20 | + add_action( 'cmb2_admin_init', array( $this, 'details_metabox' ) ); |
|
21 | + add_action( 'cmb2_admin_init', array( $this, 'projects_details_metabox' ) ); |
|
22 | + add_action( 'cmb2_admin_init', array( $this, 'services_details_metabox' ) ); |
|
23 | + add_action( 'cmb2_admin_init', array( $this, 'testimonials_details_metabox' ) ); |
|
24 | + |
|
25 | + add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
26 | + |
|
27 | + add_filter( 'type_url_form_media', array( $this, 'change_attachment_field_button' ), 20, 1 ); |
|
28 | + add_filter( 'enter_title_here', array( $this, 'change_title_text' ) ); |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * Loads the admin subclasses |
|
33 | + */ |
|
34 | + private function load_classes() { |
|
35 | + require_once LSX_TEAM_PATH . 'classes/admin/class-settings.php'; |
|
36 | + $this->settings = \lsx\team\classes\admin\Settings::get_instance(); |
|
37 | + |
|
38 | + require_once LSX_TEAM_PATH . 'classes/admin/class-settings-theme.php'; |
|
39 | + $this->settings_theme = \lsx\team\classes\admin\Settings_Theme::get_instance(); |
|
40 | + } |
|
41 | + |
|
42 | + public function post_type_setup() { |
|
43 | + $labels = array( |
|
44 | + 'name' => esc_html_x( 'Team Members', 'post type general name', 'lsx-team' ), |
|
45 | + 'singular_name' => esc_html_x( 'Team Member', 'post type singular name', 'lsx-team' ), |
|
46 | + 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-team' ), |
|
47 | + 'add_new_item' => esc_html__( 'Add New Team Member', 'lsx-team' ), |
|
48 | + 'edit_item' => esc_html__( 'Edit Team Member', 'lsx-team' ), |
|
49 | + 'new_item' => esc_html__( 'New Team Member', 'lsx-team' ), |
|
50 | + 'all_items' => esc_html__( 'All Team Members', 'lsx-team' ), |
|
51 | + 'view_item' => esc_html__( 'View Team Member', 'lsx-team' ), |
|
52 | + 'search_items' => esc_html__( 'Search Team Members', 'lsx-team' ), |
|
53 | + 'not_found' => esc_html__( 'No team members found', 'lsx-team' ), |
|
54 | + 'not_found_in_trash' => esc_html__( 'No team members found in Trash', 'lsx-team' ), |
|
55 | + 'parent_item_colon' => '', |
|
56 | + 'menu_name' => esc_html_x( 'Team Members', 'admin menu', 'lsx-team' ), |
|
57 | + ); |
|
58 | + |
|
59 | + $args = array( |
|
60 | + 'labels' => $labels, |
|
61 | + 'public' => true, |
|
62 | + 'publicly_queryable' => true, |
|
63 | + 'show_ui' => true, |
|
64 | + 'show_in_menu' => true, |
|
65 | + 'menu_icon' => 'dashicons-groups', |
|
66 | + 'query_var' => true, |
|
67 | + 'rewrite' => array( |
|
68 | + 'slug' => 'team', |
|
69 | + ), |
|
70 | + 'capability_type' => 'post', |
|
71 | + 'has_archive' => 'team', |
|
72 | + 'hierarchical' => false, |
|
73 | + 'menu_position' => null, |
|
74 | + 'supports' => array( |
|
75 | + 'title', |
|
76 | + 'editor', |
|
77 | + 'excerpt', |
|
78 | + 'thumbnail', |
|
79 | + 'custom-fields', |
|
80 | + ), |
|
81 | + 'show_in_rest' => true, |
|
82 | + ); |
|
83 | + |
|
84 | + register_post_type( 'team', $args ); |
|
85 | + } |
|
86 | + |
|
87 | + public function taxonomy_setup() { |
|
88 | + $labels = array( |
|
89 | + 'name' => esc_html_x( 'Roles', 'taxonomy general name', 'lsx-team' ), |
|
90 | + 'singular_name' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
91 | + 'search_items' => esc_html__( 'Search Roles', 'lsx-team' ), |
|
92 | + 'all_items' => esc_html__( 'All Roles', 'lsx-team' ), |
|
93 | + 'parent_item' => esc_html__( 'Parent Role', 'lsx-team' ), |
|
94 | + 'parent_item_colon' => esc_html__( 'Parent Role:', 'lsx-team' ), |
|
95 | + 'edit_item' => esc_html__( 'Edit Role', 'lsx-team' ), |
|
96 | + 'update_item' => esc_html__( 'Update Role', 'lsx-team' ), |
|
97 | + 'add_new_item' => esc_html__( 'Add New Role', 'lsx-team' ), |
|
98 | + 'new_item_name' => esc_html__( 'New Role Name', 'lsx-team' ), |
|
99 | + 'menu_name' => esc_html__( 'Roles', 'lsx-team' ), |
|
100 | + ); |
|
101 | + |
|
102 | + $args = array( |
|
103 | + 'hierarchical' => true, |
|
104 | + 'labels' => $labels, |
|
105 | + 'show_ui' => true, |
|
106 | + 'show_admin_column' => true, |
|
107 | + 'query_var' => true, |
|
108 | + 'rewrite' => array( |
|
109 | + 'slug' => 'team-role', |
|
110 | + ), |
|
111 | + 'show_in_rest' => true, |
|
112 | + ); |
|
113 | + |
|
114 | + register_taxonomy( 'team_role', array( 'team' ), $args ); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Define the metabox and field configurations. |
|
119 | + */ |
|
120 | + public function details_metabox() { |
|
121 | + |
|
122 | + $prefix = 'lsx_'; |
|
123 | + |
|
124 | + $users = get_transient( 'lsx_team_users' ); |
|
125 | + |
|
126 | + if ( false === $users || '' === $users ) { |
|
127 | + $users = get_users( array( |
|
128 | + 'role__in' => array( 'administrator', 'editor', 'author' ), |
|
129 | + ) ); |
|
130 | + set_transient( 'lsx_team_users', $users, 5 * 60 ); |
|
131 | + } |
|
132 | + |
|
133 | + foreach ( $users as $user ) { |
|
134 | + $user_array[$user->ID] = $user->user_login; |
|
135 | + } |
|
136 | + |
|
137 | + $cmb = new_cmb2_box( |
|
138 | + array( |
|
139 | + 'id' => $prefix . '_team', |
|
140 | + 'title' => esc_html__( 'Team Member Details', 'lsx-team' ), |
|
141 | + 'object_types' => 'team', |
|
142 | + 'context' => 'normal', |
|
143 | + 'priority' => 'low', |
|
144 | + 'show_names' => true, |
|
145 | + ) |
|
146 | + ); |
|
147 | + |
|
148 | + $cmb->add_field( |
|
149 | + array( |
|
150 | + 'name' => esc_html__( 'Featured:', 'lsx-team' ), |
|
151 | + 'id' => $prefix . 'featured', |
|
152 | + 'type' => 'checkbox', |
|
153 | + 'value' => 1, |
|
154 | + 'default' => 0, |
|
155 | + 'show_in_rest' => true, |
|
156 | + ) |
|
157 | + ); |
|
158 | + |
|
159 | + $cmb->add_field( |
|
160 | + array( |
|
161 | + 'name' => esc_html__( 'Site User', 'lsx-team' ), |
|
162 | + 'id' => $prefix . 'site_user', |
|
163 | + 'allow_none' => true, |
|
164 | + 'type' => 'select', |
|
165 | + 'options' => $user_array, |
|
166 | + 'show_in_rest' => true, |
|
167 | + ) |
|
168 | + ); |
|
169 | + |
|
170 | + $cmb->add_field( |
|
171 | + array( |
|
172 | + 'name' => esc_html__( 'Job Title:', 'lsx-team' ), |
|
173 | + 'id' => $prefix . 'job_title', |
|
174 | + 'type' => 'text', |
|
175 | + 'show_in_rest' => true, |
|
176 | + ) |
|
177 | + ); |
|
178 | + |
|
179 | + $cmb->add_field( |
|
180 | + array( |
|
181 | + 'name' => esc_html__( 'Location:', 'lsx-team' ), |
|
182 | + 'id' => $prefix . 'location', |
|
183 | + 'type' => 'text', |
|
184 | + 'show_in_rest' => true, |
|
185 | + ) |
|
186 | + ); |
|
187 | + |
|
188 | + $cmb->add_field( |
|
189 | + array( |
|
190 | + 'name' => esc_html__( 'Contact Email Address:', 'lsx-team' ), |
|
191 | + 'id' => $prefix . 'email_contact', |
|
192 | + 'type' => 'text', |
|
193 | + 'show_in_rest' => true, |
|
194 | + ) |
|
195 | + ); |
|
196 | + |
|
197 | + $cmb->add_field( |
|
198 | + array( |
|
199 | + 'name' => esc_html__( 'Gravatar Email Address:', 'lsx-team' ), |
|
200 | + 'desc' => esc_html__( 'Used for Gravatar if a featured image is not set', 'lsx-team' ), |
|
201 | + 'id' => $prefix . 'email_gravatar', |
|
202 | + 'type' => 'text', |
|
203 | + 'show_in_rest' => true, |
|
204 | + ) |
|
205 | + ); |
|
206 | + |
|
207 | + $cmb->add_field( |
|
208 | + array( |
|
209 | + 'name' => esc_html__( 'Telephone Number:', 'lsx-team' ), |
|
210 | + 'id' => $prefix . 'tel', |
|
211 | + 'type' => 'text', |
|
212 | + 'show_in_rest' => true, |
|
213 | + ) |
|
214 | + ); |
|
215 | + |
|
216 | + $cmb->add_field( |
|
217 | + array( |
|
218 | + 'name' => esc_html__( 'Skype Name:', 'lsx-team' ), |
|
219 | + 'id' => $prefix . 'skype', |
|
220 | + 'type' => 'text', |
|
221 | + 'show_in_rest' => true, |
|
222 | + ) |
|
223 | + ); |
|
224 | + |
|
225 | + $cmb->add_field( |
|
226 | + array( |
|
227 | + 'name' => esc_html__( 'Facebook URL', 'lsx-team' ), |
|
228 | + 'id' => $prefix . 'facebook', |
|
229 | + 'type' => 'text_url', |
|
230 | + 'show_in_rest' => true, |
|
231 | + ) |
|
232 | + ); |
|
233 | + |
|
234 | + $cmb->add_field( |
|
235 | + array( |
|
236 | + 'name' => esc_html__( 'Twitter URL', 'lsx-team' ), |
|
237 | + 'id' => $prefix . 'twitter', |
|
238 | + 'type' => 'text_url', |
|
239 | + 'show_in_rest' => true, |
|
240 | + ) |
|
241 | + ); |
|
242 | + |
|
243 | + $cmb->add_field( |
|
244 | + array( |
|
245 | + 'name' => esc_html__( 'LinkedIn URL', 'lsx-team' ), |
|
246 | + 'id' => $prefix . 'linkedin', |
|
247 | + 'type' => 'text_url', |
|
248 | + 'show_in_rest' => true, |
|
249 | + ) |
|
250 | + ); |
|
251 | + |
|
252 | + $cmb->add_field( |
|
253 | + array( |
|
254 | + 'name' => esc_html__( 'Github URL', 'lsx-team' ), |
|
255 | + 'id' => $prefix . 'github', |
|
256 | + 'type' => 'text_url', |
|
257 | + 'show_in_rest' => true, |
|
258 | + ) |
|
259 | + ); |
|
260 | + |
|
261 | + $cmb->add_field( |
|
262 | + array( |
|
263 | + 'name' => esc_html__( 'WordPress URL', 'lsx-team' ), |
|
264 | + 'id' => $prefix . 'wordpress', |
|
265 | + 'type' => 'text_url', |
|
266 | + 'show_in_rest' => true, |
|
267 | + ) |
|
268 | + ); |
|
269 | + } |
|
270 | + |
|
271 | + /** |
|
272 | + * Define the metabox and field configurations. |
|
273 | + */ |
|
274 | + public function projects_details_metabox() { |
|
275 | + |
|
276 | + if ( class_exists( 'LSX_Projects' ) ) { |
|
277 | + |
|
278 | + $prefix = 'lsx_'; |
|
279 | + |
|
280 | + $cmb = new_cmb2_box( |
|
281 | + array( |
|
282 | + 'id' => $prefix . '_team', |
|
283 | + 'context' => 'normal', |
|
284 | + 'priority' => 'low', |
|
285 | + 'show_names' => true, |
|
286 | + 'object_types' => array( 'team' ), |
|
287 | + ) |
|
288 | + ); |
|
289 | + $cmb->add_field( |
|
290 | + array( |
|
291 | + 'name' => __( 'Projects:', 'lsx-team' ), |
|
292 | + 'id' => 'project_to_team', |
|
293 | + 'type' => 'post_search_ajax', |
|
294 | + 'limit' => 15, |
|
295 | + 'sortable' => true, |
|
296 | + 'query_args' => array( |
|
297 | + 'post_type' => array( 'project' ), |
|
298 | + 'post_status' => array( 'publish' ), |
|
299 | + 'posts_per_page' => -1, |
|
300 | + ), |
|
301 | + ) |
|
302 | + ); |
|
303 | + } |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * Define the metabox and field configurations. |
|
308 | + */ |
|
309 | + public function services_details_metabox() { |
|
310 | + |
|
311 | + if ( class_exists( 'LSX_Services' ) ) { |
|
312 | + |
|
313 | + $prefix = 'lsx_'; |
|
314 | + |
|
315 | + $cmb = new_cmb2_box( |
|
316 | + array( |
|
317 | + 'id' => $prefix . '_team', |
|
318 | + 'context' => 'normal', |
|
319 | + 'priority' => 'low', |
|
320 | + 'show_names' => true, |
|
321 | + 'object_types' => array( 'team' ), |
|
322 | + ) |
|
323 | + ); |
|
324 | + $cmb->add_field( |
|
325 | + array( |
|
326 | + 'name' => __( 'Services:', 'lsx-team' ), |
|
327 | + 'id' => 'service_to_team', |
|
328 | + 'type' => 'post_search_ajax', |
|
329 | + 'limit' => 15, |
|
330 | + 'sortable' => true, |
|
331 | + 'query_args' => array( |
|
332 | + 'post_type' => array( 'service' ), |
|
333 | + 'post_status' => array( 'publish' ), |
|
334 | + 'posts_per_page' => -1, |
|
335 | + ), |
|
336 | + ) |
|
337 | + ); |
|
338 | + } |
|
339 | + } |
|
340 | + |
|
341 | + /** |
|
342 | + * Define the metabox and field configurations. |
|
343 | + */ |
|
344 | + public function testimonials_details_metabox() { |
|
345 | + |
|
346 | + if ( class_exists( 'LSX_Testimonials' ) ) { |
|
347 | + |
|
348 | + $prefix = 'lsx_'; |
|
349 | + |
|
350 | + $cmb = new_cmb2_box( |
|
351 | + array( |
|
352 | + 'id' => $prefix . '_team', |
|
353 | + 'context' => 'normal', |
|
354 | + 'priority' => 'low', |
|
355 | + 'show_names' => true, |
|
356 | + 'object_types' => array( 'team' ), |
|
357 | + ) |
|
358 | + ); |
|
359 | + $cmb->add_field( |
|
360 | + array( |
|
361 | + 'name' => __( 'Testimonials:', 'lsx-team' ), |
|
362 | + 'id' => 'testimonial_to_team', |
|
363 | + 'type' => 'post_search_ajax', |
|
364 | + 'limit' => 15, |
|
365 | + 'sortable' => true, |
|
366 | + 'query_args' => array( |
|
367 | + 'post_type' => array( 'testimonial' ), |
|
368 | + 'post_status' => array( 'publish' ), |
|
369 | + 'posts_per_page' => -1, |
|
370 | + ), |
|
371 | + ) |
|
372 | + ); |
|
373 | + } |
|
374 | + |
|
375 | + } |
|
376 | + |
|
377 | + /** |
|
378 | + * Sets up the "post relations". |
|
379 | + */ |
|
380 | + public function post_relations( $post_id, $field, $value ) { |
|
381 | + $connections = array( |
|
382 | + 'team_to_testimonial', |
|
383 | + 'testimonial_to_team', |
|
384 | + |
|
385 | + 'team_to_project', |
|
386 | + 'project_to_team', |
|
387 | + |
|
388 | + 'team_to_service', |
|
389 | + 'service_to_team', |
|
390 | + ); |
|
391 | + |
|
392 | + if ( in_array( $field['id'], $connections ) ) { |
|
393 | + $this->save_related_post( $connections, $post_id, $field, $value ); |
|
394 | + } |
|
395 | + } |
|
396 | + |
|
397 | + /** |
|
398 | + * Save the reverse post relation. |
|
399 | + */ |
|
400 | + public function save_related_post( $connections, $post_id, $field, $value ) { |
|
401 | + $ids = explode( '_to_', $field['id'] ); |
|
402 | + $relation = $ids[1] . '_to_' . $ids[0]; |
|
403 | + |
|
404 | + if ( in_array( $relation, $connections ) ) { |
|
405 | + $previous_values = get_post_meta( $post_id, $field['id'], false ); |
|
406 | + |
|
407 | + if ( ! empty( $previous_values ) ) { |
|
408 | + foreach ( $previous_values as $v ) { |
|
409 | + delete_post_meta( $v, $relation, $post_id ); |
|
410 | + } |
|
411 | + } |
|
412 | + |
|
413 | + if ( is_array( $value ) ) { |
|
414 | + foreach ( $value as $v ) { |
|
415 | + if ( ! empty( $v ) ) { |
|
416 | + add_post_meta( $v, $relation, $post_id ); |
|
417 | + } |
|
418 | + } |
|
419 | + } |
|
420 | + } |
|
421 | + } |
|
422 | + |
|
423 | + public function assets() { |
|
424 | + //wp_enqueue_media(); |
|
425 | + wp_enqueue_script( 'media-upload' ); |
|
426 | + wp_enqueue_script( 'thickbox' ); |
|
427 | + wp_enqueue_style( 'thickbox' ); |
|
428 | + |
|
429 | + wp_enqueue_script( 'lsx-team-admin', LSX_TEAM_URL . 'assets/js/lsx-team-admin.min.js', array( 'jquery' ), LSX_TEAM_VER ); |
|
430 | + wp_enqueue_style( 'lsx-team-admin', LSX_TEAM_URL . 'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER ); |
|
431 | + } |
|
432 | + |
|
433 | + /** |
|
434 | + * Change the "Insert into Post" button text when media modal is used for feature images |
|
435 | + */ |
|
436 | + public function change_attachment_field_button( $html ) { |
|
437 | + if ( isset( $_GET['feature_image_text_button'] ) ) { |
|
438 | + $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-team' ) ), $html ); |
|
439 | + } |
|
440 | + |
|
441 | + return $html; |
|
442 | + } |
|
443 | + |
|
444 | + public function change_title_text( $title ) { |
|
445 | + $screen = get_current_screen(); |
|
446 | + |
|
447 | + if ( 'team' === $screen->post_type ) { |
|
448 | + $title = esc_attr__( 'Enter team member name', 'lsx-team' ); |
|
449 | + } |
|
450 | + |
|
451 | + return $title; |
|
452 | + } |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | $lsx_team_admin = new LSX_Team_Admin(); |
@@ -14,46 +14,46 @@ discard block |
||
14 | 14 | public function __construct() { |
15 | 15 | $this->load_classes(); |
16 | 16 | |
17 | - add_action( 'init', array( $this, 'post_type_setup' ) ); |
|
18 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
17 | + add_action('init', array($this, 'post_type_setup')); |
|
18 | + add_action('init', array($this, 'taxonomy_setup')); |
|
19 | 19 | |
20 | - add_action( 'cmb2_admin_init', array( $this, 'details_metabox' ) ); |
|
21 | - add_action( 'cmb2_admin_init', array( $this, 'projects_details_metabox' ) ); |
|
22 | - add_action( 'cmb2_admin_init', array( $this, 'services_details_metabox' ) ); |
|
23 | - add_action( 'cmb2_admin_init', array( $this, 'testimonials_details_metabox' ) ); |
|
20 | + add_action('cmb2_admin_init', array($this, 'details_metabox')); |
|
21 | + add_action('cmb2_admin_init', array($this, 'projects_details_metabox')); |
|
22 | + add_action('cmb2_admin_init', array($this, 'services_details_metabox')); |
|
23 | + add_action('cmb2_admin_init', array($this, 'testimonials_details_metabox')); |
|
24 | 24 | |
25 | - add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
25 | + add_action('admin_enqueue_scripts', array($this, 'assets')); |
|
26 | 26 | |
27 | - add_filter( 'type_url_form_media', array( $this, 'change_attachment_field_button' ), 20, 1 ); |
|
28 | - add_filter( 'enter_title_here', array( $this, 'change_title_text' ) ); |
|
27 | + add_filter('type_url_form_media', array($this, 'change_attachment_field_button'), 20, 1); |
|
28 | + add_filter('enter_title_here', array($this, 'change_title_text')); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Loads the admin subclasses |
33 | 33 | */ |
34 | 34 | private function load_classes() { |
35 | - require_once LSX_TEAM_PATH . 'classes/admin/class-settings.php'; |
|
35 | + require_once LSX_TEAM_PATH.'classes/admin/class-settings.php'; |
|
36 | 36 | $this->settings = \lsx\team\classes\admin\Settings::get_instance(); |
37 | 37 | |
38 | - require_once LSX_TEAM_PATH . 'classes/admin/class-settings-theme.php'; |
|
38 | + require_once LSX_TEAM_PATH.'classes/admin/class-settings-theme.php'; |
|
39 | 39 | $this->settings_theme = \lsx\team\classes\admin\Settings_Theme::get_instance(); |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function post_type_setup() { |
43 | 43 | $labels = array( |
44 | - 'name' => esc_html_x( 'Team Members', 'post type general name', 'lsx-team' ), |
|
45 | - 'singular_name' => esc_html_x( 'Team Member', 'post type singular name', 'lsx-team' ), |
|
46 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-team' ), |
|
47 | - 'add_new_item' => esc_html__( 'Add New Team Member', 'lsx-team' ), |
|
48 | - 'edit_item' => esc_html__( 'Edit Team Member', 'lsx-team' ), |
|
49 | - 'new_item' => esc_html__( 'New Team Member', 'lsx-team' ), |
|
50 | - 'all_items' => esc_html__( 'All Team Members', 'lsx-team' ), |
|
51 | - 'view_item' => esc_html__( 'View Team Member', 'lsx-team' ), |
|
52 | - 'search_items' => esc_html__( 'Search Team Members', 'lsx-team' ), |
|
53 | - 'not_found' => esc_html__( 'No team members found', 'lsx-team' ), |
|
54 | - 'not_found_in_trash' => esc_html__( 'No team members found in Trash', 'lsx-team' ), |
|
44 | + 'name' => esc_html_x('Team Members', 'post type general name', 'lsx-team'), |
|
45 | + 'singular_name' => esc_html_x('Team Member', 'post type singular name', 'lsx-team'), |
|
46 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-team'), |
|
47 | + 'add_new_item' => esc_html__('Add New Team Member', 'lsx-team'), |
|
48 | + 'edit_item' => esc_html__('Edit Team Member', 'lsx-team'), |
|
49 | + 'new_item' => esc_html__('New Team Member', 'lsx-team'), |
|
50 | + 'all_items' => esc_html__('All Team Members', 'lsx-team'), |
|
51 | + 'view_item' => esc_html__('View Team Member', 'lsx-team'), |
|
52 | + 'search_items' => esc_html__('Search Team Members', 'lsx-team'), |
|
53 | + 'not_found' => esc_html__('No team members found', 'lsx-team'), |
|
54 | + 'not_found_in_trash' => esc_html__('No team members found in Trash', 'lsx-team'), |
|
55 | 55 | 'parent_item_colon' => '', |
56 | - 'menu_name' => esc_html_x( 'Team Members', 'admin menu', 'lsx-team' ), |
|
56 | + 'menu_name' => esc_html_x('Team Members', 'admin menu', 'lsx-team'), |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | $args = array( |
@@ -81,22 +81,22 @@ discard block |
||
81 | 81 | 'show_in_rest' => true, |
82 | 82 | ); |
83 | 83 | |
84 | - register_post_type( 'team', $args ); |
|
84 | + register_post_type('team', $args); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function taxonomy_setup() { |
88 | 88 | $labels = array( |
89 | - 'name' => esc_html_x( 'Roles', 'taxonomy general name', 'lsx-team' ), |
|
90 | - 'singular_name' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
91 | - 'search_items' => esc_html__( 'Search Roles', 'lsx-team' ), |
|
92 | - 'all_items' => esc_html__( 'All Roles', 'lsx-team' ), |
|
93 | - 'parent_item' => esc_html__( 'Parent Role', 'lsx-team' ), |
|
94 | - 'parent_item_colon' => esc_html__( 'Parent Role:', 'lsx-team' ), |
|
95 | - 'edit_item' => esc_html__( 'Edit Role', 'lsx-team' ), |
|
96 | - 'update_item' => esc_html__( 'Update Role', 'lsx-team' ), |
|
97 | - 'add_new_item' => esc_html__( 'Add New Role', 'lsx-team' ), |
|
98 | - 'new_item_name' => esc_html__( 'New Role Name', 'lsx-team' ), |
|
99 | - 'menu_name' => esc_html__( 'Roles', 'lsx-team' ), |
|
89 | + 'name' => esc_html_x('Roles', 'taxonomy general name', 'lsx-team'), |
|
90 | + 'singular_name' => esc_html_x('Role', 'taxonomy singular name', 'lsx-team'), |
|
91 | + 'search_items' => esc_html__('Search Roles', 'lsx-team'), |
|
92 | + 'all_items' => esc_html__('All Roles', 'lsx-team'), |
|
93 | + 'parent_item' => esc_html__('Parent Role', 'lsx-team'), |
|
94 | + 'parent_item_colon' => esc_html__('Parent Role:', 'lsx-team'), |
|
95 | + 'edit_item' => esc_html__('Edit Role', 'lsx-team'), |
|
96 | + 'update_item' => esc_html__('Update Role', 'lsx-team'), |
|
97 | + 'add_new_item' => esc_html__('Add New Role', 'lsx-team'), |
|
98 | + 'new_item_name' => esc_html__('New Role Name', 'lsx-team'), |
|
99 | + 'menu_name' => esc_html__('Roles', 'lsx-team'), |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 | $args = array( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'show_in_rest' => true, |
112 | 112 | ); |
113 | 113 | |
114 | - register_taxonomy( 'team_role', array( 'team' ), $args ); |
|
114 | + register_taxonomy('team_role', array('team'), $args); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -121,23 +121,23 @@ discard block |
||
121 | 121 | |
122 | 122 | $prefix = 'lsx_'; |
123 | 123 | |
124 | - $users = get_transient( 'lsx_team_users' ); |
|
124 | + $users = get_transient('lsx_team_users'); |
|
125 | 125 | |
126 | - if ( false === $users || '' === $users ) { |
|
127 | - $users = get_users( array( |
|
128 | - 'role__in' => array( 'administrator', 'editor', 'author' ), |
|
129 | - ) ); |
|
130 | - set_transient( 'lsx_team_users', $users, 5 * 60 ); |
|
126 | + if (false === $users || '' === $users) { |
|
127 | + $users = get_users(array( |
|
128 | + 'role__in' => array('administrator', 'editor', 'author'), |
|
129 | + )); |
|
130 | + set_transient('lsx_team_users', $users, 5 * 60); |
|
131 | 131 | } |
132 | 132 | |
133 | - foreach ( $users as $user ) { |
|
133 | + foreach ($users as $user) { |
|
134 | 134 | $user_array[$user->ID] = $user->user_login; |
135 | 135 | } |
136 | 136 | |
137 | 137 | $cmb = new_cmb2_box( |
138 | 138 | array( |
139 | - 'id' => $prefix . '_team', |
|
140 | - 'title' => esc_html__( 'Team Member Details', 'lsx-team' ), |
|
139 | + 'id' => $prefix.'_team', |
|
140 | + 'title' => esc_html__('Team Member Details', 'lsx-team'), |
|
141 | 141 | 'object_types' => 'team', |
142 | 142 | 'context' => 'normal', |
143 | 143 | 'priority' => 'low', |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | |
148 | 148 | $cmb->add_field( |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Featured:', 'lsx-team' ), |
|
151 | - 'id' => $prefix . 'featured', |
|
150 | + 'name' => esc_html__('Featured:', 'lsx-team'), |
|
151 | + 'id' => $prefix.'featured', |
|
152 | 152 | 'type' => 'checkbox', |
153 | 153 | 'value' => 1, |
154 | 154 | 'default' => 0, |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | |
159 | 159 | $cmb->add_field( |
160 | 160 | array( |
161 | - 'name' => esc_html__( 'Site User', 'lsx-team' ), |
|
162 | - 'id' => $prefix . 'site_user', |
|
161 | + 'name' => esc_html__('Site User', 'lsx-team'), |
|
162 | + 'id' => $prefix.'site_user', |
|
163 | 163 | 'allow_none' => true, |
164 | 164 | 'type' => 'select', |
165 | 165 | 'options' => $user_array, |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | |
170 | 170 | $cmb->add_field( |
171 | 171 | array( |
172 | - 'name' => esc_html__( 'Job Title:', 'lsx-team' ), |
|
173 | - 'id' => $prefix . 'job_title', |
|
172 | + 'name' => esc_html__('Job Title:', 'lsx-team'), |
|
173 | + 'id' => $prefix.'job_title', |
|
174 | 174 | 'type' => 'text', |
175 | 175 | 'show_in_rest' => true, |
176 | 176 | ) |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | |
179 | 179 | $cmb->add_field( |
180 | 180 | array( |
181 | - 'name' => esc_html__( 'Location:', 'lsx-team' ), |
|
182 | - 'id' => $prefix . 'location', |
|
181 | + 'name' => esc_html__('Location:', 'lsx-team'), |
|
182 | + 'id' => $prefix.'location', |
|
183 | 183 | 'type' => 'text', |
184 | 184 | 'show_in_rest' => true, |
185 | 185 | ) |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | |
188 | 188 | $cmb->add_field( |
189 | 189 | array( |
190 | - 'name' => esc_html__( 'Contact Email Address:', 'lsx-team' ), |
|
191 | - 'id' => $prefix . 'email_contact', |
|
190 | + 'name' => esc_html__('Contact Email Address:', 'lsx-team'), |
|
191 | + 'id' => $prefix.'email_contact', |
|
192 | 192 | 'type' => 'text', |
193 | 193 | 'show_in_rest' => true, |
194 | 194 | ) |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | |
197 | 197 | $cmb->add_field( |
198 | 198 | array( |
199 | - 'name' => esc_html__( 'Gravatar Email Address:', 'lsx-team' ), |
|
200 | - 'desc' => esc_html__( 'Used for Gravatar if a featured image is not set', 'lsx-team' ), |
|
201 | - 'id' => $prefix . 'email_gravatar', |
|
199 | + 'name' => esc_html__('Gravatar Email Address:', 'lsx-team'), |
|
200 | + 'desc' => esc_html__('Used for Gravatar if a featured image is not set', 'lsx-team'), |
|
201 | + 'id' => $prefix.'email_gravatar', |
|
202 | 202 | 'type' => 'text', |
203 | 203 | 'show_in_rest' => true, |
204 | 204 | ) |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | |
207 | 207 | $cmb->add_field( |
208 | 208 | array( |
209 | - 'name' => esc_html__( 'Telephone Number:', 'lsx-team' ), |
|
210 | - 'id' => $prefix . 'tel', |
|
209 | + 'name' => esc_html__('Telephone Number:', 'lsx-team'), |
|
210 | + 'id' => $prefix.'tel', |
|
211 | 211 | 'type' => 'text', |
212 | 212 | 'show_in_rest' => true, |
213 | 213 | ) |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | |
216 | 216 | $cmb->add_field( |
217 | 217 | array( |
218 | - 'name' => esc_html__( 'Skype Name:', 'lsx-team' ), |
|
219 | - 'id' => $prefix . 'skype', |
|
218 | + 'name' => esc_html__('Skype Name:', 'lsx-team'), |
|
219 | + 'id' => $prefix.'skype', |
|
220 | 220 | 'type' => 'text', |
221 | 221 | 'show_in_rest' => true, |
222 | 222 | ) |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | |
225 | 225 | $cmb->add_field( |
226 | 226 | array( |
227 | - 'name' => esc_html__( 'Facebook URL', 'lsx-team' ), |
|
228 | - 'id' => $prefix . 'facebook', |
|
227 | + 'name' => esc_html__('Facebook URL', 'lsx-team'), |
|
228 | + 'id' => $prefix.'facebook', |
|
229 | 229 | 'type' => 'text_url', |
230 | 230 | 'show_in_rest' => true, |
231 | 231 | ) |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | |
234 | 234 | $cmb->add_field( |
235 | 235 | array( |
236 | - 'name' => esc_html__( 'Twitter URL', 'lsx-team' ), |
|
237 | - 'id' => $prefix . 'twitter', |
|
236 | + 'name' => esc_html__('Twitter URL', 'lsx-team'), |
|
237 | + 'id' => $prefix.'twitter', |
|
238 | 238 | 'type' => 'text_url', |
239 | 239 | 'show_in_rest' => true, |
240 | 240 | ) |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | |
243 | 243 | $cmb->add_field( |
244 | 244 | array( |
245 | - 'name' => esc_html__( 'LinkedIn URL', 'lsx-team' ), |
|
246 | - 'id' => $prefix . 'linkedin', |
|
245 | + 'name' => esc_html__('LinkedIn URL', 'lsx-team'), |
|
246 | + 'id' => $prefix.'linkedin', |
|
247 | 247 | 'type' => 'text_url', |
248 | 248 | 'show_in_rest' => true, |
249 | 249 | ) |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | |
252 | 252 | $cmb->add_field( |
253 | 253 | array( |
254 | - 'name' => esc_html__( 'Github URL', 'lsx-team' ), |
|
255 | - 'id' => $prefix . 'github', |
|
254 | + 'name' => esc_html__('Github URL', 'lsx-team'), |
|
255 | + 'id' => $prefix.'github', |
|
256 | 256 | 'type' => 'text_url', |
257 | 257 | 'show_in_rest' => true, |
258 | 258 | ) |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | |
261 | 261 | $cmb->add_field( |
262 | 262 | array( |
263 | - 'name' => esc_html__( 'WordPress URL', 'lsx-team' ), |
|
264 | - 'id' => $prefix . 'wordpress', |
|
263 | + 'name' => esc_html__('WordPress URL', 'lsx-team'), |
|
264 | + 'id' => $prefix.'wordpress', |
|
265 | 265 | 'type' => 'text_url', |
266 | 266 | 'show_in_rest' => true, |
267 | 267 | ) |
@@ -273,29 +273,29 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function projects_details_metabox() { |
275 | 275 | |
276 | - if ( class_exists( 'LSX_Projects' ) ) { |
|
276 | + if (class_exists('LSX_Projects')) { |
|
277 | 277 | |
278 | 278 | $prefix = 'lsx_'; |
279 | 279 | |
280 | 280 | $cmb = new_cmb2_box( |
281 | 281 | array( |
282 | - 'id' => $prefix . '_team', |
|
282 | + 'id' => $prefix.'_team', |
|
283 | 283 | 'context' => 'normal', |
284 | 284 | 'priority' => 'low', |
285 | 285 | 'show_names' => true, |
286 | - 'object_types' => array( 'team' ), |
|
286 | + 'object_types' => array('team'), |
|
287 | 287 | ) |
288 | 288 | ); |
289 | 289 | $cmb->add_field( |
290 | 290 | array( |
291 | - 'name' => __( 'Projects:', 'lsx-team' ), |
|
291 | + 'name' => __('Projects:', 'lsx-team'), |
|
292 | 292 | 'id' => 'project_to_team', |
293 | 293 | 'type' => 'post_search_ajax', |
294 | 294 | 'limit' => 15, |
295 | 295 | 'sortable' => true, |
296 | 296 | 'query_args' => array( |
297 | - 'post_type' => array( 'project' ), |
|
298 | - 'post_status' => array( 'publish' ), |
|
297 | + 'post_type' => array('project'), |
|
298 | + 'post_status' => array('publish'), |
|
299 | 299 | 'posts_per_page' => -1, |
300 | 300 | ), |
301 | 301 | ) |
@@ -308,29 +308,29 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function services_details_metabox() { |
310 | 310 | |
311 | - if ( class_exists( 'LSX_Services' ) ) { |
|
311 | + if (class_exists('LSX_Services')) { |
|
312 | 312 | |
313 | 313 | $prefix = 'lsx_'; |
314 | 314 | |
315 | 315 | $cmb = new_cmb2_box( |
316 | 316 | array( |
317 | - 'id' => $prefix . '_team', |
|
317 | + 'id' => $prefix.'_team', |
|
318 | 318 | 'context' => 'normal', |
319 | 319 | 'priority' => 'low', |
320 | 320 | 'show_names' => true, |
321 | - 'object_types' => array( 'team' ), |
|
321 | + 'object_types' => array('team'), |
|
322 | 322 | ) |
323 | 323 | ); |
324 | 324 | $cmb->add_field( |
325 | 325 | array( |
326 | - 'name' => __( 'Services:', 'lsx-team' ), |
|
326 | + 'name' => __('Services:', 'lsx-team'), |
|
327 | 327 | 'id' => 'service_to_team', |
328 | 328 | 'type' => 'post_search_ajax', |
329 | 329 | 'limit' => 15, |
330 | 330 | 'sortable' => true, |
331 | 331 | 'query_args' => array( |
332 | - 'post_type' => array( 'service' ), |
|
333 | - 'post_status' => array( 'publish' ), |
|
332 | + 'post_type' => array('service'), |
|
333 | + 'post_status' => array('publish'), |
|
334 | 334 | 'posts_per_page' => -1, |
335 | 335 | ), |
336 | 336 | ) |
@@ -343,29 +343,29 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function testimonials_details_metabox() { |
345 | 345 | |
346 | - if ( class_exists( 'LSX_Testimonials' ) ) { |
|
346 | + if (class_exists('LSX_Testimonials')) { |
|
347 | 347 | |
348 | 348 | $prefix = 'lsx_'; |
349 | 349 | |
350 | 350 | $cmb = new_cmb2_box( |
351 | 351 | array( |
352 | - 'id' => $prefix . '_team', |
|
352 | + 'id' => $prefix.'_team', |
|
353 | 353 | 'context' => 'normal', |
354 | 354 | 'priority' => 'low', |
355 | 355 | 'show_names' => true, |
356 | - 'object_types' => array( 'team' ), |
|
356 | + 'object_types' => array('team'), |
|
357 | 357 | ) |
358 | 358 | ); |
359 | 359 | $cmb->add_field( |
360 | 360 | array( |
361 | - 'name' => __( 'Testimonials:', 'lsx-team' ), |
|
361 | + 'name' => __('Testimonials:', 'lsx-team'), |
|
362 | 362 | 'id' => 'testimonial_to_team', |
363 | 363 | 'type' => 'post_search_ajax', |
364 | 364 | 'limit' => 15, |
365 | 365 | 'sortable' => true, |
366 | 366 | 'query_args' => array( |
367 | - 'post_type' => array( 'testimonial' ), |
|
368 | - 'post_status' => array( 'publish' ), |
|
367 | + 'post_type' => array('testimonial'), |
|
368 | + 'post_status' => array('publish'), |
|
369 | 369 | 'posts_per_page' => -1, |
370 | 370 | ), |
371 | 371 | ) |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | /** |
378 | 378 | * Sets up the "post relations". |
379 | 379 | */ |
380 | - public function post_relations( $post_id, $field, $value ) { |
|
380 | + public function post_relations($post_id, $field, $value) { |
|
381 | 381 | $connections = array( |
382 | 382 | 'team_to_testimonial', |
383 | 383 | 'testimonial_to_team', |
@@ -389,31 +389,31 @@ discard block |
||
389 | 389 | 'service_to_team', |
390 | 390 | ); |
391 | 391 | |
392 | - if ( in_array( $field['id'], $connections ) ) { |
|
393 | - $this->save_related_post( $connections, $post_id, $field, $value ); |
|
392 | + if (in_array($field['id'], $connections)) { |
|
393 | + $this->save_related_post($connections, $post_id, $field, $value); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Save the reverse post relation. |
399 | 399 | */ |
400 | - public function save_related_post( $connections, $post_id, $field, $value ) { |
|
401 | - $ids = explode( '_to_', $field['id'] ); |
|
402 | - $relation = $ids[1] . '_to_' . $ids[0]; |
|
400 | + public function save_related_post($connections, $post_id, $field, $value) { |
|
401 | + $ids = explode('_to_', $field['id']); |
|
402 | + $relation = $ids[1].'_to_'.$ids[0]; |
|
403 | 403 | |
404 | - if ( in_array( $relation, $connections ) ) { |
|
405 | - $previous_values = get_post_meta( $post_id, $field['id'], false ); |
|
404 | + if (in_array($relation, $connections)) { |
|
405 | + $previous_values = get_post_meta($post_id, $field['id'], false); |
|
406 | 406 | |
407 | - if ( ! empty( $previous_values ) ) { |
|
408 | - foreach ( $previous_values as $v ) { |
|
409 | - delete_post_meta( $v, $relation, $post_id ); |
|
407 | + if (!empty($previous_values)) { |
|
408 | + foreach ($previous_values as $v) { |
|
409 | + delete_post_meta($v, $relation, $post_id); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
413 | - if ( is_array( $value ) ) { |
|
414 | - foreach ( $value as $v ) { |
|
415 | - if ( ! empty( $v ) ) { |
|
416 | - add_post_meta( $v, $relation, $post_id ); |
|
413 | + if (is_array($value)) { |
|
414 | + foreach ($value as $v) { |
|
415 | + if (!empty($v)) { |
|
416 | + add_post_meta($v, $relation, $post_id); |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | } |
@@ -422,30 +422,30 @@ discard block |
||
422 | 422 | |
423 | 423 | public function assets() { |
424 | 424 | //wp_enqueue_media(); |
425 | - wp_enqueue_script( 'media-upload' ); |
|
426 | - wp_enqueue_script( 'thickbox' ); |
|
427 | - wp_enqueue_style( 'thickbox' ); |
|
425 | + wp_enqueue_script('media-upload'); |
|
426 | + wp_enqueue_script('thickbox'); |
|
427 | + wp_enqueue_style('thickbox'); |
|
428 | 428 | |
429 | - wp_enqueue_script( 'lsx-team-admin', LSX_TEAM_URL . 'assets/js/lsx-team-admin.min.js', array( 'jquery' ), LSX_TEAM_VER ); |
|
430 | - wp_enqueue_style( 'lsx-team-admin', LSX_TEAM_URL . 'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER ); |
|
429 | + wp_enqueue_script('lsx-team-admin', LSX_TEAM_URL.'assets/js/lsx-team-admin.min.js', array('jquery'), LSX_TEAM_VER); |
|
430 | + wp_enqueue_style('lsx-team-admin', LSX_TEAM_URL.'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
434 | 434 | * Change the "Insert into Post" button text when media modal is used for feature images |
435 | 435 | */ |
436 | - public function change_attachment_field_button( $html ) { |
|
437 | - if ( isset( $_GET['feature_image_text_button'] ) ) { |
|
438 | - $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-team' ) ), $html ); |
|
436 | + public function change_attachment_field_button($html) { |
|
437 | + if (isset($_GET['feature_image_text_button'])) { |
|
438 | + $html = str_replace('value="Insert into Post"', sprintf('value="%s"', esc_html__('Select featured image', 'lsx-team')), $html); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $html; |
442 | 442 | } |
443 | 443 | |
444 | - public function change_title_text( $title ) { |
|
444 | + public function change_title_text($title) { |
|
445 | 445 | $screen = get_current_screen(); |
446 | 446 | |
447 | - if ( 'team' === $screen->post_type ) { |
|
448 | - $title = esc_attr__( 'Enter team member name', 'lsx-team' ); |
|
447 | + if ('team' === $screen->post_type) { |
|
448 | + $title = esc_attr__('Enter team member name', 'lsx-team'); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | return $title; |
@@ -23,13 +23,13 @@ |
||
23 | 23 | <div class="row row-flex"> |
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) { |
|
27 | - the_post(); |
|
28 | - include( LSX_TEAM_PATH . '/templates/content-archive-team.php' ); |
|
29 | - } |
|
26 | + while ( have_posts() ) { |
|
27 | + the_post(); |
|
28 | + include( LSX_TEAM_PATH . '/templates/content-archive-team.php' ); |
|
29 | + } |
|
30 | 30 | |
31 | - include( LSX_TEAM_PATH . '/templates/content-archive-team-careers-cta.php' ); |
|
32 | - ?> |
|
31 | + include( LSX_TEAM_PATH . '/templates/content-archive-team-careers-cta.php' ); |
|
32 | + ?> |
|
33 | 33 | |
34 | 34 | </div> |
35 | 35 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
13 | 13 | |
14 | 14 | <?php lsx_content_before(); ?> |
15 | 15 | |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php lsx_content_top(); ?> |
19 | 19 | |
20 | - <?php if ( have_posts() ) : ?> |
|
20 | + <?php if (have_posts()) : ?> |
|
21 | 21 | |
22 | 22 | <div class="lsx-team-container"> |
23 | 23 | <div class="row row-flex"> |
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) { |
|
26 | + while (have_posts()) { |
|
27 | 27 | the_post(); |
28 | - include( LSX_TEAM_PATH . '/templates/content-archive-team.php' ); |
|
28 | + include(LSX_TEAM_PATH.'/templates/content-archive-team.php'); |
|
29 | 29 | } |
30 | 30 | |
31 | - include( LSX_TEAM_PATH . '/templates/content-archive-team-careers-cta.php' ); |
|
31 | + include(LSX_TEAM_PATH.'/templates/content-archive-team-careers-cta.php'); |
|
32 | 32 | ?> |
33 | 33 | |
34 | 34 | </div> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | <?php else : ?> |
40 | 40 | |
41 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
41 | + <?php get_template_part('partials/content', 'none'); ?> |
|
42 | 42 | |
43 | 43 | <?php endif; ?> |
44 | 44 |
@@ -36,9 +36,12 @@ |
||
36 | 36 | |
37 | 37 | <?php lsx_paging_nav(); ?> |
38 | 38 | |
39 | - <?php else : ?> |
|
39 | + <?php else { |
|
40 | + : ?> |
|
40 | 41 | |
41 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
42 | + <?php get_template_part( 'partials/content', 'none' ); |
|
43 | +} |
|
44 | +?> |
|
42 | 45 | |
43 | 46 | <?php endif; ?> |
44 | 47 |
@@ -13,172 +13,172 @@ discard block |
||
13 | 13 | |
14 | 14 | class LSX_Team_Frontend { |
15 | 15 | |
16 | - /** |
|
17 | - * Holds the previous role, so we know when to output a new title. |
|
18 | - */ |
|
19 | - var $previous_role = ''; |
|
20 | - |
|
21 | - |
|
22 | - public function __construct() { |
|
23 | - |
|
24 | - $this->options = team_get_options(); |
|
25 | - |
|
26 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
27 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
28 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
29 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
30 | - |
|
31 | - if ( ! empty( $this->options['display']['team_disable_single'] ) ) { |
|
32 | - add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
33 | - } |
|
34 | - |
|
35 | - if ( ! empty( $this->options['display']['group_by_role'] ) ) { |
|
36 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts_order_by_role' ) ); |
|
37 | - add_action( 'lsx_entry_before', array( $this, 'entry_before' ) ); |
|
38 | - } |
|
39 | - |
|
40 | - add_action( 'pre_get_posts', array( $this, 'disable_pagination_on_archive' ) ); |
|
41 | - |
|
42 | - if ( is_admin() ) { |
|
43 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
44 | - } |
|
45 | - |
|
46 | - add_filter( 'lsx_fonts_css', array( $this, 'customizer_fonts_handler' ), 15 ); |
|
47 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
48 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_single_title' ), 15 ); |
|
49 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
50 | - |
|
51 | - add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
52 | - add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
53 | - add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
54 | - |
|
55 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * Return an instance of this class. |
|
60 | - * |
|
61 | - * @since 1.0.0 |
|
62 | - * |
|
63 | - * @return object lsx_team\classes A single instance of this class. |
|
64 | - */ |
|
65 | - public static function get_instance() { |
|
66 | - // If the single instance hasn't been set, set it now. |
|
67 | - if ( null === self::$instance ) { |
|
68 | - self::$instance = new self(); |
|
69 | - } |
|
70 | - return self::$instance; |
|
71 | - } |
|
72 | - |
|
73 | - public function enqueue_scripts( $plugins ) { |
|
74 | - $has_slick = wp_script_is( 'slick', 'queue' ); |
|
75 | - |
|
76 | - if ( ! $has_slick ) { |
|
77 | - wp_enqueue_style( 'slick', LSX_TEAM_URL . 'assets/css/vendor/slick.css', array(), LSX_TEAM_VER, null ); |
|
78 | - wp_enqueue_script( 'slick', LSX_TEAM_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_TEAM_VER, true ); |
|
79 | - } |
|
80 | - |
|
81 | - wp_enqueue_script( 'lsx-team', LSX_TEAM_URL . 'assets/js/lsx-team.min.js', array( 'jquery', 'slick' ), LSX_TEAM_VER, true ); |
|
82 | - |
|
83 | - $params = apply_filters( 'lsx_team_js_params', array( |
|
84 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
85 | - )); |
|
86 | - |
|
87 | - wp_localize_script( 'lsx-team', 'lsx_team_params', $params ); |
|
88 | - |
|
89 | - wp_enqueue_style( 'lsx-team', LSX_TEAM_URL . 'assets/css/lsx-team.css', array(), LSX_TEAM_VER ); |
|
90 | - wp_style_add_data( 'lsx-team', 'rtl', 'replace' ); |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Allow data params for Slick slider addon. |
|
95 | - */ |
|
96 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
97 | - $allowedtags['div']['data-slick'] = true; |
|
98 | - return $allowedtags; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Single template. |
|
103 | - */ |
|
104 | - public function single_template_include( $template ) { |
|
105 | - if ( is_main_query() && is_singular( 'team' ) ) { |
|
106 | - if ( empty( locate_template( array( 'single-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/single-team.php' ) ) { |
|
107 | - $template = LSX_TEAM_PATH . 'templates/single-team.php'; |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - return $template; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Archive template. |
|
116 | - */ |
|
117 | - public function archive_template_include( $template ) { |
|
118 | - if ( is_main_query() && is_post_type_archive( 'team' ) ) { |
|
119 | - if ( empty( locate_template( array( 'archive-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/archive-team.php' ) ) { |
|
120 | - $template = LSX_TEAM_PATH . 'templates/archive-team.php'; |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - if ( is_tax( 'team_role' ) ) { |
|
125 | - if ( empty( locate_template( array( 'taxonomy-team_role.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/taxonomy-team_role.php' ) ) { |
|
126 | - $template = LSX_TEAM_PATH . 'templates/taxonomy-team_role.php'; |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - return $template; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Removes access to single team member posts. |
|
135 | - */ |
|
136 | - public function disable_single() { |
|
137 | - $queried_post_type = get_query_var( 'post_type' ); |
|
138 | - |
|
139 | - if ( is_single() && 'team' === $queried_post_type ) { |
|
140 | - wp_redirect( home_url(), 301 ); |
|
141 | - exit; |
|
142 | - } |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Disable pagination. |
|
147 | - */ |
|
148 | - public function disable_pagination_on_archive( $query ) { |
|
149 | - if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
|
150 | - $query->set( 'posts_per_page', -1 ); |
|
151 | - $query->set( 'no_found_rows', true ); |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Handle fonts that might be change by LSX Customiser. |
|
157 | - */ |
|
158 | - public function customizer_fonts_handler( $css_fonts ) { |
|
159 | - global $wp_filesystem; |
|
160 | - |
|
161 | - $css_fonts_file = LSX_TEAM_PATH . '/assets/css/lsx-team-fonts.css'; |
|
162 | - |
|
163 | - if ( file_exists( $css_fonts_file ) ) { |
|
164 | - if ( empty( $wp_filesystem ) ) { |
|
165 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
166 | - WP_Filesystem(); |
|
167 | - } |
|
168 | - |
|
169 | - if ( $wp_filesystem ) { |
|
170 | - $css_fonts .= $wp_filesystem->get_contents( $css_fonts_file ); |
|
171 | - } |
|
172 | - } |
|
173 | - |
|
174 | - return $css_fonts; |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * Handle body colours that might be change by LSX Customiser. |
|
179 | - */ |
|
180 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
181 | - $css .= ' |
|
16 | + /** |
|
17 | + * Holds the previous role, so we know when to output a new title. |
|
18 | + */ |
|
19 | + var $previous_role = ''; |
|
20 | + |
|
21 | + |
|
22 | + public function __construct() { |
|
23 | + |
|
24 | + $this->options = team_get_options(); |
|
25 | + |
|
26 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
27 | + add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
28 | + add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
29 | + add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
30 | + |
|
31 | + if ( ! empty( $this->options['display']['team_disable_single'] ) ) { |
|
32 | + add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
33 | + } |
|
34 | + |
|
35 | + if ( ! empty( $this->options['display']['group_by_role'] ) ) { |
|
36 | + add_action( 'pre_get_posts', array( $this, 'pre_get_posts_order_by_role' ) ); |
|
37 | + add_action( 'lsx_entry_before', array( $this, 'entry_before' ) ); |
|
38 | + } |
|
39 | + |
|
40 | + add_action( 'pre_get_posts', array( $this, 'disable_pagination_on_archive' ) ); |
|
41 | + |
|
42 | + if ( is_admin() ) { |
|
43 | + add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
44 | + } |
|
45 | + |
|
46 | + add_filter( 'lsx_fonts_css', array( $this, 'customizer_fonts_handler' ), 15 ); |
|
47 | + add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
48 | + add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_single_title' ), 15 ); |
|
49 | + add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
50 | + |
|
51 | + add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
52 | + add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
53 | + add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
54 | + |
|
55 | + add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * Return an instance of this class. |
|
60 | + * |
|
61 | + * @since 1.0.0 |
|
62 | + * |
|
63 | + * @return object lsx_team\classes A single instance of this class. |
|
64 | + */ |
|
65 | + public static function get_instance() { |
|
66 | + // If the single instance hasn't been set, set it now. |
|
67 | + if ( null === self::$instance ) { |
|
68 | + self::$instance = new self(); |
|
69 | + } |
|
70 | + return self::$instance; |
|
71 | + } |
|
72 | + |
|
73 | + public function enqueue_scripts( $plugins ) { |
|
74 | + $has_slick = wp_script_is( 'slick', 'queue' ); |
|
75 | + |
|
76 | + if ( ! $has_slick ) { |
|
77 | + wp_enqueue_style( 'slick', LSX_TEAM_URL . 'assets/css/vendor/slick.css', array(), LSX_TEAM_VER, null ); |
|
78 | + wp_enqueue_script( 'slick', LSX_TEAM_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_TEAM_VER, true ); |
|
79 | + } |
|
80 | + |
|
81 | + wp_enqueue_script( 'lsx-team', LSX_TEAM_URL . 'assets/js/lsx-team.min.js', array( 'jquery', 'slick' ), LSX_TEAM_VER, true ); |
|
82 | + |
|
83 | + $params = apply_filters( 'lsx_team_js_params', array( |
|
84 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
85 | + )); |
|
86 | + |
|
87 | + wp_localize_script( 'lsx-team', 'lsx_team_params', $params ); |
|
88 | + |
|
89 | + wp_enqueue_style( 'lsx-team', LSX_TEAM_URL . 'assets/css/lsx-team.css', array(), LSX_TEAM_VER ); |
|
90 | + wp_style_add_data( 'lsx-team', 'rtl', 'replace' ); |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Allow data params for Slick slider addon. |
|
95 | + */ |
|
96 | + public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
97 | + $allowedtags['div']['data-slick'] = true; |
|
98 | + return $allowedtags; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Single template. |
|
103 | + */ |
|
104 | + public function single_template_include( $template ) { |
|
105 | + if ( is_main_query() && is_singular( 'team' ) ) { |
|
106 | + if ( empty( locate_template( array( 'single-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/single-team.php' ) ) { |
|
107 | + $template = LSX_TEAM_PATH . 'templates/single-team.php'; |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + return $template; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Archive template. |
|
116 | + */ |
|
117 | + public function archive_template_include( $template ) { |
|
118 | + if ( is_main_query() && is_post_type_archive( 'team' ) ) { |
|
119 | + if ( empty( locate_template( array( 'archive-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/archive-team.php' ) ) { |
|
120 | + $template = LSX_TEAM_PATH . 'templates/archive-team.php'; |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + if ( is_tax( 'team_role' ) ) { |
|
125 | + if ( empty( locate_template( array( 'taxonomy-team_role.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/taxonomy-team_role.php' ) ) { |
|
126 | + $template = LSX_TEAM_PATH . 'templates/taxonomy-team_role.php'; |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + return $template; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Removes access to single team member posts. |
|
135 | + */ |
|
136 | + public function disable_single() { |
|
137 | + $queried_post_type = get_query_var( 'post_type' ); |
|
138 | + |
|
139 | + if ( is_single() && 'team' === $queried_post_type ) { |
|
140 | + wp_redirect( home_url(), 301 ); |
|
141 | + exit; |
|
142 | + } |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Disable pagination. |
|
147 | + */ |
|
148 | + public function disable_pagination_on_archive( $query ) { |
|
149 | + if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
|
150 | + $query->set( 'posts_per_page', -1 ); |
|
151 | + $query->set( 'no_found_rows', true ); |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Handle fonts that might be change by LSX Customiser. |
|
157 | + */ |
|
158 | + public function customizer_fonts_handler( $css_fonts ) { |
|
159 | + global $wp_filesystem; |
|
160 | + |
|
161 | + $css_fonts_file = LSX_TEAM_PATH . '/assets/css/lsx-team-fonts.css'; |
|
162 | + |
|
163 | + if ( file_exists( $css_fonts_file ) ) { |
|
164 | + if ( empty( $wp_filesystem ) ) { |
|
165 | + require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
166 | + WP_Filesystem(); |
|
167 | + } |
|
168 | + |
|
169 | + if ( $wp_filesystem ) { |
|
170 | + $css_fonts .= $wp_filesystem->get_contents( $css_fonts_file ); |
|
171 | + } |
|
172 | + } |
|
173 | + |
|
174 | + return $css_fonts; |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * Handle body colours that might be change by LSX Customiser. |
|
179 | + */ |
|
180 | + public function customizer_body_colours_handler( $css, $colors ) { |
|
181 | + $css .= ' |
|
182 | 182 | @import "' . LSX_TEAM_PATH . '/assets/css/scss/customizer-team-body-colours"; |
183 | 183 | |
184 | 184 | /** |
@@ -194,109 +194,109 @@ discard block |
||
194 | 194 | ); |
195 | 195 | '; |
196 | 196 | |
197 | - return $css; |
|
198 | - } |
|
199 | - |
|
200 | - /** |
|
201 | - * Change the LSX Banners title for team archive. |
|
202 | - */ |
|
203 | - public function lsx_banner_archive_title( $title ) { |
|
204 | - if ( is_main_query() && is_post_type_archive( 'team' ) ) { |
|
205 | - $title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>'; |
|
206 | - } |
|
207 | - |
|
208 | - return $title; |
|
209 | - } |
|
210 | - |
|
211 | - /** |
|
212 | - * Change the LSX Banners title for team single. |
|
213 | - */ |
|
214 | - public function lsx_banner_single_title( $title ) { |
|
215 | - if ( is_main_query() && is_singular( 'team' ) ) { |
|
216 | - $title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>'; |
|
217 | - } |
|
218 | - |
|
219 | - return $title; |
|
220 | - } |
|
221 | - |
|
222 | - /** |
|
223 | - * Remove the "Archives:" from the post type recipes. |
|
224 | - * |
|
225 | - * @param string $title the term title. |
|
226 | - * @return string |
|
227 | - */ |
|
228 | - public function get_the_archive_title( $title ) { |
|
229 | - if ( is_post_type_archive( 'team' ) ) { |
|
230 | - $title = __( 'Team', 'lsx-health-plan' ); |
|
231 | - } |
|
232 | - return $title; |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * Remove the "continue reading" when the single is disabled. |
|
237 | - */ |
|
238 | - public function change_excerpt_more( $excerpt_more ) { |
|
239 | - global $post; |
|
240 | - |
|
241 | - if ( 'team' === $post->post_type ) { |
|
242 | - if ( ! empty( team_get_option( 'team_disable_single' ) ) ) { |
|
243 | - $excerpt_more = ''; |
|
244 | - } |
|
245 | - } |
|
246 | - |
|
247 | - return $excerpt_more; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * Change the word count when crop the content to excerpt (single team relations). |
|
252 | - */ |
|
253 | - public function change_excerpt_length( $excerpt_word_count ) { |
|
254 | - global $post; |
|
255 | - |
|
256 | - if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
257 | - $excerpt_word_count = 20; |
|
258 | - } |
|
259 | - |
|
260 | - return $excerpt_word_count; |
|
261 | - } |
|
262 | - |
|
263 | - /** |
|
264 | - * Change the allowed tags crop the content to excerpt (single team relations). |
|
265 | - */ |
|
266 | - public function change_excerpt_strip_tags( $allowed_tags ) { |
|
267 | - global $post; |
|
268 | - |
|
269 | - if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
270 | - $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
271 | - } |
|
272 | - |
|
273 | - return $allowed_tags; |
|
274 | - } |
|
275 | - |
|
276 | - /** |
|
277 | - * @param $query \WP_Query() |
|
278 | - * |
|
279 | - * @return mixed |
|
280 | - */ |
|
281 | - public function pre_get_posts_order_by_role( $query ) { |
|
282 | - if ( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
|
283 | - $post_ids = $this->order_by_role_query(); |
|
284 | - if ( ! empty( $post_ids ) ) { |
|
285 | - $query->set( 'post__in', $post_ids ); |
|
286 | - $query->set( 'orderby', 'post__in' ); |
|
287 | - } |
|
288 | - } |
|
289 | - return $query; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * Grabs the team members ordered by the Roles Slug and the title alphabetical |
|
294 | - */ |
|
295 | - public function order_by_role_query() { |
|
296 | - global $wpdb; |
|
297 | - $post_ids = array(); |
|
298 | - |
|
299 | - $results = $wpdb->get_results( $wpdb->prepare(" |
|
197 | + return $css; |
|
198 | + } |
|
199 | + |
|
200 | + /** |
|
201 | + * Change the LSX Banners title for team archive. |
|
202 | + */ |
|
203 | + public function lsx_banner_archive_title( $title ) { |
|
204 | + if ( is_main_query() && is_post_type_archive( 'team' ) ) { |
|
205 | + $title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>'; |
|
206 | + } |
|
207 | + |
|
208 | + return $title; |
|
209 | + } |
|
210 | + |
|
211 | + /** |
|
212 | + * Change the LSX Banners title for team single. |
|
213 | + */ |
|
214 | + public function lsx_banner_single_title( $title ) { |
|
215 | + if ( is_main_query() && is_singular( 'team' ) ) { |
|
216 | + $title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>'; |
|
217 | + } |
|
218 | + |
|
219 | + return $title; |
|
220 | + } |
|
221 | + |
|
222 | + /** |
|
223 | + * Remove the "Archives:" from the post type recipes. |
|
224 | + * |
|
225 | + * @param string $title the term title. |
|
226 | + * @return string |
|
227 | + */ |
|
228 | + public function get_the_archive_title( $title ) { |
|
229 | + if ( is_post_type_archive( 'team' ) ) { |
|
230 | + $title = __( 'Team', 'lsx-health-plan' ); |
|
231 | + } |
|
232 | + return $title; |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * Remove the "continue reading" when the single is disabled. |
|
237 | + */ |
|
238 | + public function change_excerpt_more( $excerpt_more ) { |
|
239 | + global $post; |
|
240 | + |
|
241 | + if ( 'team' === $post->post_type ) { |
|
242 | + if ( ! empty( team_get_option( 'team_disable_single' ) ) ) { |
|
243 | + $excerpt_more = ''; |
|
244 | + } |
|
245 | + } |
|
246 | + |
|
247 | + return $excerpt_more; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * Change the word count when crop the content to excerpt (single team relations). |
|
252 | + */ |
|
253 | + public function change_excerpt_length( $excerpt_word_count ) { |
|
254 | + global $post; |
|
255 | + |
|
256 | + if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
257 | + $excerpt_word_count = 20; |
|
258 | + } |
|
259 | + |
|
260 | + return $excerpt_word_count; |
|
261 | + } |
|
262 | + |
|
263 | + /** |
|
264 | + * Change the allowed tags crop the content to excerpt (single team relations). |
|
265 | + */ |
|
266 | + public function change_excerpt_strip_tags( $allowed_tags ) { |
|
267 | + global $post; |
|
268 | + |
|
269 | + if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
270 | + $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
271 | + } |
|
272 | + |
|
273 | + return $allowed_tags; |
|
274 | + } |
|
275 | + |
|
276 | + /** |
|
277 | + * @param $query \WP_Query() |
|
278 | + * |
|
279 | + * @return mixed |
|
280 | + */ |
|
281 | + public function pre_get_posts_order_by_role( $query ) { |
|
282 | + if ( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
|
283 | + $post_ids = $this->order_by_role_query(); |
|
284 | + if ( ! empty( $post_ids ) ) { |
|
285 | + $query->set( 'post__in', $post_ids ); |
|
286 | + $query->set( 'orderby', 'post__in' ); |
|
287 | + } |
|
288 | + } |
|
289 | + return $query; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * Grabs the team members ordered by the Roles Slug and the title alphabetical |
|
294 | + */ |
|
295 | + public function order_by_role_query() { |
|
296 | + global $wpdb; |
|
297 | + $post_ids = array(); |
|
298 | + |
|
299 | + $results = $wpdb->get_results( $wpdb->prepare(" |
|
300 | 300 | SELECT posts.ID, posts.post_title, terms.slug |
301 | 301 | FROM {$wpdb->posts} AS posts |
302 | 302 | INNER JOIN {$wpdb->term_relationships} as rels |
@@ -311,43 +311,43 @@ discard block |
||
311 | 311 | ORDER BY terms.lsx_team_term_order, posts.post_name |
312 | 312 | ", 'team', 'publish', 'team_role' ) ); |
313 | 313 | |
314 | - if ( ! empty( $results ) ) { |
|
315 | - $post_ids = wp_list_pluck( $results, 'ID' ); |
|
316 | - } |
|
317 | - return $post_ids; |
|
318 | - } |
|
319 | - |
|
320 | - |
|
321 | - /** |
|
322 | - * Outputs the Role Title if its found |
|
323 | - */ |
|
324 | - public function entry_before() { |
|
325 | - if ( is_post_type_archive( 'team' ) ) { |
|
326 | - $all_roles = wc_get_object_terms( get_the_ID(), 'team_role' ); |
|
327 | - $this_role = ''; |
|
328 | - $this_role_id = ''; |
|
329 | - if ( ! empty( $all_roles ) ) { |
|
330 | - $this_role = $all_roles[0]; |
|
331 | - $this_role_id = $this_role->term_id; |
|
332 | - } |
|
333 | - |
|
334 | - if ( '' === $this->previous_role || $this->previous_role !== $this_role_id ) { |
|
335 | - echo '<h2 class="role-title text-center col-xs-12 col-sm-12 col-md-12">' . wp_kses_post( $this_role->name ) . '</h2>'; |
|
336 | - $this->previous_role = $this_role_id; |
|
337 | - } |
|
338 | - } |
|
339 | - } |
|
340 | - /** |
|
341 | - * Adds Pieces |
|
342 | - */ |
|
343 | - public function add_graph_pieces( $pieces, $context ) { |
|
344 | - // Scheme Class. |
|
345 | - if ( class_exists( 'LSX_Schema_Graph_Piece' ) ) { |
|
346 | - require_once LSX_TEAM_PATH . '/classes/class-lsx-team-schema.php'; |
|
347 | - $pieces[] = new \LSX_Team_Schema( $context ); |
|
348 | - } |
|
349 | - return $pieces; |
|
350 | - } |
|
314 | + if ( ! empty( $results ) ) { |
|
315 | + $post_ids = wp_list_pluck( $results, 'ID' ); |
|
316 | + } |
|
317 | + return $post_ids; |
|
318 | + } |
|
319 | + |
|
320 | + |
|
321 | + /** |
|
322 | + * Outputs the Role Title if its found |
|
323 | + */ |
|
324 | + public function entry_before() { |
|
325 | + if ( is_post_type_archive( 'team' ) ) { |
|
326 | + $all_roles = wc_get_object_terms( get_the_ID(), 'team_role' ); |
|
327 | + $this_role = ''; |
|
328 | + $this_role_id = ''; |
|
329 | + if ( ! empty( $all_roles ) ) { |
|
330 | + $this_role = $all_roles[0]; |
|
331 | + $this_role_id = $this_role->term_id; |
|
332 | + } |
|
333 | + |
|
334 | + if ( '' === $this->previous_role || $this->previous_role !== $this_role_id ) { |
|
335 | + echo '<h2 class="role-title text-center col-xs-12 col-sm-12 col-md-12">' . wp_kses_post( $this_role->name ) . '</h2>'; |
|
336 | + $this->previous_role = $this_role_id; |
|
337 | + } |
|
338 | + } |
|
339 | + } |
|
340 | + /** |
|
341 | + * Adds Pieces |
|
342 | + */ |
|
343 | + public function add_graph_pieces( $pieces, $context ) { |
|
344 | + // Scheme Class. |
|
345 | + if ( class_exists( 'LSX_Schema_Graph_Piece' ) ) { |
|
346 | + require_once LSX_TEAM_PATH . '/classes/class-lsx-team-schema.php'; |
|
347 | + $pieces[] = new \LSX_Team_Schema( $context ); |
|
348 | + } |
|
349 | + return $pieces; |
|
350 | + } |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $lsx_team_frontend = new LSX_Team_Frontend(); |
@@ -23,36 +23,36 @@ discard block |
||
23 | 23 | |
24 | 24 | $this->options = team_get_options(); |
25 | 25 | |
26 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
27 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
28 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
29 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
26 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5); |
|
27 | + add_filter('wp_kses_allowed_html', array($this, 'wp_kses_allowed_html'), 10, 2); |
|
28 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
29 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
30 | 30 | |
31 | - if ( ! empty( $this->options['display']['team_disable_single'] ) ) { |
|
32 | - add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
31 | + if (!empty($this->options['display']['team_disable_single'])) { |
|
32 | + add_action('template_redirect', array($this, 'disable_single')); |
|
33 | 33 | } |
34 | 34 | |
35 | - if ( ! empty( $this->options['display']['group_by_role'] ) ) { |
|
36 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts_order_by_role' ) ); |
|
37 | - add_action( 'lsx_entry_before', array( $this, 'entry_before' ) ); |
|
35 | + if (!empty($this->options['display']['group_by_role'])) { |
|
36 | + add_action('pre_get_posts', array($this, 'pre_get_posts_order_by_role')); |
|
37 | + add_action('lsx_entry_before', array($this, 'entry_before')); |
|
38 | 38 | } |
39 | 39 | |
40 | - add_action( 'pre_get_posts', array( $this, 'disable_pagination_on_archive' ) ); |
|
40 | + add_action('pre_get_posts', array($this, 'disable_pagination_on_archive')); |
|
41 | 41 | |
42 | - if ( is_admin() ) { |
|
43 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
42 | + if (is_admin()) { |
|
43 | + add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2); |
|
44 | 44 | } |
45 | 45 | |
46 | - add_filter( 'lsx_fonts_css', array( $this, 'customizer_fonts_handler' ), 15 ); |
|
47 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
48 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_single_title' ), 15 ); |
|
49 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
46 | + add_filter('lsx_fonts_css', array($this, 'customizer_fonts_handler'), 15); |
|
47 | + add_filter('lsx_banner_title', array($this, 'lsx_banner_archive_title'), 15); |
|
48 | + add_filter('lsx_banner_title', array($this, 'lsx_banner_single_title'), 15); |
|
49 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
50 | 50 | |
51 | - add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
52 | - add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
53 | - add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
51 | + add_filter('excerpt_more_p', array($this, 'change_excerpt_more')); |
|
52 | + add_filter('excerpt_length', array($this, 'change_excerpt_length')); |
|
53 | + add_filter('excerpt_strip_tags', array($this, 'change_excerpt_strip_tags')); |
|
54 | 54 | |
55 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
55 | + add_filter('wpseo_schema_graph_pieces', array($this, 'add_graph_pieces'), 11, 2); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -64,36 +64,36 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function get_instance() { |
66 | 66 | // If the single instance hasn't been set, set it now. |
67 | - if ( null === self::$instance ) { |
|
67 | + if (null === self::$instance) { |
|
68 | 68 | self::$instance = new self(); |
69 | 69 | } |
70 | 70 | return self::$instance; |
71 | 71 | } |
72 | 72 | |
73 | - public function enqueue_scripts( $plugins ) { |
|
74 | - $has_slick = wp_script_is( 'slick', 'queue' ); |
|
73 | + public function enqueue_scripts($plugins) { |
|
74 | + $has_slick = wp_script_is('slick', 'queue'); |
|
75 | 75 | |
76 | - if ( ! $has_slick ) { |
|
77 | - wp_enqueue_style( 'slick', LSX_TEAM_URL . 'assets/css/vendor/slick.css', array(), LSX_TEAM_VER, null ); |
|
78 | - wp_enqueue_script( 'slick', LSX_TEAM_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_TEAM_VER, true ); |
|
76 | + if (!$has_slick) { |
|
77 | + wp_enqueue_style('slick', LSX_TEAM_URL.'assets/css/vendor/slick.css', array(), LSX_TEAM_VER, null); |
|
78 | + wp_enqueue_script('slick', LSX_TEAM_URL.'assets/js/vendor/slick.min.js', array('jquery'), null, LSX_TEAM_VER, true); |
|
79 | 79 | } |
80 | 80 | |
81 | - wp_enqueue_script( 'lsx-team', LSX_TEAM_URL . 'assets/js/lsx-team.min.js', array( 'jquery', 'slick' ), LSX_TEAM_VER, true ); |
|
81 | + wp_enqueue_script('lsx-team', LSX_TEAM_URL.'assets/js/lsx-team.min.js', array('jquery', 'slick'), LSX_TEAM_VER, true); |
|
82 | 82 | |
83 | - $params = apply_filters( 'lsx_team_js_params', array( |
|
84 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
83 | + $params = apply_filters('lsx_team_js_params', array( |
|
84 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
85 | 85 | )); |
86 | 86 | |
87 | - wp_localize_script( 'lsx-team', 'lsx_team_params', $params ); |
|
87 | + wp_localize_script('lsx-team', 'lsx_team_params', $params); |
|
88 | 88 | |
89 | - wp_enqueue_style( 'lsx-team', LSX_TEAM_URL . 'assets/css/lsx-team.css', array(), LSX_TEAM_VER ); |
|
90 | - wp_style_add_data( 'lsx-team', 'rtl', 'replace' ); |
|
89 | + wp_enqueue_style('lsx-team', LSX_TEAM_URL.'assets/css/lsx-team.css', array(), LSX_TEAM_VER); |
|
90 | + wp_style_add_data('lsx-team', 'rtl', 'replace'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Allow data params for Slick slider addon. |
95 | 95 | */ |
96 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
96 | + public function wp_kses_allowed_html($allowedtags, $context) { |
|
97 | 97 | $allowedtags['div']['data-slick'] = true; |
98 | 98 | return $allowedtags; |
99 | 99 | } |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * Single template. |
103 | 103 | */ |
104 | - public function single_template_include( $template ) { |
|
105 | - if ( is_main_query() && is_singular( 'team' ) ) { |
|
106 | - if ( empty( locate_template( array( 'single-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/single-team.php' ) ) { |
|
107 | - $template = LSX_TEAM_PATH . 'templates/single-team.php'; |
|
104 | + public function single_template_include($template) { |
|
105 | + if (is_main_query() && is_singular('team')) { |
|
106 | + if (empty(locate_template(array('single-team.php'))) && file_exists(LSX_TEAM_PATH.'templates/single-team.php')) { |
|
107 | + $template = LSX_TEAM_PATH.'templates/single-team.php'; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * Archive template. |
116 | 116 | */ |
117 | - public function archive_template_include( $template ) { |
|
118 | - if ( is_main_query() && is_post_type_archive( 'team' ) ) { |
|
119 | - if ( empty( locate_template( array( 'archive-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/archive-team.php' ) ) { |
|
120 | - $template = LSX_TEAM_PATH . 'templates/archive-team.php'; |
|
117 | + public function archive_template_include($template) { |
|
118 | + if (is_main_query() && is_post_type_archive('team')) { |
|
119 | + if (empty(locate_template(array('archive-team.php'))) && file_exists(LSX_TEAM_PATH.'templates/archive-team.php')) { |
|
120 | + $template = LSX_TEAM_PATH.'templates/archive-team.php'; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - if ( is_tax( 'team_role' ) ) { |
|
125 | - if ( empty( locate_template( array( 'taxonomy-team_role.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/taxonomy-team_role.php' ) ) { |
|
126 | - $template = LSX_TEAM_PATH . 'templates/taxonomy-team_role.php'; |
|
124 | + if (is_tax('team_role')) { |
|
125 | + if (empty(locate_template(array('taxonomy-team_role.php'))) && file_exists(LSX_TEAM_PATH.'templates/taxonomy-team_role.php')) { |
|
126 | + $template = LSX_TEAM_PATH.'templates/taxonomy-team_role.php'; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * Removes access to single team member posts. |
135 | 135 | */ |
136 | 136 | public function disable_single() { |
137 | - $queried_post_type = get_query_var( 'post_type' ); |
|
137 | + $queried_post_type = get_query_var('post_type'); |
|
138 | 138 | |
139 | - if ( is_single() && 'team' === $queried_post_type ) { |
|
140 | - wp_redirect( home_url(), 301 ); |
|
139 | + if (is_single() && 'team' === $queried_post_type) { |
|
140 | + wp_redirect(home_url(), 301); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -145,29 +145,29 @@ discard block |
||
145 | 145 | /** |
146 | 146 | * Disable pagination. |
147 | 147 | */ |
148 | - public function disable_pagination_on_archive( $query ) { |
|
149 | - if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
|
150 | - $query->set( 'posts_per_page', -1 ); |
|
151 | - $query->set( 'no_found_rows', true ); |
|
148 | + public function disable_pagination_on_archive($query) { |
|
149 | + if ($query->is_main_query() && $query->is_post_type_archive('team')) { |
|
150 | + $query->set('posts_per_page', -1); |
|
151 | + $query->set('no_found_rows', true); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Handle fonts that might be change by LSX Customiser. |
157 | 157 | */ |
158 | - public function customizer_fonts_handler( $css_fonts ) { |
|
158 | + public function customizer_fonts_handler($css_fonts) { |
|
159 | 159 | global $wp_filesystem; |
160 | 160 | |
161 | - $css_fonts_file = LSX_TEAM_PATH . '/assets/css/lsx-team-fonts.css'; |
|
161 | + $css_fonts_file = LSX_TEAM_PATH.'/assets/css/lsx-team-fonts.css'; |
|
162 | 162 | |
163 | - if ( file_exists( $css_fonts_file ) ) { |
|
164 | - if ( empty( $wp_filesystem ) ) { |
|
165 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
163 | + if (file_exists($css_fonts_file)) { |
|
164 | + if (empty($wp_filesystem)) { |
|
165 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
166 | 166 | WP_Filesystem(); |
167 | 167 | } |
168 | 168 | |
169 | - if ( $wp_filesystem ) { |
|
170 | - $css_fonts .= $wp_filesystem->get_contents( $css_fonts_file ); |
|
169 | + if ($wp_filesystem) { |
|
170 | + $css_fonts .= $wp_filesystem->get_contents($css_fonts_file); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -177,20 +177,20 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Handle body colours that might be change by LSX Customiser. |
179 | 179 | */ |
180 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
180 | + public function customizer_body_colours_handler($css, $colors) { |
|
181 | 181 | $css .= ' |
182 | - @import "' . LSX_TEAM_PATH . '/assets/css/scss/customizer-team-body-colours"; |
|
182 | + @import "' . LSX_TEAM_PATH.'/assets/css/scss/customizer-team-body-colours"; |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * LSX Customizer - Body (LSX Team) |
186 | 186 | */ |
187 | 187 | @include customizer-team-body-colours ( |
188 | - $bg: ' . $colors['background_color'] . ', |
|
189 | - $breaker: ' . $colors['body_line_color'] . ', |
|
190 | - $color: ' . $colors['body_text_color'] . ', |
|
191 | - $link: ' . $colors['body_link_color'] . ', |
|
192 | - $hover: ' . $colors['body_link_hover_color'] . ', |
|
193 | - $small: ' . $colors['body_text_small_color'] . ' |
|
188 | + $bg: ' . $colors['background_color'].', |
|
189 | + $breaker: ' . $colors['body_line_color'].', |
|
190 | + $color: ' . $colors['body_text_color'].', |
|
191 | + $link: ' . $colors['body_link_color'].', |
|
192 | + $hover: ' . $colors['body_link_hover_color'].', |
|
193 | + $small: ' . $colors['body_text_small_color'].' |
|
194 | 194 | ); |
195 | 195 | '; |
196 | 196 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | /** |
201 | 201 | * Change the LSX Banners title for team archive. |
202 | 202 | */ |
203 | - public function lsx_banner_archive_title( $title ) { |
|
204 | - if ( is_main_query() && is_post_type_archive( 'team' ) ) { |
|
205 | - $title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>'; |
|
203 | + public function lsx_banner_archive_title($title) { |
|
204 | + if (is_main_query() && is_post_type_archive('team')) { |
|
205 | + $title = '<h1 class="page-title">'.esc_html__('Team', 'lsx-team').'</h1>'; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return $title; |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | /** |
212 | 212 | * Change the LSX Banners title for team single. |
213 | 213 | */ |
214 | - public function lsx_banner_single_title( $title ) { |
|
215 | - if ( is_main_query() && is_singular( 'team' ) ) { |
|
216 | - $title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>'; |
|
214 | + public function lsx_banner_single_title($title) { |
|
215 | + if (is_main_query() && is_singular('team')) { |
|
216 | + $title = '<h1 class="page-title">'.esc_html__('Team', 'lsx-team').'</h1>'; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return $title; |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | * @param string $title the term title. |
226 | 226 | * @return string |
227 | 227 | */ |
228 | - public function get_the_archive_title( $title ) { |
|
229 | - if ( is_post_type_archive( 'team' ) ) { |
|
230 | - $title = __( 'Team', 'lsx-health-plan' ); |
|
228 | + public function get_the_archive_title($title) { |
|
229 | + if (is_post_type_archive('team')) { |
|
230 | + $title = __('Team', 'lsx-health-plan'); |
|
231 | 231 | } |
232 | 232 | return $title; |
233 | 233 | } |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | /** |
236 | 236 | * Remove the "continue reading" when the single is disabled. |
237 | 237 | */ |
238 | - public function change_excerpt_more( $excerpt_more ) { |
|
238 | + public function change_excerpt_more($excerpt_more) { |
|
239 | 239 | global $post; |
240 | 240 | |
241 | - if ( 'team' === $post->post_type ) { |
|
242 | - if ( ! empty( team_get_option( 'team_disable_single' ) ) ) { |
|
241 | + if ('team' === $post->post_type) { |
|
242 | + if (!empty(team_get_option('team_disable_single'))) { |
|
243 | 243 | $excerpt_more = ''; |
244 | 244 | } |
245 | 245 | } |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | /** |
251 | 251 | * Change the word count when crop the content to excerpt (single team relations). |
252 | 252 | */ |
253 | - public function change_excerpt_length( $excerpt_word_count ) { |
|
253 | + public function change_excerpt_length($excerpt_word_count) { |
|
254 | 254 | global $post; |
255 | 255 | |
256 | - if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
256 | + if (is_singular('team') && ('project' === $post->post_type || 'testimonial' === $post->post_type)) { |
|
257 | 257 | $excerpt_word_count = 20; |
258 | 258 | } |
259 | 259 | |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | /** |
264 | 264 | * Change the allowed tags crop the content to excerpt (single team relations). |
265 | 265 | */ |
266 | - public function change_excerpt_strip_tags( $allowed_tags ) { |
|
266 | + public function change_excerpt_strip_tags($allowed_tags) { |
|
267 | 267 | global $post; |
268 | 268 | |
269 | - if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
269 | + if (is_singular('team') && ('project' === $post->post_type || 'testimonial' === $post->post_type)) { |
|
270 | 270 | $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
271 | 271 | } |
272 | 272 | |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return mixed |
280 | 280 | */ |
281 | - public function pre_get_posts_order_by_role( $query ) { |
|
282 | - if ( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { |
|
281 | + public function pre_get_posts_order_by_role($query) { |
|
282 | + if (!is_admin() && $query->is_main_query() && $query->is_post_type_archive('team')) { |
|
283 | 283 | $post_ids = $this->order_by_role_query(); |
284 | - if ( ! empty( $post_ids ) ) { |
|
285 | - $query->set( 'post__in', $post_ids ); |
|
286 | - $query->set( 'orderby', 'post__in' ); |
|
284 | + if (!empty($post_ids)) { |
|
285 | + $query->set('post__in', $post_ids); |
|
286 | + $query->set('orderby', 'post__in'); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | return $query; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | global $wpdb; |
297 | 297 | $post_ids = array(); |
298 | 298 | |
299 | - $results = $wpdb->get_results( $wpdb->prepare(" |
|
299 | + $results = $wpdb->get_results($wpdb->prepare(" |
|
300 | 300 | SELECT posts.ID, posts.post_title, terms.slug |
301 | 301 | FROM {$wpdb->posts} AS posts |
302 | 302 | INNER JOIN {$wpdb->term_relationships} as rels |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | AND tax.taxonomy = '%s' |
310 | 310 | AND tax.term_id = terms.term_id |
311 | 311 | ORDER BY terms.lsx_team_term_order, posts.post_name |
312 | - ", 'team', 'publish', 'team_role' ) ); |
|
312 | + ", 'team', 'publish', 'team_role')); |
|
313 | 313 | |
314 | - if ( ! empty( $results ) ) { |
|
315 | - $post_ids = wp_list_pluck( $results, 'ID' ); |
|
314 | + if (!empty($results)) { |
|
315 | + $post_ids = wp_list_pluck($results, 'ID'); |
|
316 | 316 | } |
317 | 317 | return $post_ids; |
318 | 318 | } |
@@ -322,17 +322,17 @@ discard block |
||
322 | 322 | * Outputs the Role Title if its found |
323 | 323 | */ |
324 | 324 | public function entry_before() { |
325 | - if ( is_post_type_archive( 'team' ) ) { |
|
326 | - $all_roles = wc_get_object_terms( get_the_ID(), 'team_role' ); |
|
325 | + if (is_post_type_archive('team')) { |
|
326 | + $all_roles = wc_get_object_terms(get_the_ID(), 'team_role'); |
|
327 | 327 | $this_role = ''; |
328 | 328 | $this_role_id = ''; |
329 | - if ( ! empty( $all_roles ) ) { |
|
329 | + if (!empty($all_roles)) { |
|
330 | 330 | $this_role = $all_roles[0]; |
331 | 331 | $this_role_id = $this_role->term_id; |
332 | 332 | } |
333 | 333 | |
334 | - if ( '' === $this->previous_role || $this->previous_role !== $this_role_id ) { |
|
335 | - echo '<h2 class="role-title text-center col-xs-12 col-sm-12 col-md-12">' . wp_kses_post( $this_role->name ) . '</h2>'; |
|
334 | + if ('' === $this->previous_role || $this->previous_role !== $this_role_id) { |
|
335 | + echo '<h2 class="role-title text-center col-xs-12 col-sm-12 col-md-12">'.wp_kses_post($this_role->name).'</h2>'; |
|
336 | 336 | $this->previous_role = $this_role_id; |
337 | 337 | } |
338 | 338 | } |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | /** |
341 | 341 | * Adds Pieces |
342 | 342 | */ |
343 | - public function add_graph_pieces( $pieces, $context ) { |
|
343 | + public function add_graph_pieces($pieces, $context) { |
|
344 | 344 | // Scheme Class. |
345 | - if ( class_exists( 'LSX_Schema_Graph_Piece' ) ) { |
|
346 | - require_once LSX_TEAM_PATH . '/classes/class-lsx-team-schema.php'; |
|
347 | - $pieces[] = new \LSX_Team_Schema( $context ); |
|
345 | + if (class_exists('LSX_Schema_Graph_Piece')) { |
|
346 | + require_once LSX_TEAM_PATH.'/classes/class-lsx-team-schema.php'; |
|
347 | + $pieces[] = new \LSX_Team_Schema($context); |
|
348 | 348 | } |
349 | 349 | return $pieces; |
350 | 350 | } |