@@ -5,137 +5,137 @@ |
||
5 | 5 | ?> |
6 | 6 | |
7 | 7 | <?php |
8 | - global $lsx_team; |
|
9 | - |
|
10 | - $thumbnail = $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-single' ); |
|
11 | - |
|
12 | - $job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true ); |
|
13 | - |
|
14 | - $links = array( |
|
15 | - 'facebook' => get_post_meta( get_the_ID(), 'lsx_facebook', true ), |
|
16 | - 'twitter' => get_post_meta( get_the_ID(), 'lsx_twitter', true ), |
|
17 | - 'linkedin' => get_post_meta( get_the_ID(), 'lsx_linkedin', true ), |
|
18 | - 'github' => get_post_meta( get_the_ID(), 'lsx_github', true ), |
|
19 | - 'wordpress' => get_post_meta( get_the_ID(), 'lsx_wordpress', true ), |
|
20 | - ); |
|
21 | - |
|
22 | - foreach ( $links as $service => $link ) { |
|
23 | - if ( empty( $link ) ) { |
|
24 | - unset( $links[ $service ] ); |
|
25 | - } |
|
26 | - } |
|
27 | - |
|
28 | - $email = get_post_meta( get_the_ID(), 'lsx_email_contact', true ); |
|
29 | - $phone = get_post_meta( get_the_ID(), 'lsx_tel', true ); |
|
30 | - $skype = get_post_meta( get_the_ID(), 'lsx_skype', true ); |
|
31 | - |
|
32 | - $phone_attr = $phone; |
|
33 | - $phone_attr = str_replace( ' ', '', $phone_attr ); |
|
34 | - $phone_attr = str_replace( '+', '', $phone_attr ); |
|
35 | - $phone_attr = str_replace( '(', '', $phone_attr ); |
|
36 | - $phone_attr = str_replace( ')', '', $phone_attr ); |
|
37 | - $phone_attr = str_replace( '.', '', $phone_attr ); |
|
38 | - |
|
39 | - // Tabs |
|
40 | - |
|
41 | - $tabs = array(); |
|
42 | - |
|
43 | - // Tab Posts |
|
44 | - |
|
45 | - $site_user = get_post_meta( get_the_ID(), 'lsx_site_user', true ); |
|
46 | - |
|
47 | - if ( ! empty( $site_user ) ) { |
|
48 | - if ( is_user_member_of_blog( $site_user ) ) { |
|
49 | - $user_posts = count_user_posts( $site_user, 'post' ); |
|
50 | - |
|
51 | - if ( $user_posts > 0 ) { |
|
52 | - $params = array( |
|
53 | - 'post_type' => 'post', |
|
54 | - 'author' => $site_user, |
|
55 | - 'posts_per_page' => 9, |
|
56 | - 'order' => 'DESC', |
|
57 | - 'orderby' => 'date', |
|
58 | - 'fields' => 'ids', |
|
59 | - 'tax_query' => array( |
|
60 | - array( |
|
61 | - 'taxonomy' => 'post_format', |
|
62 | - 'field' => 'slug', |
|
63 | - 'terms' => array( |
|
64 | - 'post-format-aside', |
|
65 | - 'post-format-audio', |
|
66 | - 'post-format-chat', |
|
67 | - 'post-format-gallery', |
|
68 | - 'post-format-image', |
|
69 | - 'post-format-link', |
|
70 | - 'post-format-quote', |
|
71 | - 'post-format-status', |
|
72 | - 'post-format-video', |
|
73 | - ), |
|
74 | - 'operator' => 'NOT IN', |
|
75 | - ), |
|
76 | - ), |
|
77 | - ); |
|
78 | - |
|
79 | - $posts_query = new \WP_Query( $params ); |
|
80 | - |
|
81 | - if ( $posts_query->have_posts() ) { |
|
82 | - $tab_post['post_type'] = 'post'; |
|
83 | - $tab_post['title'] = esc_html__( 'Posts', 'lsx-team' ); |
|
84 | - $tab_post['posts'] = $posts_query->posts; |
|
85 | - |
|
86 | - if ( ! empty( $tab_post['posts'] ) ) { |
|
87 | - $post_ids = join( ',', $tab_post['posts'] ); |
|
88 | - $tab_post['shortcode'] = '[lsx_posts columns="3" include="' . $post_ids . '"]'; |
|
89 | - $tabs[] = $tab_post; |
|
90 | - } |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - // Tab Projects |
|
97 | - |
|
98 | - $tab_project['post_type'] = 'project'; |
|
99 | - $tab_project['title'] = esc_html__( 'Projects', 'lsx-team' ); |
|
100 | - $tab_project['posts'] = get_post_meta( get_the_ID(), 'project_to_team', true ); |
|
101 | - |
|
102 | - if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
103 | - $post_ids = join( ',', $tab_project['posts'] ); |
|
104 | - $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
105 | - $tabs[] = $tab_project; |
|
106 | - } |
|
107 | - |
|
108 | - // Tab Services |
|
109 | - |
|
110 | - if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
111 | - $tab_service['post_type'] = 'service'; |
|
112 | - $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
113 | - $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
114 | - |
|
115 | - if ( ! empty( $tab_service['posts'] ) ) { |
|
116 | - $post_ids = join( ',', $tab_service['posts'] ); |
|
117 | - $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
118 | - $tabs[] = $tab_service; |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - // Tab Testimonials |
|
123 | - |
|
124 | - $tab_testimonial['post_type'] = 'testimonial'; |
|
125 | - $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
126 | - $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
127 | - |
|
128 | - if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
129 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
130 | - $columns = count( $tab_testimonial['posts'] ); |
|
131 | - } else { |
|
132 | - $columns = 2; |
|
133 | - } |
|
134 | - |
|
135 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
136 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
137 | - $tabs[] = $tab_testimonial; |
|
138 | - } |
|
8 | + global $lsx_team; |
|
9 | + |
|
10 | + $thumbnail = $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-single' ); |
|
11 | + |
|
12 | + $job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true ); |
|
13 | + |
|
14 | + $links = array( |
|
15 | + 'facebook' => get_post_meta( get_the_ID(), 'lsx_facebook', true ), |
|
16 | + 'twitter' => get_post_meta( get_the_ID(), 'lsx_twitter', true ), |
|
17 | + 'linkedin' => get_post_meta( get_the_ID(), 'lsx_linkedin', true ), |
|
18 | + 'github' => get_post_meta( get_the_ID(), 'lsx_github', true ), |
|
19 | + 'wordpress' => get_post_meta( get_the_ID(), 'lsx_wordpress', true ), |
|
20 | + ); |
|
21 | + |
|
22 | + foreach ( $links as $service => $link ) { |
|
23 | + if ( empty( $link ) ) { |
|
24 | + unset( $links[ $service ] ); |
|
25 | + } |
|
26 | + } |
|
27 | + |
|
28 | + $email = get_post_meta( get_the_ID(), 'lsx_email_contact', true ); |
|
29 | + $phone = get_post_meta( get_the_ID(), 'lsx_tel', true ); |
|
30 | + $skype = get_post_meta( get_the_ID(), 'lsx_skype', true ); |
|
31 | + |
|
32 | + $phone_attr = $phone; |
|
33 | + $phone_attr = str_replace( ' ', '', $phone_attr ); |
|
34 | + $phone_attr = str_replace( '+', '', $phone_attr ); |
|
35 | + $phone_attr = str_replace( '(', '', $phone_attr ); |
|
36 | + $phone_attr = str_replace( ')', '', $phone_attr ); |
|
37 | + $phone_attr = str_replace( '.', '', $phone_attr ); |
|
38 | + |
|
39 | + // Tabs |
|
40 | + |
|
41 | + $tabs = array(); |
|
42 | + |
|
43 | + // Tab Posts |
|
44 | + |
|
45 | + $site_user = get_post_meta( get_the_ID(), 'lsx_site_user', true ); |
|
46 | + |
|
47 | + if ( ! empty( $site_user ) ) { |
|
48 | + if ( is_user_member_of_blog( $site_user ) ) { |
|
49 | + $user_posts = count_user_posts( $site_user, 'post' ); |
|
50 | + |
|
51 | + if ( $user_posts > 0 ) { |
|
52 | + $params = array( |
|
53 | + 'post_type' => 'post', |
|
54 | + 'author' => $site_user, |
|
55 | + 'posts_per_page' => 9, |
|
56 | + 'order' => 'DESC', |
|
57 | + 'orderby' => 'date', |
|
58 | + 'fields' => 'ids', |
|
59 | + 'tax_query' => array( |
|
60 | + array( |
|
61 | + 'taxonomy' => 'post_format', |
|
62 | + 'field' => 'slug', |
|
63 | + 'terms' => array( |
|
64 | + 'post-format-aside', |
|
65 | + 'post-format-audio', |
|
66 | + 'post-format-chat', |
|
67 | + 'post-format-gallery', |
|
68 | + 'post-format-image', |
|
69 | + 'post-format-link', |
|
70 | + 'post-format-quote', |
|
71 | + 'post-format-status', |
|
72 | + 'post-format-video', |
|
73 | + ), |
|
74 | + 'operator' => 'NOT IN', |
|
75 | + ), |
|
76 | + ), |
|
77 | + ); |
|
78 | + |
|
79 | + $posts_query = new \WP_Query( $params ); |
|
80 | + |
|
81 | + if ( $posts_query->have_posts() ) { |
|
82 | + $tab_post['post_type'] = 'post'; |
|
83 | + $tab_post['title'] = esc_html__( 'Posts', 'lsx-team' ); |
|
84 | + $tab_post['posts'] = $posts_query->posts; |
|
85 | + |
|
86 | + if ( ! empty( $tab_post['posts'] ) ) { |
|
87 | + $post_ids = join( ',', $tab_post['posts'] ); |
|
88 | + $tab_post['shortcode'] = '[lsx_posts columns="3" include="' . $post_ids . '"]'; |
|
89 | + $tabs[] = $tab_post; |
|
90 | + } |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + // Tab Projects |
|
97 | + |
|
98 | + $tab_project['post_type'] = 'project'; |
|
99 | + $tab_project['title'] = esc_html__( 'Projects', 'lsx-team' ); |
|
100 | + $tab_project['posts'] = get_post_meta( get_the_ID(), 'project_to_team', true ); |
|
101 | + |
|
102 | + if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
103 | + $post_ids = join( ',', $tab_project['posts'] ); |
|
104 | + $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
105 | + $tabs[] = $tab_project; |
|
106 | + } |
|
107 | + |
|
108 | + // Tab Services |
|
109 | + |
|
110 | + if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
111 | + $tab_service['post_type'] = 'service'; |
|
112 | + $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
113 | + $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
114 | + |
|
115 | + if ( ! empty( $tab_service['posts'] ) ) { |
|
116 | + $post_ids = join( ',', $tab_service['posts'] ); |
|
117 | + $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
118 | + $tabs[] = $tab_service; |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + // Tab Testimonials |
|
123 | + |
|
124 | + $tab_testimonial['post_type'] = 'testimonial'; |
|
125 | + $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
126 | + $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
127 | + |
|
128 | + if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
129 | + if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
130 | + $columns = count( $tab_testimonial['posts'] ); |
|
131 | + } else { |
|
132 | + $columns = 2; |
|
133 | + } |
|
134 | + |
|
135 | + $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
136 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
137 | + $tabs[] = $tab_testimonial; |
|
138 | + } |
|
139 | 139 | ?> |
140 | 140 | |
141 | 141 | <?php lsx_entry_before(); ?> |
@@ -7,34 +7,34 @@ discard block |
||
7 | 7 | <?php |
8 | 8 | global $lsx_team; |
9 | 9 | |
10 | - $thumbnail = $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-single' ); |
|
10 | + $thumbnail = $lsx_team->get_thumbnail(get_the_ID(), 'lsx-team-single'); |
|
11 | 11 | |
12 | - $job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true ); |
|
12 | + $job_title = get_post_meta(get_the_ID(), 'lsx_job_title', true); |
|
13 | 13 | |
14 | 14 | $links = array( |
15 | - 'facebook' => get_post_meta( get_the_ID(), 'lsx_facebook', true ), |
|
16 | - 'twitter' => get_post_meta( get_the_ID(), 'lsx_twitter', true ), |
|
17 | - 'linkedin' => get_post_meta( get_the_ID(), 'lsx_linkedin', true ), |
|
18 | - 'github' => get_post_meta( get_the_ID(), 'lsx_github', true ), |
|
19 | - 'wordpress' => get_post_meta( get_the_ID(), 'lsx_wordpress', true ), |
|
15 | + 'facebook' => get_post_meta(get_the_ID(), 'lsx_facebook', true), |
|
16 | + 'twitter' => get_post_meta(get_the_ID(), 'lsx_twitter', true), |
|
17 | + 'linkedin' => get_post_meta(get_the_ID(), 'lsx_linkedin', true), |
|
18 | + 'github' => get_post_meta(get_the_ID(), 'lsx_github', true), |
|
19 | + 'wordpress' => get_post_meta(get_the_ID(), 'lsx_wordpress', true), |
|
20 | 20 | ); |
21 | 21 | |
22 | - foreach ( $links as $service => $link ) { |
|
23 | - if ( empty( $link ) ) { |
|
24 | - unset( $links[ $service ] ); |
|
22 | + foreach ($links as $service => $link) { |
|
23 | + if (empty($link)) { |
|
24 | + unset($links[$service]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | - $email = get_post_meta( get_the_ID(), 'lsx_email_contact', true ); |
|
29 | - $phone = get_post_meta( get_the_ID(), 'lsx_tel', true ); |
|
30 | - $skype = get_post_meta( get_the_ID(), 'lsx_skype', true ); |
|
28 | + $email = get_post_meta(get_the_ID(), 'lsx_email_contact', true); |
|
29 | + $phone = get_post_meta(get_the_ID(), 'lsx_tel', true); |
|
30 | + $skype = get_post_meta(get_the_ID(), 'lsx_skype', true); |
|
31 | 31 | |
32 | 32 | $phone_attr = $phone; |
33 | - $phone_attr = str_replace( ' ', '', $phone_attr ); |
|
34 | - $phone_attr = str_replace( '+', '', $phone_attr ); |
|
35 | - $phone_attr = str_replace( '(', '', $phone_attr ); |
|
36 | - $phone_attr = str_replace( ')', '', $phone_attr ); |
|
37 | - $phone_attr = str_replace( '.', '', $phone_attr ); |
|
33 | + $phone_attr = str_replace(' ', '', $phone_attr); |
|
34 | + $phone_attr = str_replace('+', '', $phone_attr); |
|
35 | + $phone_attr = str_replace('(', '', $phone_attr); |
|
36 | + $phone_attr = str_replace(')', '', $phone_attr); |
|
37 | + $phone_attr = str_replace('.', '', $phone_attr); |
|
38 | 38 | |
39 | 39 | // Tabs |
40 | 40 | |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | // Tab Posts |
44 | 44 | |
45 | - $site_user = get_post_meta( get_the_ID(), 'lsx_site_user', true ); |
|
45 | + $site_user = get_post_meta(get_the_ID(), 'lsx_site_user', true); |
|
46 | 46 | |
47 | - if ( ! empty( $site_user ) ) { |
|
48 | - if ( is_user_member_of_blog( $site_user ) ) { |
|
49 | - $user_posts = count_user_posts( $site_user, 'post' ); |
|
47 | + if (!empty($site_user)) { |
|
48 | + if (is_user_member_of_blog($site_user)) { |
|
49 | + $user_posts = count_user_posts($site_user, 'post'); |
|
50 | 50 | |
51 | - if ( $user_posts > 0 ) { |
|
51 | + if ($user_posts > 0) { |
|
52 | 52 | $params = array( |
53 | 53 | 'post_type' => 'post', |
54 | 54 | 'author' => $site_user, |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | ), |
77 | 77 | ); |
78 | 78 | |
79 | - $posts_query = new \WP_Query( $params ); |
|
79 | + $posts_query = new \WP_Query($params); |
|
80 | 80 | |
81 | - if ( $posts_query->have_posts() ) { |
|
81 | + if ($posts_query->have_posts()) { |
|
82 | 82 | $tab_post['post_type'] = 'post'; |
83 | - $tab_post['title'] = esc_html__( 'Posts', 'lsx-team' ); |
|
83 | + $tab_post['title'] = esc_html__('Posts', 'lsx-team'); |
|
84 | 84 | $tab_post['posts'] = $posts_query->posts; |
85 | 85 | |
86 | - if ( ! empty( $tab_post['posts'] ) ) { |
|
87 | - $post_ids = join( ',', $tab_post['posts'] ); |
|
88 | - $tab_post['shortcode'] = '[lsx_posts columns="3" include="' . $post_ids . '"]'; |
|
86 | + if (!empty($tab_post['posts'])) { |
|
87 | + $post_ids = join(',', $tab_post['posts']); |
|
88 | + $tab_post['shortcode'] = '[lsx_posts columns="3" include="'.$post_ids.'"]'; |
|
89 | 89 | $tabs[] = $tab_post; |
90 | 90 | } |
91 | 91 | } |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | // Tab Projects |
97 | 97 | |
98 | 98 | $tab_project['post_type'] = 'project'; |
99 | - $tab_project['title'] = esc_html__( 'Projects', 'lsx-team' ); |
|
100 | - $tab_project['posts'] = get_post_meta( get_the_ID(), 'project_to_team', true ); |
|
99 | + $tab_project['title'] = esc_html__('Projects', 'lsx-team'); |
|
100 | + $tab_project['posts'] = get_post_meta(get_the_ID(), 'project_to_team', true); |
|
101 | 101 | |
102 | - if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
103 | - $post_ids = join( ',', $tab_project['posts'] ); |
|
104 | - $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
102 | + if (is_plugin_active('lsx-projects/lsx-projects.php') && (!empty($tab_project['posts']))) { |
|
103 | + $post_ids = join(',', $tab_project['posts']); |
|
104 | + $tab_project['shortcode'] = '[lsx_projects columns="3" include="'.$post_ids.'"]'; |
|
105 | 105 | $tabs[] = $tab_project; |
106 | 106 | } |
107 | 107 | |
108 | 108 | // Tab Services |
109 | 109 | |
110 | - if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
110 | + if (is_plugin_active('lsx-services/lsx-services.php')) { |
|
111 | 111 | $tab_service['post_type'] = 'service'; |
112 | - $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
113 | - $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
112 | + $tab_service['title'] = esc_html__('Services', 'lsx-team'); |
|
113 | + $tab_service['posts'] = get_post_meta(get_the_ID(), 'service_to_team', true); |
|
114 | 114 | |
115 | - if ( ! empty( $tab_service['posts'] ) ) { |
|
116 | - $post_ids = join( ',', $tab_service['posts'] ); |
|
117 | - $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
115 | + if (!empty($tab_service['posts'])) { |
|
116 | + $post_ids = join(',', $tab_service['posts']); |
|
117 | + $tab_service['shortcode'] = '[lsx_services columns="3" include="'.$post_ids.'"]'; |
|
118 | 118 | $tabs[] = $tab_service; |
119 | 119 | } |
120 | 120 | } |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | // Tab Testimonials |
123 | 123 | |
124 | 124 | $tab_testimonial['post_type'] = 'testimonial'; |
125 | - $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
126 | - $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
125 | + $tab_testimonial['title'] = esc_html__('Testimonials', 'lsx-team'); |
|
126 | + $tab_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_team', true); |
|
127 | 127 | |
128 | - if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
129 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
130 | - $columns = count( $tab_testimonial['posts'] ); |
|
128 | + if (is_plugin_active('lsx-testimonials/lsx-testimonials.php') && (!empty($tab_testimonial['posts']))) { |
|
129 | + if (count($tab_testimonial['posts']) <= 2) { |
|
130 | + $columns = count($tab_testimonial['posts']); |
|
131 | 131 | } else { |
132 | 132 | $columns = 2; |
133 | 133 | } |
134 | 134 | |
135 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
136 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
135 | + $post_ids = join(',', $tab_testimonial['posts']); |
|
136 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="'.$columns.'" include="'.$post_ids.'" orderby="date" order="DESC" display="excerpt"]'; |
|
137 | 137 | $tabs[] = $tab_testimonial; |
138 | 138 | } |
139 | 139 | ?> |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | <div class="row"> |
148 | 148 | <div class="col-xs-12 col-sm-6 col-md-4"> |
149 | 149 | <figure class="lsx-team-avatar"> |
150 | - <?php echo wp_kses_post( $thumbnail ); ?> |
|
150 | + <?php echo wp_kses_post($thumbnail); ?> |
|
151 | 151 | </figure> |
152 | 152 | |
153 | - <?php if ( count( $links ) > 0 ) : ?> |
|
154 | - <span class="lsx-team-socials-header"><?php echo esc_html__( 'Follow', 'lsx-team' ) . ':'; ?></span> |
|
153 | + <?php if (count($links) > 0) : ?> |
|
154 | + <span class="lsx-team-socials-header"><?php echo esc_html__('Follow', 'lsx-team').':'; ?></span> |
|
155 | 155 | |
156 | 156 | <ul class="lsx-team-socials list-inline"> |
157 | - <?php foreach ( $links as $service => $link ) : ?> |
|
158 | - <li><a href="<?php echo esc_html( $link ); ?>" target="_blank" rel="nofollow noreferrer noopener"><i class="fa fa-<?php echo esc_html( $service ); ?>" aria-hidden="true"></i></a></li> |
|
157 | + <?php foreach ($links as $service => $link) : ?> |
|
158 | + <li><a href="<?php echo esc_html($link); ?>" target="_blank" rel="nofollow noreferrer noopener"><i class="fa fa-<?php echo esc_html($service); ?>" aria-hidden="true"></i></a></li> |
|
159 | 159 | <?php endforeach; ?> |
160 | 160 | </ul> |
161 | 161 | <?php endif; ?> |
@@ -163,39 +163,39 @@ discard block |
||
163 | 163 | |
164 | 164 | <div class="col-xs-12 col-sm-6 col-md-8"> |
165 | 165 | <h2 class="lsx-team-name"><?php the_title(); ?></h2> |
166 | - <h5 class="lsx-team-job-title"><?php echo esc_html( $job_title ); ?></h5> |
|
166 | + <h5 class="lsx-team-job-title"><?php echo esc_html($job_title); ?></h5> |
|
167 | 167 | <div class="lsx-team-content"><?php the_content(); ?></div> |
168 | 168 | |
169 | - <?php if ( ! empty( $email ) || ! empty( $phone ) || ! empty( $skype ) ) : ?> |
|
169 | + <?php if (!empty($email) || !empty($phone) || !empty($skype)) : ?> |
|
170 | 170 | <ul class="lsx-team-contact list-inline"> |
171 | - <?php if ( ! empty( $email ) ) : ?> |
|
172 | - <li><a href="mailto:<?php echo esc_attr( $email ); ?>"><i class="fa fa-envelope-o" aria-hidden="true"></i> <?php echo esc_attr( $email ); ?></a></li> |
|
171 | + <?php if (!empty($email)) : ?> |
|
172 | + <li><a href="mailto:<?php echo esc_attr($email); ?>"><i class="fa fa-envelope-o" aria-hidden="true"></i> <?php echo esc_attr($email); ?></a></li> |
|
173 | 173 | <?php endif; ?> |
174 | 174 | |
175 | - <?php if ( ! empty( $phone ) ) : ?> |
|
176 | - <li><a href="tel:<?php echo esc_attr( $phone_attr ); ?>"><i class="fa fa-phone" aria-hidden="true"></i> <?php echo esc_attr( $phone ); ?></a></li> |
|
175 | + <?php if (!empty($phone)) : ?> |
|
176 | + <li><a href="tel:<?php echo esc_attr($phone_attr); ?>"><i class="fa fa-phone" aria-hidden="true"></i> <?php echo esc_attr($phone); ?></a></li> |
|
177 | 177 | <?php endif; ?> |
178 | 178 | |
179 | - <?php if ( ! empty( $skype ) ) : ?> |
|
180 | - <li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr( $skype ); ?></li> |
|
179 | + <?php if (!empty($skype)) : ?> |
|
180 | + <li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr($skype); ?></li> |
|
181 | 181 | <?php endif; ?> |
182 | 182 | </ul> |
183 | 183 | <?php endif; ?> |
184 | 184 | </div> |
185 | 185 | </div> |
186 | 186 | |
187 | - <?php if ( count( $tabs ) > 0 ) : ?> |
|
187 | + <?php if (count($tabs) > 0) : ?> |
|
188 | 188 | <div class="entry-tabs"> |
189 | 189 | <ul class="nav nav-tabs"> |
190 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
191 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
190 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
191 | + <li<?php if (0 === $i) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr(sanitize_title($tab['title'])); ?>"><?php echo esc_html($tab['title']); ?></a></li> |
|
192 | 192 | <?php endforeach; ?> |
193 | 193 | </ul> |
194 | 194 | |
195 | 195 | <div class="tab-content"> |
196 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
197 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
198 | - <?php echo do_shortcode( $tab['shortcode'] ); ?> |
|
196 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
197 | + <div id="<?php echo esc_attr(sanitize_title($tab['title'])); ?>" class="tab-pane fade<?php if (0 === $i) echo ' in active'; ?>"> |
|
198 | + <?php echo do_shortcode($tab['shortcode']); ?> |
|
199 | 199 | </div> |
200 | 200 | <?php endforeach; ?> |
201 | 201 | </div> |
@@ -11,451 +11,451 @@ |
||
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 | - ), |
|
80 | - 'show_in_rest' => true, |
|
81 | - 'rest_base' => 'team', |
|
82 | - 'rest_controller_class' => 'WP_REST_Posts_Controller', |
|
83 | - ); |
|
84 | - |
|
85 | - register_post_type( 'team', $args ); |
|
86 | - } |
|
87 | - |
|
88 | - public function taxonomy_setup() { |
|
89 | - $labels = array( |
|
90 | - 'name' => esc_html_x( 'Roles', 'taxonomy general name', 'lsx-team' ), |
|
91 | - 'singular_name' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
92 | - 'search_items' => esc_html__( 'Search Roles', 'lsx-team' ), |
|
93 | - 'all_items' => esc_html__( 'All Roles', 'lsx-team' ), |
|
94 | - 'parent_item' => esc_html__( 'Parent Role', 'lsx-team' ), |
|
95 | - 'parent_item_colon' => esc_html__( 'Parent Role:', 'lsx-team' ), |
|
96 | - 'edit_item' => esc_html__( 'Edit Role', 'lsx-team' ), |
|
97 | - 'update_item' => esc_html__( 'Update Role', 'lsx-team' ), |
|
98 | - 'add_new_item' => esc_html__( 'Add New Role', 'lsx-team' ), |
|
99 | - 'new_item_name' => esc_html__( 'New Role Name', 'lsx-team' ), |
|
100 | - 'menu_name' => esc_html__( 'Roles', 'lsx-team' ), |
|
101 | - ); |
|
102 | - |
|
103 | - $args = array( |
|
104 | - 'hierarchical' => true, |
|
105 | - 'labels' => $labels, |
|
106 | - 'show_ui' => true, |
|
107 | - 'show_admin_column' => true, |
|
108 | - 'query_var' => true, |
|
109 | - 'rewrite' => array( |
|
110 | - 'slug' => 'team-role', |
|
111 | - ), |
|
112 | - 'show_in_rest' => true, |
|
113 | - 'rest_base' => 'teamrole', |
|
114 | - 'rest_controller_class' => 'WP_REST_Terms_Controller', |
|
115 | - ); |
|
116 | - |
|
117 | - register_taxonomy( 'team_role', array( 'team' ), $args ); |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * Define the metabox and field configurations. |
|
122 | - */ |
|
123 | - public function details_metabox() { |
|
124 | - |
|
125 | - $prefix = 'lsx_'; |
|
126 | - |
|
127 | - $users = get_transient( 'lsx_team_users' ); |
|
128 | - |
|
129 | - if ( false === $users || '' === $users ) { |
|
130 | - $users = get_users( array( |
|
131 | - 'role__in' => array( 'administrator', 'editor', 'author' ), |
|
132 | - ) ); |
|
133 | - set_transient( 'lsx_team_users', $users, 5 * 60 ); |
|
134 | - } |
|
135 | - |
|
136 | - foreach ( $users as $user ) { |
|
137 | - $user_array[] = array( |
|
138 | - 'name' => $user->nice_name, |
|
139 | - 'value' => $user->ID, |
|
140 | - ); |
|
141 | - } |
|
142 | - |
|
143 | - $cmb = new_cmb2_box( |
|
144 | - array( |
|
145 | - 'id' => $prefix . '_team', |
|
146 | - 'title' => esc_html__( 'Team Member Details', 'lsx-team' ), |
|
147 | - 'object_types' => 'team', |
|
148 | - 'context' => 'normal', |
|
149 | - 'priority' => 'low', |
|
150 | - 'show_names' => true, |
|
151 | - ) |
|
152 | - ); |
|
153 | - |
|
154 | - $cmb->add_field( |
|
155 | - array( |
|
156 | - 'name' => esc_html__( 'Featured:', 'lsx-team' ), |
|
157 | - 'id' => $prefix . 'featured', |
|
158 | - 'type' => 'checkbox', |
|
159 | - 'value' => 1, |
|
160 | - 'default' => 0, |
|
161 | - 'show_in_rest' => true, |
|
162 | - ) |
|
163 | - ); |
|
164 | - |
|
165 | - $cmb->add_field( |
|
166 | - array( |
|
167 | - 'name' => esc_html__( 'Site User', 'lsx-team' ), |
|
168 | - 'id' => $prefix . 'site_user', |
|
169 | - 'allow_none' => true, |
|
170 | - 'type' => 'select', |
|
171 | - 'options' => $user_array, |
|
172 | - 'show_in_rest' => true, |
|
173 | - ) |
|
174 | - ); |
|
175 | - |
|
176 | - $cmb->add_field( |
|
177 | - array( |
|
178 | - 'name' => esc_html__( 'Job Title:', 'lsx-team' ), |
|
179 | - 'id' => $prefix . 'job_title', |
|
180 | - 'type' => 'text', |
|
181 | - 'show_in_rest' => true, |
|
182 | - ) |
|
183 | - ); |
|
184 | - |
|
185 | - $cmb->add_field( |
|
186 | - array( |
|
187 | - 'name' => esc_html__( 'Location:', 'lsx-team' ), |
|
188 | - 'id' => $prefix . 'location', |
|
189 | - 'type' => 'text', |
|
190 | - 'show_in_rest' => true, |
|
191 | - ) |
|
192 | - ); |
|
193 | - |
|
194 | - $cmb->add_field( |
|
195 | - array( |
|
196 | - 'name' => esc_html__( 'Contact Email Address:', 'lsx-team' ), |
|
197 | - 'id' => $prefix . 'email_contact', |
|
198 | - 'type' => 'text', |
|
199 | - 'show_in_rest' => true, |
|
200 | - ) |
|
201 | - ); |
|
202 | - |
|
203 | - $cmb->add_field( |
|
204 | - array( |
|
205 | - 'name' => esc_html__( 'Gravatar Email Address:', 'lsx-team' ), |
|
206 | - 'desc' => esc_html__( 'Used for Gravatar if a featured image is not set', 'lsx-team' ), |
|
207 | - 'id' => $prefix . 'email_gravatar', |
|
208 | - 'type' => 'text', |
|
209 | - 'show_in_rest' => true, |
|
210 | - ) |
|
211 | - ); |
|
212 | - |
|
213 | - $cmb->add_field( |
|
214 | - array( |
|
215 | - 'name' => esc_html__( 'Telephone Number:', 'lsx-team' ), |
|
216 | - 'id' => $prefix . 'tel', |
|
217 | - 'type' => 'text', |
|
218 | - 'show_in_rest' => true, |
|
219 | - ) |
|
220 | - ); |
|
221 | - |
|
222 | - $cmb->add_field( |
|
223 | - array( |
|
224 | - 'name' => esc_html__( 'Skype Name:', 'lsx-team' ), |
|
225 | - 'id' => $prefix . 'skype', |
|
226 | - 'type' => 'text', |
|
227 | - 'show_in_rest' => true, |
|
228 | - ) |
|
229 | - ); |
|
230 | - |
|
231 | - $cmb->add_field( |
|
232 | - array( |
|
233 | - 'name' => esc_html__( 'Facebook URL', 'lsx-team' ), |
|
234 | - 'id' => $prefix . 'facebook', |
|
235 | - 'type' => 'text_url', |
|
236 | - 'show_in_rest' => true, |
|
237 | - ) |
|
238 | - ); |
|
239 | - |
|
240 | - $cmb->add_field( |
|
241 | - array( |
|
242 | - 'name' => esc_html__( 'Twitter URL', 'lsx-team' ), |
|
243 | - 'id' => $prefix . 'twitter', |
|
244 | - 'type' => 'text_url', |
|
245 | - 'show_in_rest' => true, |
|
246 | - ) |
|
247 | - ); |
|
248 | - |
|
249 | - $cmb->add_field( |
|
250 | - array( |
|
251 | - 'name' => esc_html__( 'LinkedIn URL', 'lsx-team' ), |
|
252 | - 'id' => $prefix . 'linkedin', |
|
253 | - 'type' => 'text_url', |
|
254 | - 'show_in_rest' => true, |
|
255 | - ) |
|
256 | - ); |
|
257 | - |
|
258 | - $cmb->add_field( |
|
259 | - array( |
|
260 | - 'name' => esc_html__( 'Github URL', 'lsx-team' ), |
|
261 | - 'id' => $prefix . 'github', |
|
262 | - 'type' => 'text_url', |
|
263 | - 'show_in_rest' => true, |
|
264 | - ) |
|
265 | - ); |
|
266 | - |
|
267 | - $cmb->add_field( |
|
268 | - array( |
|
269 | - 'name' => esc_html__( 'WordPress URL', 'lsx-team' ), |
|
270 | - 'id' => $prefix . 'wordpress', |
|
271 | - 'type' => 'text_url', |
|
272 | - 'show_in_rest' => true, |
|
273 | - ) |
|
274 | - ); |
|
275 | - } |
|
276 | - |
|
277 | - /** |
|
278 | - * Define the metabox and field configurations. |
|
279 | - */ |
|
280 | - public function projects_details_metabox() { |
|
281 | - |
|
282 | - if ( class_exists( 'LSX_Projects' ) ) { |
|
283 | - |
|
284 | - $prefix = 'lsx_'; |
|
285 | - |
|
286 | - $cmb = new_cmb2_box( |
|
287 | - array( |
|
288 | - 'id' => $prefix . '_team', |
|
289 | - 'context' => 'normal', |
|
290 | - 'priority' => 'low', |
|
291 | - 'show_names' => true, |
|
292 | - 'object_types' => array( 'team' ), |
|
293 | - ) |
|
294 | - ); |
|
295 | - $cmb->add_field( |
|
296 | - array( |
|
297 | - 'name' => __( 'Projects:', 'lsx-team' ), |
|
298 | - 'id' => 'project_to_team', |
|
299 | - 'type' => 'post_search_ajax', |
|
300 | - 'limit' => 15, |
|
301 | - 'sortable' => true, |
|
302 | - 'query_args' => array( |
|
303 | - 'post_type' => array( 'project' ), |
|
304 | - 'post_status' => array( 'publish' ), |
|
305 | - 'posts_per_page' => -1, |
|
306 | - ), |
|
307 | - ) |
|
308 | - ); |
|
309 | - } |
|
310 | - } |
|
311 | - |
|
312 | - /** |
|
313 | - * Define the metabox and field configurations. |
|
314 | - */ |
|
315 | - public function services_details_metabox() { |
|
316 | - |
|
317 | - if ( class_exists( 'LSX_Services' ) ) { |
|
318 | - |
|
319 | - $prefix = 'lsx_'; |
|
320 | - |
|
321 | - $cmb = new_cmb2_box( |
|
322 | - array( |
|
323 | - 'id' => $prefix . '_team', |
|
324 | - 'context' => 'normal', |
|
325 | - 'priority' => 'low', |
|
326 | - 'show_names' => true, |
|
327 | - 'object_types' => array( 'team' ), |
|
328 | - ) |
|
329 | - ); |
|
330 | - $cmb->add_field( |
|
331 | - array( |
|
332 | - 'name' => __( 'Services:', 'lsx-team' ), |
|
333 | - 'id' => 'service_to_team', |
|
334 | - 'type' => 'post_search_ajax', |
|
335 | - 'limit' => 15, |
|
336 | - 'sortable' => true, |
|
337 | - 'query_args' => array( |
|
338 | - 'post_type' => array( 'service' ), |
|
339 | - 'post_status' => array( 'publish' ), |
|
340 | - 'posts_per_page' => -1, |
|
341 | - ), |
|
342 | - ) |
|
343 | - ); |
|
344 | - } |
|
345 | - } |
|
346 | - |
|
347 | - /** |
|
348 | - * Define the metabox and field configurations. |
|
349 | - */ |
|
350 | - public function testimonials_details_metabox() { |
|
351 | - |
|
352 | - if ( class_exists( 'LSX_Testimonials' ) ) { |
|
353 | - |
|
354 | - $prefix = 'lsx_'; |
|
355 | - |
|
356 | - $cmb = new_cmb2_box( |
|
357 | - array( |
|
358 | - 'id' => $prefix . '_team', |
|
359 | - 'context' => 'normal', |
|
360 | - 'priority' => 'low', |
|
361 | - 'show_names' => true, |
|
362 | - 'object_types' => array( 'team' ), |
|
363 | - ) |
|
364 | - ); |
|
365 | - $cmb->add_field( |
|
366 | - array( |
|
367 | - 'name' => __( 'Testimonials:', 'lsx-team' ), |
|
368 | - 'id' => 'testimonial_to_team', |
|
369 | - 'type' => 'post_search_ajax', |
|
370 | - 'limit' => 15, |
|
371 | - 'sortable' => true, |
|
372 | - 'query_args' => array( |
|
373 | - 'post_type' => array( 'testimonial' ), |
|
374 | - 'post_status' => array( 'publish' ), |
|
375 | - 'posts_per_page' => -1, |
|
376 | - ), |
|
377 | - ) |
|
378 | - ); |
|
379 | - } |
|
380 | - |
|
381 | - } |
|
382 | - |
|
383 | - /** |
|
384 | - * Sets up the "post relations". |
|
385 | - */ |
|
386 | - public function post_relations( $post_id, $field, $value ) { |
|
387 | - $connections = array( |
|
388 | - 'team_to_testimonial', |
|
389 | - 'testimonial_to_team', |
|
390 | - |
|
391 | - 'team_to_project', |
|
392 | - 'project_to_team', |
|
393 | - |
|
394 | - 'team_to_service', |
|
395 | - 'service_to_team', |
|
396 | - ); |
|
397 | - |
|
398 | - if ( in_array( $field['id'], $connections ) ) { |
|
399 | - $this->save_related_post( $connections, $post_id, $field, $value ); |
|
400 | - } |
|
401 | - } |
|
402 | - |
|
403 | - /** |
|
404 | - * Save the reverse post relation. |
|
405 | - */ |
|
406 | - public function save_related_post( $connections, $post_id, $field, $value ) { |
|
407 | - $ids = explode( '_to_', $field['id'] ); |
|
408 | - $relation = $ids[1] . '_to_' . $ids[0]; |
|
409 | - |
|
410 | - if ( in_array( $relation, $connections ) ) { |
|
411 | - $previous_values = get_post_meta( $post_id, $field['id'], false ); |
|
412 | - |
|
413 | - if ( ! empty( $previous_values ) ) { |
|
414 | - foreach ( $previous_values as $v ) { |
|
415 | - delete_post_meta( $v, $relation, $post_id ); |
|
416 | - } |
|
417 | - } |
|
418 | - |
|
419 | - if ( is_array( $value ) ) { |
|
420 | - foreach ( $value as $v ) { |
|
421 | - if ( ! empty( $v ) ) { |
|
422 | - add_post_meta( $v, $relation, $post_id ); |
|
423 | - } |
|
424 | - } |
|
425 | - } |
|
426 | - } |
|
427 | - } |
|
428 | - |
|
429 | - public function assets() { |
|
430 | - //wp_enqueue_media(); |
|
431 | - wp_enqueue_script( 'media-upload' ); |
|
432 | - wp_enqueue_script( 'thickbox' ); |
|
433 | - wp_enqueue_style( 'thickbox' ); |
|
434 | - |
|
435 | - wp_enqueue_script( 'lsx-team-admin', LSX_TEAM_URL . 'assets/js/lsx-team-admin.min.js', array( 'jquery' ), LSX_TEAM_VER ); |
|
436 | - wp_enqueue_style( 'lsx-team-admin', LSX_TEAM_URL . 'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER ); |
|
437 | - } |
|
438 | - |
|
439 | - /** |
|
440 | - * Change the "Insert into Post" button text when media modal is used for feature images |
|
441 | - */ |
|
442 | - public function change_attachment_field_button( $html ) { |
|
443 | - if ( isset( $_GET['feature_image_text_button'] ) ) { |
|
444 | - $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-team' ) ), $html ); |
|
445 | - } |
|
446 | - |
|
447 | - return $html; |
|
448 | - } |
|
449 | - |
|
450 | - public function change_title_text( $title ) { |
|
451 | - $screen = get_current_screen(); |
|
452 | - |
|
453 | - if ( 'team' === $screen->post_type ) { |
|
454 | - $title = esc_attr__( 'Enter team member name', 'lsx-team' ); |
|
455 | - } |
|
456 | - |
|
457 | - return $title; |
|
458 | - } |
|
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 | + ), |
|
80 | + 'show_in_rest' => true, |
|
81 | + 'rest_base' => 'team', |
|
82 | + 'rest_controller_class' => 'WP_REST_Posts_Controller', |
|
83 | + ); |
|
84 | + |
|
85 | + register_post_type( 'team', $args ); |
|
86 | + } |
|
87 | + |
|
88 | + public function taxonomy_setup() { |
|
89 | + $labels = array( |
|
90 | + 'name' => esc_html_x( 'Roles', 'taxonomy general name', 'lsx-team' ), |
|
91 | + 'singular_name' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
92 | + 'search_items' => esc_html__( 'Search Roles', 'lsx-team' ), |
|
93 | + 'all_items' => esc_html__( 'All Roles', 'lsx-team' ), |
|
94 | + 'parent_item' => esc_html__( 'Parent Role', 'lsx-team' ), |
|
95 | + 'parent_item_colon' => esc_html__( 'Parent Role:', 'lsx-team' ), |
|
96 | + 'edit_item' => esc_html__( 'Edit Role', 'lsx-team' ), |
|
97 | + 'update_item' => esc_html__( 'Update Role', 'lsx-team' ), |
|
98 | + 'add_new_item' => esc_html__( 'Add New Role', 'lsx-team' ), |
|
99 | + 'new_item_name' => esc_html__( 'New Role Name', 'lsx-team' ), |
|
100 | + 'menu_name' => esc_html__( 'Roles', 'lsx-team' ), |
|
101 | + ); |
|
102 | + |
|
103 | + $args = array( |
|
104 | + 'hierarchical' => true, |
|
105 | + 'labels' => $labels, |
|
106 | + 'show_ui' => true, |
|
107 | + 'show_admin_column' => true, |
|
108 | + 'query_var' => true, |
|
109 | + 'rewrite' => array( |
|
110 | + 'slug' => 'team-role', |
|
111 | + ), |
|
112 | + 'show_in_rest' => true, |
|
113 | + 'rest_base' => 'teamrole', |
|
114 | + 'rest_controller_class' => 'WP_REST_Terms_Controller', |
|
115 | + ); |
|
116 | + |
|
117 | + register_taxonomy( 'team_role', array( 'team' ), $args ); |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * Define the metabox and field configurations. |
|
122 | + */ |
|
123 | + public function details_metabox() { |
|
124 | + |
|
125 | + $prefix = 'lsx_'; |
|
126 | + |
|
127 | + $users = get_transient( 'lsx_team_users' ); |
|
128 | + |
|
129 | + if ( false === $users || '' === $users ) { |
|
130 | + $users = get_users( array( |
|
131 | + 'role__in' => array( 'administrator', 'editor', 'author' ), |
|
132 | + ) ); |
|
133 | + set_transient( 'lsx_team_users', $users, 5 * 60 ); |
|
134 | + } |
|
135 | + |
|
136 | + foreach ( $users as $user ) { |
|
137 | + $user_array[] = array( |
|
138 | + 'name' => $user->nice_name, |
|
139 | + 'value' => $user->ID, |
|
140 | + ); |
|
141 | + } |
|
142 | + |
|
143 | + $cmb = new_cmb2_box( |
|
144 | + array( |
|
145 | + 'id' => $prefix . '_team', |
|
146 | + 'title' => esc_html__( 'Team Member Details', 'lsx-team' ), |
|
147 | + 'object_types' => 'team', |
|
148 | + 'context' => 'normal', |
|
149 | + 'priority' => 'low', |
|
150 | + 'show_names' => true, |
|
151 | + ) |
|
152 | + ); |
|
153 | + |
|
154 | + $cmb->add_field( |
|
155 | + array( |
|
156 | + 'name' => esc_html__( 'Featured:', 'lsx-team' ), |
|
157 | + 'id' => $prefix . 'featured', |
|
158 | + 'type' => 'checkbox', |
|
159 | + 'value' => 1, |
|
160 | + 'default' => 0, |
|
161 | + 'show_in_rest' => true, |
|
162 | + ) |
|
163 | + ); |
|
164 | + |
|
165 | + $cmb->add_field( |
|
166 | + array( |
|
167 | + 'name' => esc_html__( 'Site User', 'lsx-team' ), |
|
168 | + 'id' => $prefix . 'site_user', |
|
169 | + 'allow_none' => true, |
|
170 | + 'type' => 'select', |
|
171 | + 'options' => $user_array, |
|
172 | + 'show_in_rest' => true, |
|
173 | + ) |
|
174 | + ); |
|
175 | + |
|
176 | + $cmb->add_field( |
|
177 | + array( |
|
178 | + 'name' => esc_html__( 'Job Title:', 'lsx-team' ), |
|
179 | + 'id' => $prefix . 'job_title', |
|
180 | + 'type' => 'text', |
|
181 | + 'show_in_rest' => true, |
|
182 | + ) |
|
183 | + ); |
|
184 | + |
|
185 | + $cmb->add_field( |
|
186 | + array( |
|
187 | + 'name' => esc_html__( 'Location:', 'lsx-team' ), |
|
188 | + 'id' => $prefix . 'location', |
|
189 | + 'type' => 'text', |
|
190 | + 'show_in_rest' => true, |
|
191 | + ) |
|
192 | + ); |
|
193 | + |
|
194 | + $cmb->add_field( |
|
195 | + array( |
|
196 | + 'name' => esc_html__( 'Contact Email Address:', 'lsx-team' ), |
|
197 | + 'id' => $prefix . 'email_contact', |
|
198 | + 'type' => 'text', |
|
199 | + 'show_in_rest' => true, |
|
200 | + ) |
|
201 | + ); |
|
202 | + |
|
203 | + $cmb->add_field( |
|
204 | + array( |
|
205 | + 'name' => esc_html__( 'Gravatar Email Address:', 'lsx-team' ), |
|
206 | + 'desc' => esc_html__( 'Used for Gravatar if a featured image is not set', 'lsx-team' ), |
|
207 | + 'id' => $prefix . 'email_gravatar', |
|
208 | + 'type' => 'text', |
|
209 | + 'show_in_rest' => true, |
|
210 | + ) |
|
211 | + ); |
|
212 | + |
|
213 | + $cmb->add_field( |
|
214 | + array( |
|
215 | + 'name' => esc_html__( 'Telephone Number:', 'lsx-team' ), |
|
216 | + 'id' => $prefix . 'tel', |
|
217 | + 'type' => 'text', |
|
218 | + 'show_in_rest' => true, |
|
219 | + ) |
|
220 | + ); |
|
221 | + |
|
222 | + $cmb->add_field( |
|
223 | + array( |
|
224 | + 'name' => esc_html__( 'Skype Name:', 'lsx-team' ), |
|
225 | + 'id' => $prefix . 'skype', |
|
226 | + 'type' => 'text', |
|
227 | + 'show_in_rest' => true, |
|
228 | + ) |
|
229 | + ); |
|
230 | + |
|
231 | + $cmb->add_field( |
|
232 | + array( |
|
233 | + 'name' => esc_html__( 'Facebook URL', 'lsx-team' ), |
|
234 | + 'id' => $prefix . 'facebook', |
|
235 | + 'type' => 'text_url', |
|
236 | + 'show_in_rest' => true, |
|
237 | + ) |
|
238 | + ); |
|
239 | + |
|
240 | + $cmb->add_field( |
|
241 | + array( |
|
242 | + 'name' => esc_html__( 'Twitter URL', 'lsx-team' ), |
|
243 | + 'id' => $prefix . 'twitter', |
|
244 | + 'type' => 'text_url', |
|
245 | + 'show_in_rest' => true, |
|
246 | + ) |
|
247 | + ); |
|
248 | + |
|
249 | + $cmb->add_field( |
|
250 | + array( |
|
251 | + 'name' => esc_html__( 'LinkedIn URL', 'lsx-team' ), |
|
252 | + 'id' => $prefix . 'linkedin', |
|
253 | + 'type' => 'text_url', |
|
254 | + 'show_in_rest' => true, |
|
255 | + ) |
|
256 | + ); |
|
257 | + |
|
258 | + $cmb->add_field( |
|
259 | + array( |
|
260 | + 'name' => esc_html__( 'Github URL', 'lsx-team' ), |
|
261 | + 'id' => $prefix . 'github', |
|
262 | + 'type' => 'text_url', |
|
263 | + 'show_in_rest' => true, |
|
264 | + ) |
|
265 | + ); |
|
266 | + |
|
267 | + $cmb->add_field( |
|
268 | + array( |
|
269 | + 'name' => esc_html__( 'WordPress URL', 'lsx-team' ), |
|
270 | + 'id' => $prefix . 'wordpress', |
|
271 | + 'type' => 'text_url', |
|
272 | + 'show_in_rest' => true, |
|
273 | + ) |
|
274 | + ); |
|
275 | + } |
|
276 | + |
|
277 | + /** |
|
278 | + * Define the metabox and field configurations. |
|
279 | + */ |
|
280 | + public function projects_details_metabox() { |
|
281 | + |
|
282 | + if ( class_exists( 'LSX_Projects' ) ) { |
|
283 | + |
|
284 | + $prefix = 'lsx_'; |
|
285 | + |
|
286 | + $cmb = new_cmb2_box( |
|
287 | + array( |
|
288 | + 'id' => $prefix . '_team', |
|
289 | + 'context' => 'normal', |
|
290 | + 'priority' => 'low', |
|
291 | + 'show_names' => true, |
|
292 | + 'object_types' => array( 'team' ), |
|
293 | + ) |
|
294 | + ); |
|
295 | + $cmb->add_field( |
|
296 | + array( |
|
297 | + 'name' => __( 'Projects:', 'lsx-team' ), |
|
298 | + 'id' => 'project_to_team', |
|
299 | + 'type' => 'post_search_ajax', |
|
300 | + 'limit' => 15, |
|
301 | + 'sortable' => true, |
|
302 | + 'query_args' => array( |
|
303 | + 'post_type' => array( 'project' ), |
|
304 | + 'post_status' => array( 'publish' ), |
|
305 | + 'posts_per_page' => -1, |
|
306 | + ), |
|
307 | + ) |
|
308 | + ); |
|
309 | + } |
|
310 | + } |
|
311 | + |
|
312 | + /** |
|
313 | + * Define the metabox and field configurations. |
|
314 | + */ |
|
315 | + public function services_details_metabox() { |
|
316 | + |
|
317 | + if ( class_exists( 'LSX_Services' ) ) { |
|
318 | + |
|
319 | + $prefix = 'lsx_'; |
|
320 | + |
|
321 | + $cmb = new_cmb2_box( |
|
322 | + array( |
|
323 | + 'id' => $prefix . '_team', |
|
324 | + 'context' => 'normal', |
|
325 | + 'priority' => 'low', |
|
326 | + 'show_names' => true, |
|
327 | + 'object_types' => array( 'team' ), |
|
328 | + ) |
|
329 | + ); |
|
330 | + $cmb->add_field( |
|
331 | + array( |
|
332 | + 'name' => __( 'Services:', 'lsx-team' ), |
|
333 | + 'id' => 'service_to_team', |
|
334 | + 'type' => 'post_search_ajax', |
|
335 | + 'limit' => 15, |
|
336 | + 'sortable' => true, |
|
337 | + 'query_args' => array( |
|
338 | + 'post_type' => array( 'service' ), |
|
339 | + 'post_status' => array( 'publish' ), |
|
340 | + 'posts_per_page' => -1, |
|
341 | + ), |
|
342 | + ) |
|
343 | + ); |
|
344 | + } |
|
345 | + } |
|
346 | + |
|
347 | + /** |
|
348 | + * Define the metabox and field configurations. |
|
349 | + */ |
|
350 | + public function testimonials_details_metabox() { |
|
351 | + |
|
352 | + if ( class_exists( 'LSX_Testimonials' ) ) { |
|
353 | + |
|
354 | + $prefix = 'lsx_'; |
|
355 | + |
|
356 | + $cmb = new_cmb2_box( |
|
357 | + array( |
|
358 | + 'id' => $prefix . '_team', |
|
359 | + 'context' => 'normal', |
|
360 | + 'priority' => 'low', |
|
361 | + 'show_names' => true, |
|
362 | + 'object_types' => array( 'team' ), |
|
363 | + ) |
|
364 | + ); |
|
365 | + $cmb->add_field( |
|
366 | + array( |
|
367 | + 'name' => __( 'Testimonials:', 'lsx-team' ), |
|
368 | + 'id' => 'testimonial_to_team', |
|
369 | + 'type' => 'post_search_ajax', |
|
370 | + 'limit' => 15, |
|
371 | + 'sortable' => true, |
|
372 | + 'query_args' => array( |
|
373 | + 'post_type' => array( 'testimonial' ), |
|
374 | + 'post_status' => array( 'publish' ), |
|
375 | + 'posts_per_page' => -1, |
|
376 | + ), |
|
377 | + ) |
|
378 | + ); |
|
379 | + } |
|
380 | + |
|
381 | + } |
|
382 | + |
|
383 | + /** |
|
384 | + * Sets up the "post relations". |
|
385 | + */ |
|
386 | + public function post_relations( $post_id, $field, $value ) { |
|
387 | + $connections = array( |
|
388 | + 'team_to_testimonial', |
|
389 | + 'testimonial_to_team', |
|
390 | + |
|
391 | + 'team_to_project', |
|
392 | + 'project_to_team', |
|
393 | + |
|
394 | + 'team_to_service', |
|
395 | + 'service_to_team', |
|
396 | + ); |
|
397 | + |
|
398 | + if ( in_array( $field['id'], $connections ) ) { |
|
399 | + $this->save_related_post( $connections, $post_id, $field, $value ); |
|
400 | + } |
|
401 | + } |
|
402 | + |
|
403 | + /** |
|
404 | + * Save the reverse post relation. |
|
405 | + */ |
|
406 | + public function save_related_post( $connections, $post_id, $field, $value ) { |
|
407 | + $ids = explode( '_to_', $field['id'] ); |
|
408 | + $relation = $ids[1] . '_to_' . $ids[0]; |
|
409 | + |
|
410 | + if ( in_array( $relation, $connections ) ) { |
|
411 | + $previous_values = get_post_meta( $post_id, $field['id'], false ); |
|
412 | + |
|
413 | + if ( ! empty( $previous_values ) ) { |
|
414 | + foreach ( $previous_values as $v ) { |
|
415 | + delete_post_meta( $v, $relation, $post_id ); |
|
416 | + } |
|
417 | + } |
|
418 | + |
|
419 | + if ( is_array( $value ) ) { |
|
420 | + foreach ( $value as $v ) { |
|
421 | + if ( ! empty( $v ) ) { |
|
422 | + add_post_meta( $v, $relation, $post_id ); |
|
423 | + } |
|
424 | + } |
|
425 | + } |
|
426 | + } |
|
427 | + } |
|
428 | + |
|
429 | + public function assets() { |
|
430 | + //wp_enqueue_media(); |
|
431 | + wp_enqueue_script( 'media-upload' ); |
|
432 | + wp_enqueue_script( 'thickbox' ); |
|
433 | + wp_enqueue_style( 'thickbox' ); |
|
434 | + |
|
435 | + wp_enqueue_script( 'lsx-team-admin', LSX_TEAM_URL . 'assets/js/lsx-team-admin.min.js', array( 'jquery' ), LSX_TEAM_VER ); |
|
436 | + wp_enqueue_style( 'lsx-team-admin', LSX_TEAM_URL . 'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER ); |
|
437 | + } |
|
438 | + |
|
439 | + /** |
|
440 | + * Change the "Insert into Post" button text when media modal is used for feature images |
|
441 | + */ |
|
442 | + public function change_attachment_field_button( $html ) { |
|
443 | + if ( isset( $_GET['feature_image_text_button'] ) ) { |
|
444 | + $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-team' ) ), $html ); |
|
445 | + } |
|
446 | + |
|
447 | + return $html; |
|
448 | + } |
|
449 | + |
|
450 | + public function change_title_text( $title ) { |
|
451 | + $screen = get_current_screen(); |
|
452 | + |
|
453 | + if ( 'team' === $screen->post_type ) { |
|
454 | + $title = esc_attr__( 'Enter team member name', 'lsx-team' ); |
|
455 | + } |
|
456 | + |
|
457 | + return $title; |
|
458 | + } |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | $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( |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | 'rest_controller_class' => 'WP_REST_Posts_Controller', |
83 | 83 | ); |
84 | 84 | |
85 | - register_post_type( 'team', $args ); |
|
85 | + register_post_type('team', $args); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function taxonomy_setup() { |
89 | 89 | $labels = array( |
90 | - 'name' => esc_html_x( 'Roles', 'taxonomy general name', 'lsx-team' ), |
|
91 | - 'singular_name' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
92 | - 'search_items' => esc_html__( 'Search Roles', 'lsx-team' ), |
|
93 | - 'all_items' => esc_html__( 'All Roles', 'lsx-team' ), |
|
94 | - 'parent_item' => esc_html__( 'Parent Role', 'lsx-team' ), |
|
95 | - 'parent_item_colon' => esc_html__( 'Parent Role:', 'lsx-team' ), |
|
96 | - 'edit_item' => esc_html__( 'Edit Role', 'lsx-team' ), |
|
97 | - 'update_item' => esc_html__( 'Update Role', 'lsx-team' ), |
|
98 | - 'add_new_item' => esc_html__( 'Add New Role', 'lsx-team' ), |
|
99 | - 'new_item_name' => esc_html__( 'New Role Name', 'lsx-team' ), |
|
100 | - 'menu_name' => esc_html__( 'Roles', 'lsx-team' ), |
|
90 | + 'name' => esc_html_x('Roles', 'taxonomy general name', 'lsx-team'), |
|
91 | + 'singular_name' => esc_html_x('Role', 'taxonomy singular name', 'lsx-team'), |
|
92 | + 'search_items' => esc_html__('Search Roles', 'lsx-team'), |
|
93 | + 'all_items' => esc_html__('All Roles', 'lsx-team'), |
|
94 | + 'parent_item' => esc_html__('Parent Role', 'lsx-team'), |
|
95 | + 'parent_item_colon' => esc_html__('Parent Role:', 'lsx-team'), |
|
96 | + 'edit_item' => esc_html__('Edit Role', 'lsx-team'), |
|
97 | + 'update_item' => esc_html__('Update Role', 'lsx-team'), |
|
98 | + 'add_new_item' => esc_html__('Add New Role', 'lsx-team'), |
|
99 | + 'new_item_name' => esc_html__('New Role Name', 'lsx-team'), |
|
100 | + 'menu_name' => esc_html__('Roles', 'lsx-team'), |
|
101 | 101 | ); |
102 | 102 | |
103 | 103 | $args = array( |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'rest_controller_class' => 'WP_REST_Terms_Controller', |
115 | 115 | ); |
116 | 116 | |
117 | - register_taxonomy( 'team_role', array( 'team' ), $args ); |
|
117 | + register_taxonomy('team_role', array('team'), $args); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | |
125 | 125 | $prefix = 'lsx_'; |
126 | 126 | |
127 | - $users = get_transient( 'lsx_team_users' ); |
|
127 | + $users = get_transient('lsx_team_users'); |
|
128 | 128 | |
129 | - if ( false === $users || '' === $users ) { |
|
130 | - $users = get_users( array( |
|
131 | - 'role__in' => array( 'administrator', 'editor', 'author' ), |
|
132 | - ) ); |
|
133 | - set_transient( 'lsx_team_users', $users, 5 * 60 ); |
|
129 | + if (false === $users || '' === $users) { |
|
130 | + $users = get_users(array( |
|
131 | + 'role__in' => array('administrator', 'editor', 'author'), |
|
132 | + )); |
|
133 | + set_transient('lsx_team_users', $users, 5 * 60); |
|
134 | 134 | } |
135 | 135 | |
136 | - foreach ( $users as $user ) { |
|
136 | + foreach ($users as $user) { |
|
137 | 137 | $user_array[] = array( |
138 | 138 | 'name' => $user->nice_name, |
139 | 139 | 'value' => $user->ID, |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | |
143 | 143 | $cmb = new_cmb2_box( |
144 | 144 | array( |
145 | - 'id' => $prefix . '_team', |
|
146 | - 'title' => esc_html__( 'Team Member Details', 'lsx-team' ), |
|
145 | + 'id' => $prefix.'_team', |
|
146 | + 'title' => esc_html__('Team Member Details', 'lsx-team'), |
|
147 | 147 | 'object_types' => 'team', |
148 | 148 | 'context' => 'normal', |
149 | 149 | 'priority' => 'low', |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | |
154 | 154 | $cmb->add_field( |
155 | 155 | array( |
156 | - 'name' => esc_html__( 'Featured:', 'lsx-team' ), |
|
157 | - 'id' => $prefix . 'featured', |
|
156 | + 'name' => esc_html__('Featured:', 'lsx-team'), |
|
157 | + 'id' => $prefix.'featured', |
|
158 | 158 | 'type' => 'checkbox', |
159 | 159 | 'value' => 1, |
160 | 160 | 'default' => 0, |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | |
165 | 165 | $cmb->add_field( |
166 | 166 | array( |
167 | - 'name' => esc_html__( 'Site User', 'lsx-team' ), |
|
168 | - 'id' => $prefix . 'site_user', |
|
167 | + 'name' => esc_html__('Site User', 'lsx-team'), |
|
168 | + 'id' => $prefix.'site_user', |
|
169 | 169 | 'allow_none' => true, |
170 | 170 | 'type' => 'select', |
171 | 171 | 'options' => $user_array, |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | |
176 | 176 | $cmb->add_field( |
177 | 177 | array( |
178 | - 'name' => esc_html__( 'Job Title:', 'lsx-team' ), |
|
179 | - 'id' => $prefix . 'job_title', |
|
178 | + 'name' => esc_html__('Job Title:', 'lsx-team'), |
|
179 | + 'id' => $prefix.'job_title', |
|
180 | 180 | 'type' => 'text', |
181 | 181 | 'show_in_rest' => true, |
182 | 182 | ) |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | |
185 | 185 | $cmb->add_field( |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'Location:', 'lsx-team' ), |
|
188 | - 'id' => $prefix . 'location', |
|
187 | + 'name' => esc_html__('Location:', 'lsx-team'), |
|
188 | + 'id' => $prefix.'location', |
|
189 | 189 | 'type' => 'text', |
190 | 190 | 'show_in_rest' => true, |
191 | 191 | ) |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | |
194 | 194 | $cmb->add_field( |
195 | 195 | array( |
196 | - 'name' => esc_html__( 'Contact Email Address:', 'lsx-team' ), |
|
197 | - 'id' => $prefix . 'email_contact', |
|
196 | + 'name' => esc_html__('Contact Email Address:', 'lsx-team'), |
|
197 | + 'id' => $prefix.'email_contact', |
|
198 | 198 | 'type' => 'text', |
199 | 199 | 'show_in_rest' => true, |
200 | 200 | ) |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | |
203 | 203 | $cmb->add_field( |
204 | 204 | array( |
205 | - 'name' => esc_html__( 'Gravatar Email Address:', 'lsx-team' ), |
|
206 | - 'desc' => esc_html__( 'Used for Gravatar if a featured image is not set', 'lsx-team' ), |
|
207 | - 'id' => $prefix . 'email_gravatar', |
|
205 | + 'name' => esc_html__('Gravatar Email Address:', 'lsx-team'), |
|
206 | + 'desc' => esc_html__('Used for Gravatar if a featured image is not set', 'lsx-team'), |
|
207 | + 'id' => $prefix.'email_gravatar', |
|
208 | 208 | 'type' => 'text', |
209 | 209 | 'show_in_rest' => true, |
210 | 210 | ) |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | |
213 | 213 | $cmb->add_field( |
214 | 214 | array( |
215 | - 'name' => esc_html__( 'Telephone Number:', 'lsx-team' ), |
|
216 | - 'id' => $prefix . 'tel', |
|
215 | + 'name' => esc_html__('Telephone Number:', 'lsx-team'), |
|
216 | + 'id' => $prefix.'tel', |
|
217 | 217 | 'type' => 'text', |
218 | 218 | 'show_in_rest' => true, |
219 | 219 | ) |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | |
222 | 222 | $cmb->add_field( |
223 | 223 | array( |
224 | - 'name' => esc_html__( 'Skype Name:', 'lsx-team' ), |
|
225 | - 'id' => $prefix . 'skype', |
|
224 | + 'name' => esc_html__('Skype Name:', 'lsx-team'), |
|
225 | + 'id' => $prefix.'skype', |
|
226 | 226 | 'type' => 'text', |
227 | 227 | 'show_in_rest' => true, |
228 | 228 | ) |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | |
231 | 231 | $cmb->add_field( |
232 | 232 | array( |
233 | - 'name' => esc_html__( 'Facebook URL', 'lsx-team' ), |
|
234 | - 'id' => $prefix . 'facebook', |
|
233 | + 'name' => esc_html__('Facebook URL', 'lsx-team'), |
|
234 | + 'id' => $prefix.'facebook', |
|
235 | 235 | 'type' => 'text_url', |
236 | 236 | 'show_in_rest' => true, |
237 | 237 | ) |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | |
240 | 240 | $cmb->add_field( |
241 | 241 | array( |
242 | - 'name' => esc_html__( 'Twitter URL', 'lsx-team' ), |
|
243 | - 'id' => $prefix . 'twitter', |
|
242 | + 'name' => esc_html__('Twitter URL', 'lsx-team'), |
|
243 | + 'id' => $prefix.'twitter', |
|
244 | 244 | 'type' => 'text_url', |
245 | 245 | 'show_in_rest' => true, |
246 | 246 | ) |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | |
249 | 249 | $cmb->add_field( |
250 | 250 | array( |
251 | - 'name' => esc_html__( 'LinkedIn URL', 'lsx-team' ), |
|
252 | - 'id' => $prefix . 'linkedin', |
|
251 | + 'name' => esc_html__('LinkedIn URL', 'lsx-team'), |
|
252 | + 'id' => $prefix.'linkedin', |
|
253 | 253 | 'type' => 'text_url', |
254 | 254 | 'show_in_rest' => true, |
255 | 255 | ) |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | |
258 | 258 | $cmb->add_field( |
259 | 259 | array( |
260 | - 'name' => esc_html__( 'Github URL', 'lsx-team' ), |
|
261 | - 'id' => $prefix . 'github', |
|
260 | + 'name' => esc_html__('Github URL', 'lsx-team'), |
|
261 | + 'id' => $prefix.'github', |
|
262 | 262 | 'type' => 'text_url', |
263 | 263 | 'show_in_rest' => true, |
264 | 264 | ) |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | |
267 | 267 | $cmb->add_field( |
268 | 268 | array( |
269 | - 'name' => esc_html__( 'WordPress URL', 'lsx-team' ), |
|
270 | - 'id' => $prefix . 'wordpress', |
|
269 | + 'name' => esc_html__('WordPress URL', 'lsx-team'), |
|
270 | + 'id' => $prefix.'wordpress', |
|
271 | 271 | 'type' => 'text_url', |
272 | 272 | 'show_in_rest' => true, |
273 | 273 | ) |
@@ -279,29 +279,29 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function projects_details_metabox() { |
281 | 281 | |
282 | - if ( class_exists( 'LSX_Projects' ) ) { |
|
282 | + if (class_exists('LSX_Projects')) { |
|
283 | 283 | |
284 | 284 | $prefix = 'lsx_'; |
285 | 285 | |
286 | 286 | $cmb = new_cmb2_box( |
287 | 287 | array( |
288 | - 'id' => $prefix . '_team', |
|
288 | + 'id' => $prefix.'_team', |
|
289 | 289 | 'context' => 'normal', |
290 | 290 | 'priority' => 'low', |
291 | 291 | 'show_names' => true, |
292 | - 'object_types' => array( 'team' ), |
|
292 | + 'object_types' => array('team'), |
|
293 | 293 | ) |
294 | 294 | ); |
295 | 295 | $cmb->add_field( |
296 | 296 | array( |
297 | - 'name' => __( 'Projects:', 'lsx-team' ), |
|
297 | + 'name' => __('Projects:', 'lsx-team'), |
|
298 | 298 | 'id' => 'project_to_team', |
299 | 299 | 'type' => 'post_search_ajax', |
300 | 300 | 'limit' => 15, |
301 | 301 | 'sortable' => true, |
302 | 302 | 'query_args' => array( |
303 | - 'post_type' => array( 'project' ), |
|
304 | - 'post_status' => array( 'publish' ), |
|
303 | + 'post_type' => array('project'), |
|
304 | + 'post_status' => array('publish'), |
|
305 | 305 | 'posts_per_page' => -1, |
306 | 306 | ), |
307 | 307 | ) |
@@ -314,29 +314,29 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function services_details_metabox() { |
316 | 316 | |
317 | - if ( class_exists( 'LSX_Services' ) ) { |
|
317 | + if (class_exists('LSX_Services')) { |
|
318 | 318 | |
319 | 319 | $prefix = 'lsx_'; |
320 | 320 | |
321 | 321 | $cmb = new_cmb2_box( |
322 | 322 | array( |
323 | - 'id' => $prefix . '_team', |
|
323 | + 'id' => $prefix.'_team', |
|
324 | 324 | 'context' => 'normal', |
325 | 325 | 'priority' => 'low', |
326 | 326 | 'show_names' => true, |
327 | - 'object_types' => array( 'team' ), |
|
327 | + 'object_types' => array('team'), |
|
328 | 328 | ) |
329 | 329 | ); |
330 | 330 | $cmb->add_field( |
331 | 331 | array( |
332 | - 'name' => __( 'Services:', 'lsx-team' ), |
|
332 | + 'name' => __('Services:', 'lsx-team'), |
|
333 | 333 | 'id' => 'service_to_team', |
334 | 334 | 'type' => 'post_search_ajax', |
335 | 335 | 'limit' => 15, |
336 | 336 | 'sortable' => true, |
337 | 337 | 'query_args' => array( |
338 | - 'post_type' => array( 'service' ), |
|
339 | - 'post_status' => array( 'publish' ), |
|
338 | + 'post_type' => array('service'), |
|
339 | + 'post_status' => array('publish'), |
|
340 | 340 | 'posts_per_page' => -1, |
341 | 341 | ), |
342 | 342 | ) |
@@ -349,29 +349,29 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function testimonials_details_metabox() { |
351 | 351 | |
352 | - if ( class_exists( 'LSX_Testimonials' ) ) { |
|
352 | + if (class_exists('LSX_Testimonials')) { |
|
353 | 353 | |
354 | 354 | $prefix = 'lsx_'; |
355 | 355 | |
356 | 356 | $cmb = new_cmb2_box( |
357 | 357 | array( |
358 | - 'id' => $prefix . '_team', |
|
358 | + 'id' => $prefix.'_team', |
|
359 | 359 | 'context' => 'normal', |
360 | 360 | 'priority' => 'low', |
361 | 361 | 'show_names' => true, |
362 | - 'object_types' => array( 'team' ), |
|
362 | + 'object_types' => array('team'), |
|
363 | 363 | ) |
364 | 364 | ); |
365 | 365 | $cmb->add_field( |
366 | 366 | array( |
367 | - 'name' => __( 'Testimonials:', 'lsx-team' ), |
|
367 | + 'name' => __('Testimonials:', 'lsx-team'), |
|
368 | 368 | 'id' => 'testimonial_to_team', |
369 | 369 | 'type' => 'post_search_ajax', |
370 | 370 | 'limit' => 15, |
371 | 371 | 'sortable' => true, |
372 | 372 | 'query_args' => array( |
373 | - 'post_type' => array( 'testimonial' ), |
|
374 | - 'post_status' => array( 'publish' ), |
|
373 | + 'post_type' => array('testimonial'), |
|
374 | + 'post_status' => array('publish'), |
|
375 | 375 | 'posts_per_page' => -1, |
376 | 376 | ), |
377 | 377 | ) |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * Sets up the "post relations". |
385 | 385 | */ |
386 | - public function post_relations( $post_id, $field, $value ) { |
|
386 | + public function post_relations($post_id, $field, $value) { |
|
387 | 387 | $connections = array( |
388 | 388 | 'team_to_testimonial', |
389 | 389 | 'testimonial_to_team', |
@@ -395,31 +395,31 @@ discard block |
||
395 | 395 | 'service_to_team', |
396 | 396 | ); |
397 | 397 | |
398 | - if ( in_array( $field['id'], $connections ) ) { |
|
399 | - $this->save_related_post( $connections, $post_id, $field, $value ); |
|
398 | + if (in_array($field['id'], $connections)) { |
|
399 | + $this->save_related_post($connections, $post_id, $field, $value); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
404 | 404 | * Save the reverse post relation. |
405 | 405 | */ |
406 | - public function save_related_post( $connections, $post_id, $field, $value ) { |
|
407 | - $ids = explode( '_to_', $field['id'] ); |
|
408 | - $relation = $ids[1] . '_to_' . $ids[0]; |
|
406 | + public function save_related_post($connections, $post_id, $field, $value) { |
|
407 | + $ids = explode('_to_', $field['id']); |
|
408 | + $relation = $ids[1].'_to_'.$ids[0]; |
|
409 | 409 | |
410 | - if ( in_array( $relation, $connections ) ) { |
|
411 | - $previous_values = get_post_meta( $post_id, $field['id'], false ); |
|
410 | + if (in_array($relation, $connections)) { |
|
411 | + $previous_values = get_post_meta($post_id, $field['id'], false); |
|
412 | 412 | |
413 | - if ( ! empty( $previous_values ) ) { |
|
414 | - foreach ( $previous_values as $v ) { |
|
415 | - delete_post_meta( $v, $relation, $post_id ); |
|
413 | + if (!empty($previous_values)) { |
|
414 | + foreach ($previous_values as $v) { |
|
415 | + delete_post_meta($v, $relation, $post_id); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | - if ( is_array( $value ) ) { |
|
420 | - foreach ( $value as $v ) { |
|
421 | - if ( ! empty( $v ) ) { |
|
422 | - add_post_meta( $v, $relation, $post_id ); |
|
419 | + if (is_array($value)) { |
|
420 | + foreach ($value as $v) { |
|
421 | + if (!empty($v)) { |
|
422 | + add_post_meta($v, $relation, $post_id); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
@@ -428,30 +428,30 @@ discard block |
||
428 | 428 | |
429 | 429 | public function assets() { |
430 | 430 | //wp_enqueue_media(); |
431 | - wp_enqueue_script( 'media-upload' ); |
|
432 | - wp_enqueue_script( 'thickbox' ); |
|
433 | - wp_enqueue_style( 'thickbox' ); |
|
431 | + wp_enqueue_script('media-upload'); |
|
432 | + wp_enqueue_script('thickbox'); |
|
433 | + wp_enqueue_style('thickbox'); |
|
434 | 434 | |
435 | - wp_enqueue_script( 'lsx-team-admin', LSX_TEAM_URL . 'assets/js/lsx-team-admin.min.js', array( 'jquery' ), LSX_TEAM_VER ); |
|
436 | - wp_enqueue_style( 'lsx-team-admin', LSX_TEAM_URL . 'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER ); |
|
435 | + wp_enqueue_script('lsx-team-admin', LSX_TEAM_URL.'assets/js/lsx-team-admin.min.js', array('jquery'), LSX_TEAM_VER); |
|
436 | + wp_enqueue_style('lsx-team-admin', LSX_TEAM_URL.'assets/css/lsx-team-admin.css', array(), LSX_TEAM_VER); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
440 | 440 | * Change the "Insert into Post" button text when media modal is used for feature images |
441 | 441 | */ |
442 | - public function change_attachment_field_button( $html ) { |
|
443 | - if ( isset( $_GET['feature_image_text_button'] ) ) { |
|
444 | - $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-team' ) ), $html ); |
|
442 | + public function change_attachment_field_button($html) { |
|
443 | + if (isset($_GET['feature_image_text_button'])) { |
|
444 | + $html = str_replace('value="Insert into Post"', sprintf('value="%s"', esc_html__('Select featured image', 'lsx-team')), $html); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | return $html; |
448 | 448 | } |
449 | 449 | |
450 | - public function change_title_text( $title ) { |
|
450 | + public function change_title_text($title) { |
|
451 | 451 | $screen = get_current_screen(); |
452 | 452 | |
453 | - if ( 'team' === $screen->post_type ) { |
|
454 | - $title = esc_attr__( 'Enter team member name', 'lsx-team' ); |
|
453 | + if ('team' === $screen->post_type) { |
|
454 | + $title = esc_attr__('Enter team member name', 'lsx-team'); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | return $title; |