@@ -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 | |
@@ -5,136 +5,136 @@ |
||
| 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" limit="9" 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 | - if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
| 102 | - $post_ids = join( ',', $tab_project['posts'] ); |
|
| 103 | - $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 104 | - $tabs[] = $tab_project; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // Tab Services |
|
| 108 | - |
|
| 109 | - if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
| 110 | - $tab_service['post_type'] = 'service'; |
|
| 111 | - $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
| 112 | - $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
| 113 | - |
|
| 114 | - if ( ! empty( $tab_service['posts'] ) ) { |
|
| 115 | - $post_ids = join( ',', $tab_service['posts'] ); |
|
| 116 | - $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
| 117 | - $tabs[] = $tab_service; |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - // Tab Testimonials |
|
| 122 | - |
|
| 123 | - $tab_testimonial['post_type'] = 'testimonial'; |
|
| 124 | - $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
| 125 | - $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
| 126 | - |
|
| 127 | - if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
| 128 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 129 | - $columns = count( $tab_testimonial['posts'] ); |
|
| 130 | - } else { |
|
| 131 | - $columns = 2; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 135 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
| 136 | - $tabs[] = $tab_testimonial; |
|
| 137 | - } |
|
| 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" limit="9" 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 | + if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
| 102 | + $post_ids = join( ',', $tab_project['posts'] ); |
|
| 103 | + $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 104 | + $tabs[] = $tab_project; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // Tab Services |
|
| 108 | + |
|
| 109 | + if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
| 110 | + $tab_service['post_type'] = 'service'; |
|
| 111 | + $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
| 112 | + $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
| 113 | + |
|
| 114 | + if ( ! empty( $tab_service['posts'] ) ) { |
|
| 115 | + $post_ids = join( ',', $tab_service['posts'] ); |
|
| 116 | + $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
| 117 | + $tabs[] = $tab_service; |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + // Tab Testimonials |
|
| 122 | + |
|
| 123 | + $tab_testimonial['post_type'] = 'testimonial'; |
|
| 124 | + $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
| 125 | + $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
| 126 | + |
|
| 127 | + if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
| 128 | + if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 129 | + $columns = count( $tab_testimonial['posts'] ); |
|
| 130 | + } else { |
|
| 131 | + $columns = 2; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 135 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
| 136 | + $tabs[] = $tab_testimonial; |
|
| 137 | + } |
|
| 138 | 138 | ?> |
| 139 | 139 | |
| 140 | 140 | <?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" limit="9" include="' . $post_ids . '"]'; |
|
| 86 | + if (!empty($tab_post['posts'])) { |
|
| 87 | + $post_ids = join(',', $tab_post['posts']); |
|
| 88 | + $tab_post['shortcode'] = '[lsx_posts columns="3" limit="9" include="'.$post_ids.'"]'; |
|
| 89 | 89 | $tabs[] = $tab_post; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -96,24 +96,24 @@ 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 ); |
|
| 101 | - if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
| 102 | - $post_ids = join( ',', $tab_project['posts'] ); |
|
| 103 | - $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 99 | + $tab_project['title'] = esc_html__('Projects', 'lsx-team'); |
|
| 100 | + $tab_project['posts'] = get_post_meta(get_the_ID(), 'project_to_team', true); |
|
| 101 | + if (is_plugin_active('lsx-projects/lsx-projects.php') && (!empty($tab_project['posts']))) { |
|
| 102 | + $post_ids = join(',', $tab_project['posts']); |
|
| 103 | + $tab_project['shortcode'] = '[lsx_projects columns="3" include="'.$post_ids.'"]'; |
|
| 104 | 104 | $tabs[] = $tab_project; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Tab Services |
| 108 | 108 | |
| 109 | - if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
| 109 | + if (is_plugin_active('lsx-services/lsx-services.php')) { |
|
| 110 | 110 | $tab_service['post_type'] = 'service'; |
| 111 | - $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
| 112 | - $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
| 111 | + $tab_service['title'] = esc_html__('Services', 'lsx-team'); |
|
| 112 | + $tab_service['posts'] = get_post_meta(get_the_ID(), 'service_to_team', true); |
|
| 113 | 113 | |
| 114 | - if ( ! empty( $tab_service['posts'] ) ) { |
|
| 115 | - $post_ids = join( ',', $tab_service['posts'] ); |
|
| 116 | - $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
| 114 | + if (!empty($tab_service['posts'])) { |
|
| 115 | + $post_ids = join(',', $tab_service['posts']); |
|
| 116 | + $tab_service['shortcode'] = '[lsx_services columns="3" include="'.$post_ids.'"]'; |
|
| 117 | 117 | $tabs[] = $tab_service; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -121,18 +121,18 @@ discard block |
||
| 121 | 121 | // Tab Testimonials |
| 122 | 122 | |
| 123 | 123 | $tab_testimonial['post_type'] = 'testimonial'; |
| 124 | - $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
| 125 | - $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
| 124 | + $tab_testimonial['title'] = esc_html__('Testimonials', 'lsx-team'); |
|
| 125 | + $tab_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_team', true); |
|
| 126 | 126 | |
| 127 | - if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
| 128 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 129 | - $columns = count( $tab_testimonial['posts'] ); |
|
| 127 | + if (is_plugin_active('lsx-testimonials/lsx-testimonials.php') && (!empty($tab_testimonial['posts']))) { |
|
| 128 | + if (count($tab_testimonial['posts']) <= 2) { |
|
| 129 | + $columns = count($tab_testimonial['posts']); |
|
| 130 | 130 | } else { |
| 131 | 131 | $columns = 2; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 135 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
| 134 | + $post_ids = join(',', $tab_testimonial['posts']); |
|
| 135 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="'.$columns.'" include="'.$post_ids.'" orderby="date" order="DESC" display="excerpt"]'; |
|
| 136 | 136 | $tabs[] = $tab_testimonial; |
| 137 | 137 | } |
| 138 | 138 | ?> |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | <div class="row"> |
| 147 | 147 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 148 | 148 | <figure class="lsx-team-avatar"> |
| 149 | - <?php echo wp_kses_post( $thumbnail ); ?> |
|
| 149 | + <?php echo wp_kses_post($thumbnail); ?> |
|
| 150 | 150 | </figure> |
| 151 | 151 | |
| 152 | - <?php if ( count( $links ) > 0 ) : ?> |
|
| 153 | - <span class="lsx-team-socials-header"><?php echo esc_html__( 'Follow', 'lsx-team' ) . ':'; ?></span> |
|
| 152 | + <?php if (count($links) > 0) : ?> |
|
| 153 | + <span class="lsx-team-socials-header"><?php echo esc_html__('Follow', 'lsx-team').':'; ?></span> |
|
| 154 | 154 | |
| 155 | 155 | <ul class="lsx-team-socials list-inline"> |
| 156 | - <?php foreach ( $links as $service => $link ) : ?> |
|
| 157 | - <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> |
|
| 156 | + <?php foreach ($links as $service => $link) : ?> |
|
| 157 | + <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> |
|
| 158 | 158 | <?php endforeach; ?> |
| 159 | 159 | </ul> |
| 160 | 160 | <?php endif; ?> |
@@ -162,39 +162,39 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | <div class="col-xs-12 col-sm-6 col-md-8"> |
| 164 | 164 | <h2 class="lsx-team-name"><?php the_title(); ?></h2> |
| 165 | - <h5 class="lsx-team-job-title"><?php echo esc_html( $job_title ); ?></h5> |
|
| 165 | + <h5 class="lsx-team-job-title"><?php echo esc_html($job_title); ?></h5> |
|
| 166 | 166 | <div class="lsx-team-content"><?php the_content(); ?></div> |
| 167 | 167 | |
| 168 | - <?php if ( ! empty( $email ) || ! empty( $phone ) || ! empty( $skype ) ) : ?> |
|
| 168 | + <?php if (!empty($email) || !empty($phone) || !empty($skype)) : ?> |
|
| 169 | 169 | <ul class="lsx-team-contact list-inline"> |
| 170 | - <?php if ( ! empty( $email ) ) : ?> |
|
| 171 | - <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> |
|
| 170 | + <?php if (!empty($email)) : ?> |
|
| 171 | + <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> |
|
| 172 | 172 | <?php endif; ?> |
| 173 | 173 | |
| 174 | - <?php if ( ! empty( $phone ) ) : ?> |
|
| 175 | - <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> |
|
| 174 | + <?php if (!empty($phone)) : ?> |
|
| 175 | + <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> |
|
| 176 | 176 | <?php endif; ?> |
| 177 | 177 | |
| 178 | - <?php if ( ! empty( $skype ) ) : ?> |
|
| 179 | - <li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr( $skype ); ?></li> |
|
| 178 | + <?php if (!empty($skype)) : ?> |
|
| 179 | + <li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr($skype); ?></li> |
|
| 180 | 180 | <?php endif; ?> |
| 181 | 181 | </ul> |
| 182 | 182 | <?php endif; ?> |
| 183 | 183 | </div> |
| 184 | 184 | </div> |
| 185 | 185 | |
| 186 | - <?php if ( count( $tabs ) > 0 ) : ?> |
|
| 186 | + <?php if (count($tabs) > 0) : ?> |
|
| 187 | 187 | <div class="entry-tabs"> |
| 188 | 188 | <ul class="nav nav-tabs"> |
| 189 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
| 190 | - <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> |
|
| 189 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
| 190 | + <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> |
|
| 191 | 191 | <?php endforeach; ?> |
| 192 | 192 | </ul> |
| 193 | 193 | |
| 194 | 194 | <div class="tab-content"> |
| 195 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
| 196 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
| 197 | - <?php echo do_shortcode( $tab['shortcode'] ); ?> |
|
| 195 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
| 196 | + <div id="<?php echo esc_attr(sanitize_title($tab['title'])); ?>" class="tab-pane fade<?php if (0 === $i) echo ' in active'; ?>"> |
|
| 197 | + <?php echo do_shortcode($tab['shortcode']); ?> |
|
| 198 | 198 | </div> |
| 199 | 199 | <?php endforeach; ?> |
| 200 | 200 | </div> |
@@ -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 | } |