@@ -5,24 +5,24 @@ discard block |
||
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | 7 | <?php |
| 8 | - global $lsx_projects_frontend; |
|
| 8 | + global $lsx_projects_frontend; |
|
| 9 | 9 | |
| 10 | - $groups = ''; |
|
| 11 | - $groups_class = ''; |
|
| 12 | - $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 10 | + $groups = ''; |
|
| 11 | + $groups_class = ''; |
|
| 12 | + $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 13 | 13 | |
| 14 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 15 | - $groups = array(); |
|
| 16 | - $groups_class = array(); |
|
| 14 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 15 | + $groups = array(); |
|
| 16 | + $groups_class = array(); |
|
| 17 | 17 | |
| 18 | - foreach ( $terms as $term ) { |
|
| 19 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 20 | - $groups_class[] = 'filter-' . $term->slug; |
|
| 21 | - } |
|
| 18 | + foreach ( $terms as $term ) { |
|
| 19 | + $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 20 | + $groups_class[] = 'filter-' . $term->slug; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - $groups = join( ', ', $groups ); |
|
| 24 | - $groups_class = join( ' ', $groups_class ); |
|
| 25 | - } |
|
| 23 | + $groups = join( ', ', $groups ); |
|
| 24 | + $groups_class = join( ' ', $groups_class ); |
|
| 25 | + } |
|
| 26 | 26 | ?> |
| 27 | 27 | |
| 28 | 28 | <div class="col-xs-12 col-sm-6 col-md-6 lsx-projects-column <?php echo esc_attr( $groups_class ); ?>"> |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | - if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) { |
|
| 40 | - if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) { |
|
| 41 | - echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' ); |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - ?> |
|
| 39 | + if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) { |
|
| 40 | + if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) { |
|
| 41 | + echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' ); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + ?> |
|
| 45 | 45 | |
| 46 | 46 | <h5 class="lsx-projects-title"> |
| 47 | 47 | <?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?> |
@@ -18,46 +18,46 @@ discard block |
||
| 18 | 18 | <?php lsx_content_top(); ?> |
| 19 | 19 | |
| 20 | 20 | <?php |
| 21 | - if ( ! function_exists( 'lsx_search' ) ) { |
|
| 22 | - $args = array( |
|
| 23 | - 'taxonomy' => 'project-group', |
|
| 24 | - 'hide_empty' => false, |
|
| 25 | - ); |
|
| 21 | + if ( ! function_exists( 'lsx_search' ) ) { |
|
| 22 | + $args = array( |
|
| 23 | + 'taxonomy' => 'project-group', |
|
| 24 | + 'hide_empty' => false, |
|
| 25 | + ); |
|
| 26 | 26 | |
| 27 | - $groups = get_terms( $args ); |
|
| 28 | - $group_selected = get_query_var( 'project-group' ); |
|
| 27 | + $groups = get_terms( $args ); |
|
| 28 | + $group_selected = get_query_var( 'project-group' ); |
|
| 29 | 29 | |
| 30 | - if ( count( $groups ) > 0 ) { |
|
| 31 | - ?> |
|
| 30 | + if ( count( $groups ) > 0 ) { |
|
| 31 | + ?> |
|
| 32 | 32 | |
| 33 | 33 | <ul class="nav nav-tabs lsx-projects-filter"> |
| 34 | 34 | <?php |
| 35 | - $group_selected_class = ''; |
|
| 35 | + $group_selected_class = ''; |
|
| 36 | 36 | |
| 37 | - if ( empty( $group_selected ) ) { |
|
| 38 | - $group_selected_class = ' class="active"'; |
|
| 39 | - } |
|
| 40 | - ?> |
|
| 37 | + if ( empty( $group_selected ) ) { |
|
| 38 | + $group_selected_class = ' class="active"'; |
|
| 39 | + } |
|
| 40 | + ?> |
|
| 41 | 41 | |
| 42 | 42 | <li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'project' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-projects' ); ?></a></li> |
| 43 | 43 | |
| 44 | 44 | <?php foreach ( $groups as $group ) : ?> |
| 45 | 45 | <?php |
| 46 | - $group_selected_class = ''; |
|
| 46 | + $group_selected_class = ''; |
|
| 47 | 47 | |
| 48 | - if ( (string) $group_selected === (string) $group->slug ) { |
|
| 49 | - $group_selected_class = ' class="active"'; |
|
| 50 | - } |
|
| 51 | - ?> |
|
| 48 | + if ( (string) $group_selected === (string) $group->slug ) { |
|
| 49 | + $group_selected_class = ' class="active"'; |
|
| 50 | + } |
|
| 51 | + ?> |
|
| 52 | 52 | |
| 53 | 53 | <li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_term_link( $group ) ); ?>" data-filter=".filter-<?php echo esc_attr( $group->slug ); ?>"><?php echo esc_attr( $group->name ); ?></a></li> |
| 54 | 54 | <?php endforeach; ?> |
| 55 | 55 | </ul> |
| 56 | 56 | |
| 57 | 57 | <?php |
| 58 | - } |
|
| 59 | - } |
|
| 60 | - ?> |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + ?> |
|
| 61 | 61 | |
| 62 | 62 | <?php if ( have_posts() ) : ?> |
| 63 | 63 | |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | <div class="row row-flex lsx-projects-row"> |
| 66 | 66 | |
| 67 | 67 | <?php |
| 68 | - $count = 0; |
|
| 68 | + $count = 0; |
|
| 69 | 69 | |
| 70 | - while ( have_posts() ) { |
|
| 71 | - the_post(); |
|
| 72 | - include LSX_PROJECTS_PATH . '/templates/content-archive-projects.php'; |
|
| 73 | - } |
|
| 74 | - ?> |
|
| 70 | + while ( have_posts() ) { |
|
| 71 | + the_post(); |
|
| 72 | + include LSX_PROJECTS_PATH . '/templates/content-archive-projects.php'; |
|
| 73 | + } |
|
| 74 | + ?> |
|
| 75 | 75 | |
| 76 | 76 | </div> |
| 77 | 77 | </div> |
@@ -10,115 +10,115 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | class LSX_Projects_Frontend { |
| 12 | 12 | |
| 13 | - public function __construct() { |
|
| 14 | - $this->options = projects_get_options(); |
|
| 15 | - |
|
| 16 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
| 17 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
| 18 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 19 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 20 | - |
|
| 21 | - if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
| 22 | - add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - if ( is_admin() ) { |
|
| 26 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
| 30 | - |
|
| 31 | - add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
| 32 | - add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
| 33 | - add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
| 34 | - |
|
| 35 | - add_filter( 'pre_get_posts', array( $this, 'posts_per_page' ) ); |
|
| 36 | - add_action( 'wp_footer', array( $this, 'add_form_modal' ) ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - public function enqueue_scripts() { |
|
| 40 | - $has_slick = wp_script_is( 'slick', 'queue' ); |
|
| 41 | - |
|
| 42 | - if ( ! $has_slick ) { |
|
| 43 | - wp_enqueue_style( 'slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null ); |
|
| 44 | - wp_enqueue_script( 'slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - $has_scrolltofixed = wp_script_is( 'scrolltofixed', 'queue' ); |
|
| 48 | - |
|
| 49 | - if ( ! $has_scrolltofixed ) { |
|
| 50 | - wp_enqueue_script( 'scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $has_isotope = wp_script_is( 'isotope', 'queue' ); |
|
| 54 | - |
|
| 55 | - if ( ! $has_isotope ) { |
|
| 56 | - wp_enqueue_script( 'isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - wp_enqueue_script( 'lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array( 'jquery', 'slick', 'scrolltofixed', 'isotope' ), LSX_PROJECTS_VER, true ); |
|
| 60 | - |
|
| 61 | - $params = apply_filters( 'lsx_projects_js_params', array( |
|
| 62 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 63 | - )); |
|
| 64 | - |
|
| 65 | - wp_localize_script( 'lsx-projects', 'lsx_customizer_params', $params ); |
|
| 66 | - |
|
| 67 | - wp_enqueue_style( 'lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER ); |
|
| 68 | - wp_style_add_data( 'lsx-projects', 'rtl', 'replace' ); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Allow data params for Slick slider addon. |
|
| 73 | - */ |
|
| 74 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
| 75 | - $allowedtags['div']['data-slick'] = true; |
|
| 76 | - return $allowedtags; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Single template. |
|
| 81 | - */ |
|
| 82 | - public function single_template_include( $template ) { |
|
| 83 | - if ( is_main_query() && is_singular( 'project' ) ) { |
|
| 84 | - if ( empty( locate_template( array( 'single-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/single-projects.php' ) ) { |
|
| 85 | - $template = LSX_PROJECTS_PATH . 'templates/single-projects.php'; |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - return $template; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Archive template. |
|
| 94 | - */ |
|
| 95 | - public function archive_template_include( $template ) { |
|
| 96 | - if ( is_main_query() && ( is_post_type_archive( 'project' ) || is_tax( 'project-group' ) ) ) { |
|
| 97 | - if ( empty( locate_template( array( 'archive-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/archive-projects.php' ) ) { |
|
| 98 | - $template = LSX_PROJECTS_PATH . 'templates/archive-projects.php'; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - return $template; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Removes access to single project member posts. |
|
| 107 | - */ |
|
| 108 | - public function disable_single() { |
|
| 109 | - $queried_post_type = get_query_var( 'post_type' ); |
|
| 110 | - |
|
| 111 | - if ( is_single() && 'project' === $queried_post_type ) { |
|
| 112 | - wp_redirect( home_url(), 301 ); |
|
| 113 | - exit; |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Handle body colours that might be change by LSX Customiser |
|
| 119 | - */ |
|
| 120 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
| 121 | - $css .= ' |
|
| 13 | + public function __construct() { |
|
| 14 | + $this->options = projects_get_options(); |
|
| 15 | + |
|
| 16 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
| 17 | + add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
| 18 | + add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 19 | + add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 20 | + |
|
| 21 | + if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
| 22 | + add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + if ( is_admin() ) { |
|
| 26 | + add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
| 30 | + |
|
| 31 | + add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
| 32 | + add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
| 33 | + add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
| 34 | + |
|
| 35 | + add_filter( 'pre_get_posts', array( $this, 'posts_per_page' ) ); |
|
| 36 | + add_action( 'wp_footer', array( $this, 'add_form_modal' ) ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + public function enqueue_scripts() { |
|
| 40 | + $has_slick = wp_script_is( 'slick', 'queue' ); |
|
| 41 | + |
|
| 42 | + if ( ! $has_slick ) { |
|
| 43 | + wp_enqueue_style( 'slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null ); |
|
| 44 | + wp_enqueue_script( 'slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + $has_scrolltofixed = wp_script_is( 'scrolltofixed', 'queue' ); |
|
| 48 | + |
|
| 49 | + if ( ! $has_scrolltofixed ) { |
|
| 50 | + wp_enqueue_script( 'scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $has_isotope = wp_script_is( 'isotope', 'queue' ); |
|
| 54 | + |
|
| 55 | + if ( ! $has_isotope ) { |
|
| 56 | + wp_enqueue_script( 'isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + wp_enqueue_script( 'lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array( 'jquery', 'slick', 'scrolltofixed', 'isotope' ), LSX_PROJECTS_VER, true ); |
|
| 60 | + |
|
| 61 | + $params = apply_filters( 'lsx_projects_js_params', array( |
|
| 62 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 63 | + )); |
|
| 64 | + |
|
| 65 | + wp_localize_script( 'lsx-projects', 'lsx_customizer_params', $params ); |
|
| 66 | + |
|
| 67 | + wp_enqueue_style( 'lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER ); |
|
| 68 | + wp_style_add_data( 'lsx-projects', 'rtl', 'replace' ); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Allow data params for Slick slider addon. |
|
| 73 | + */ |
|
| 74 | + public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
| 75 | + $allowedtags['div']['data-slick'] = true; |
|
| 76 | + return $allowedtags; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Single template. |
|
| 81 | + */ |
|
| 82 | + public function single_template_include( $template ) { |
|
| 83 | + if ( is_main_query() && is_singular( 'project' ) ) { |
|
| 84 | + if ( empty( locate_template( array( 'single-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/single-projects.php' ) ) { |
|
| 85 | + $template = LSX_PROJECTS_PATH . 'templates/single-projects.php'; |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + return $template; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Archive template. |
|
| 94 | + */ |
|
| 95 | + public function archive_template_include( $template ) { |
|
| 96 | + if ( is_main_query() && ( is_post_type_archive( 'project' ) || is_tax( 'project-group' ) ) ) { |
|
| 97 | + if ( empty( locate_template( array( 'archive-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/archive-projects.php' ) ) { |
|
| 98 | + $template = LSX_PROJECTS_PATH . 'templates/archive-projects.php'; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + return $template; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Removes access to single project member posts. |
|
| 107 | + */ |
|
| 108 | + public function disable_single() { |
|
| 109 | + $queried_post_type = get_query_var( 'post_type' ); |
|
| 110 | + |
|
| 111 | + if ( is_single() && 'project' === $queried_post_type ) { |
|
| 112 | + wp_redirect( home_url(), 301 ); |
|
| 113 | + exit; |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Handle body colours that might be change by LSX Customiser |
|
| 119 | + */ |
|
| 120 | + public function customizer_body_colours_handler( $css, $colors ) { |
|
| 121 | + $css .= ' |
|
| 122 | 122 | @import "' . LSX_PROJECTS_PATH . '/assets/css/scss/customizer-projects-body-colours"; |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -134,108 +134,108 @@ discard block |
||
| 134 | 134 | ); |
| 135 | 135 | '; |
| 136 | 136 | |
| 137 | - return $css; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Change the LSX Banners title for project archive. |
|
| 142 | - */ |
|
| 143 | - public function lsx_banner_archive_title( $title ) { |
|
| 144 | - if ( is_main_query() && is_post_type_archive( 'project' ) ) { |
|
| 145 | - $title = '<h1 class="page-title">' . esc_html__( 'Portfolio', 'lsx-projects' ) . '</h1>'; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - if ( is_main_query() && is_tax( 'project-group' ) ) { |
|
| 149 | - $tax = get_queried_object(); |
|
| 150 | - $title = '<h1 class="page-title">' . esc_html__( 'Project Type', 'lsx-projects' ) . ': ' . apply_filters( 'the_title', $tax->name ) . '</h1>'; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - return $title; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Remove the "continue reading" when the single is disabled. |
|
| 158 | - */ |
|
| 159 | - public function change_excerpt_more( $excerpt_more ) { |
|
| 160 | - global $post; |
|
| 161 | - |
|
| 162 | - if ( 'project' === $post->post_type ) { |
|
| 163 | - if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
| 164 | - $excerpt_more = ''; |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - return $excerpt_more; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Change the word count when crop the content to excerpt (homepage widget). |
|
| 173 | - */ |
|
| 174 | - public function change_excerpt_length( $excerpt_word_count ) { |
|
| 175 | - global $post; |
|
| 176 | - |
|
| 177 | - if ( is_front_page() && 'project' === $post->post_type ) { |
|
| 178 | - $excerpt_word_count = 20; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
| 182 | - $excerpt_word_count = 20; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - return $excerpt_word_count; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Change the allowed tags crop the content to excerpt (homepage widget). |
|
| 190 | - */ |
|
| 191 | - public function change_excerpt_strip_tags( $allowed_tags ) { |
|
| 192 | - global $post; |
|
| 193 | - |
|
| 194 | - if ( is_front_page() && 'project' === $post->post_type ) { |
|
| 195 | - $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
| 199 | - $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - return $allowed_tags; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Change posts per page counter for archive. |
|
| 207 | - */ |
|
| 208 | - public function posts_per_page( $query ) { |
|
| 209 | - if ( ! is_admin() && $query->is_main_query() ) { |
|
| 210 | - if ( $query->is_post_type_archive( 'project' ) || $query->is_tax( 'project-group' ) ) { |
|
| 211 | - if ( ! function_exists( 'lsx_search' ) ) { |
|
| 212 | - $query->set( 'posts_per_page', -1 ); |
|
| 213 | - } else { |
|
| 214 | - $query->set( 'posts_per_page', '12' ); |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - return $query; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * Add form modal |
|
| 224 | - */ |
|
| 225 | - public function add_form_modal() { |
|
| 226 | - |
|
| 227 | - if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
| 228 | - return ''; |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - if ( empty( $this->options['display']['projects_modal_cta_label'] ) || empty( $this->options['display']['projects_modal_form_id'] ) || empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
| 232 | - return ''; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - if ( ! is_singular( 'project' ) ) { |
|
| 236 | - return ''; |
|
| 237 | - } |
|
| 238 | - ?> |
|
| 137 | + return $css; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Change the LSX Banners title for project archive. |
|
| 142 | + */ |
|
| 143 | + public function lsx_banner_archive_title( $title ) { |
|
| 144 | + if ( is_main_query() && is_post_type_archive( 'project' ) ) { |
|
| 145 | + $title = '<h1 class="page-title">' . esc_html__( 'Portfolio', 'lsx-projects' ) . '</h1>'; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + if ( is_main_query() && is_tax( 'project-group' ) ) { |
|
| 149 | + $tax = get_queried_object(); |
|
| 150 | + $title = '<h1 class="page-title">' . esc_html__( 'Project Type', 'lsx-projects' ) . ': ' . apply_filters( 'the_title', $tax->name ) . '</h1>'; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + return $title; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Remove the "continue reading" when the single is disabled. |
|
| 158 | + */ |
|
| 159 | + public function change_excerpt_more( $excerpt_more ) { |
|
| 160 | + global $post; |
|
| 161 | + |
|
| 162 | + if ( 'project' === $post->post_type ) { |
|
| 163 | + if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
| 164 | + $excerpt_more = ''; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + return $excerpt_more; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Change the word count when crop the content to excerpt (homepage widget). |
|
| 173 | + */ |
|
| 174 | + public function change_excerpt_length( $excerpt_word_count ) { |
|
| 175 | + global $post; |
|
| 176 | + |
|
| 177 | + if ( is_front_page() && 'project' === $post->post_type ) { |
|
| 178 | + $excerpt_word_count = 20; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
| 182 | + $excerpt_word_count = 20; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + return $excerpt_word_count; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Change the allowed tags crop the content to excerpt (homepage widget). |
|
| 190 | + */ |
|
| 191 | + public function change_excerpt_strip_tags( $allowed_tags ) { |
|
| 192 | + global $post; |
|
| 193 | + |
|
| 194 | + if ( is_front_page() && 'project' === $post->post_type ) { |
|
| 195 | + $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
| 199 | + $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + return $allowed_tags; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Change posts per page counter for archive. |
|
| 207 | + */ |
|
| 208 | + public function posts_per_page( $query ) { |
|
| 209 | + if ( ! is_admin() && $query->is_main_query() ) { |
|
| 210 | + if ( $query->is_post_type_archive( 'project' ) || $query->is_tax( 'project-group' ) ) { |
|
| 211 | + if ( ! function_exists( 'lsx_search' ) ) { |
|
| 212 | + $query->set( 'posts_per_page', -1 ); |
|
| 213 | + } else { |
|
| 214 | + $query->set( 'posts_per_page', '12' ); |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + return $query; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * Add form modal |
|
| 224 | + */ |
|
| 225 | + public function add_form_modal() { |
|
| 226 | + |
|
| 227 | + if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
| 228 | + return ''; |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + if ( empty( $this->options['display']['projects_modal_cta_label'] ) || empty( $this->options['display']['projects_modal_form_id'] ) || empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
| 232 | + return ''; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + if ( ! is_singular( 'project' ) ) { |
|
| 236 | + return ''; |
|
| 237 | + } |
|
| 238 | + ?> |
|
| 239 | 239 | <div class="lsx-modal modal fade" id="lsx-project-contact" role="dialog"> |
| 240 | 240 | <div class="modal-dialog"> |
| 241 | 241 | <div class="modal-content"> |
@@ -247,17 +247,17 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | <div class="modal-body"> |
| 249 | 249 | <?php |
| 250 | - if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
| 251 | - echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
| 252 | - } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
| 253 | - echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
| 254 | - } ?> |
|
| 250 | + if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
| 251 | + echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
| 252 | + } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
| 253 | + echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
| 254 | + } ?> |
|
| 255 | 255 | </div> |
| 256 | 256 | </div> |
| 257 | 257 | </div> |
| 258 | 258 | </div> |
| 259 | 259 | <?php |
| 260 | - } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |