@@ -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,104 +134,104 @@ 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 | - $query->set( 'posts_per_page', -1 ); |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - return $query; |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * Add form modal |
|
| 220 | - */ |
|
| 221 | - public function add_form_modal() { |
|
| 222 | - |
|
| 223 | - if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
| 224 | - return ''; |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - 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'] ) ) { |
|
| 228 | - return ''; |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - if ( ! is_singular( 'project' ) ) { |
|
| 232 | - return ''; |
|
| 233 | - } |
|
| 234 | - ?> |
|
| 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 | + $query->set( 'posts_per_page', -1 ); |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + return $query; |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * Add form modal |
|
| 220 | + */ |
|
| 221 | + public function add_form_modal() { |
|
| 222 | + |
|
| 223 | + if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
| 224 | + return ''; |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + 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'] ) ) { |
|
| 228 | + return ''; |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + if ( ! is_singular( 'project' ) ) { |
|
| 232 | + return ''; |
|
| 233 | + } |
|
| 234 | + ?> |
|
| 235 | 235 | <div class="lsx-modal modal fade" id="lsx-project-contact" role="dialog"> |
| 236 | 236 | <div class="modal-dialog"> |
| 237 | 237 | <div class="modal-content"> |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | <div class="modal-body"> |
| 245 | 245 | <?php |
| 246 | - if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
| 247 | - echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
| 248 | - } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
| 249 | - echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
| 250 | - } ?> |
|
| 246 | + if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
| 247 | + echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
| 248 | + } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
| 249 | + echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
| 250 | + } ?> |
|
| 251 | 251 | </div> |
| 252 | 252 | </div> |
| 253 | 253 | </div> |
| 254 | 254 | </div> |
| 255 | 255 | <?php |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * Add our action to init to set up our vars first. |
| 14 | 14 | */ |
| 15 | 15 | function lsx_projects_load_plugin_textdomain() { |
| 16 | - load_plugin_textdomain( 'lsx-projects', false, basename( LSX_PROJECTS_PATH ) . '/languages' ); |
|
| 16 | + load_plugin_textdomain( 'lsx-projects', false, basename( LSX_PROJECTS_PATH ) . '/languages' ); |
|
| 17 | 17 | } |
| 18 | 18 | add_action( 'init', 'lsx_projects_load_plugin_textdomain' ); |
| 19 | 19 | |
@@ -21,16 +21,16 @@ discard block |
||
| 21 | 21 | * Wraps the output class in a function to be called in templates |
| 22 | 22 | */ |
| 23 | 23 | function lsx_projects( $args ) { |
| 24 | - $lsx_projects = new LSX_Projects; |
|
| 25 | - echo wp_kses_post( $lsx_projects->output( $args ) ); |
|
| 24 | + $lsx_projects = new LSX_Projects; |
|
| 25 | + echo wp_kses_post( $lsx_projects->output( $args ) ); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Shortcode |
| 30 | 30 | */ |
| 31 | 31 | function lsx_projects_shortcode( $atts ) { |
| 32 | - $lsx_projects = new LSX_Projects; |
|
| 33 | - return $lsx_projects->output( $atts ); |
|
| 32 | + $lsx_projects = new LSX_Projects; |
|
| 33 | + return $lsx_projects->output( $atts ); |
|
| 34 | 34 | } |
| 35 | 35 | add_shortcode( 'lsx_projects', 'lsx_projects_shortcode' ); |
| 36 | 36 | |
@@ -38,23 +38,23 @@ discard block |
||
| 38 | 38 | * Wraps the output class in a function to be called in templates |
| 39 | 39 | */ |
| 40 | 40 | function lsx_groups_list() { |
| 41 | - do_action( 'lsx_groups_list' ); |
|
| 41 | + do_action( 'lsx_groups_list' ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | function lsx_child_group_list() { |
| 45 | - do_action( 'lsx_child_group_list' ); |
|
| 45 | + do_action( 'lsx_child_group_list' ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | function lsx_projects_list() { |
| 49 | - do_action( 'lsx_projects_list' ); |
|
| 49 | + do_action( 'lsx_projects_list' ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | function lsx_projects_sidebar() { |
| 53 | - do_action( 'lsx_projects_sidebar' ); |
|
| 53 | + do_action( 'lsx_projects_sidebar' ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | function lsx_projects_single_tag() { |
| 57 | - do_action( 'lsx_projects_single_tag' ); |
|
| 57 | + do_action( 'lsx_projects_single_tag' ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -65,23 +65,23 @@ discard block |
||
| 65 | 65 | * @return mixed Option value |
| 66 | 66 | */ |
| 67 | 67 | function projects_get_options() { |
| 68 | - $options = array(); |
|
| 69 | - if ( function_exists( 'tour_operator' ) ) { |
|
| 70 | - $options = get_option( '_lsx-to_settings', false ); |
|
| 71 | - } else { |
|
| 72 | - $options = get_option( '_lsx_settings', false ); |
|
| 73 | - |
|
| 74 | - if ( false === $options ) { |
|
| 75 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - // If there are new CMB2 options available, then use those. |
|
| 80 | - $new_options = get_option( 'lsx_projects_options', false ); |
|
| 81 | - if ( false !== $new_options ) { |
|
| 82 | - $options['display'] = $new_options; |
|
| 83 | - } |
|
| 84 | - return $options; |
|
| 68 | + $options = array(); |
|
| 69 | + if ( function_exists( 'tour_operator' ) ) { |
|
| 70 | + $options = get_option( '_lsx-to_settings', false ); |
|
| 71 | + } else { |
|
| 72 | + $options = get_option( '_lsx_settings', false ); |
|
| 73 | + |
|
| 74 | + if ( false === $options ) { |
|
| 75 | + $options = get_option( '_lsx_lsx-settings', false ); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + // If there are new CMB2 options available, then use those. |
|
| 80 | + $new_options = get_option( 'lsx_projects_options', false ); |
|
| 81 | + if ( false !== $new_options ) { |
|
| 82 | + $options['display'] = $new_options; |
|
| 83 | + } |
|
| 84 | + return $options; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -92,28 +92,28 @@ discard block |
||
| 92 | 92 | * @return mixed Option value |
| 93 | 93 | */ |
| 94 | 94 | function projects_get_option( $key = '', $default = false ) { |
| 95 | - $options = array(); |
|
| 96 | - $value = $default; |
|
| 97 | - if ( function_exists( 'tour_operator' ) ) { |
|
| 98 | - $options = get_option( '_lsx-to_settings', false ); |
|
| 99 | - } else { |
|
| 100 | - $options = get_option( '_lsx_settings', false ); |
|
| 101 | - |
|
| 102 | - if ( false === $options ) { |
|
| 103 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // If there are new CMB2 options available, then use those. |
|
| 108 | - $new_options = get_option( 'lsx_projects_options', false ); |
|
| 109 | - if ( false !== $new_options ) { |
|
| 110 | - $options['display'] = $new_options; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) { |
|
| 114 | - $value = $options['display'][ $key ]; |
|
| 115 | - } |
|
| 116 | - return $value; |
|
| 95 | + $options = array(); |
|
| 96 | + $value = $default; |
|
| 97 | + if ( function_exists( 'tour_operator' ) ) { |
|
| 98 | + $options = get_option( '_lsx-to_settings', false ); |
|
| 99 | + } else { |
|
| 100 | + $options = get_option( '_lsx_settings', false ); |
|
| 101 | + |
|
| 102 | + if ( false === $options ) { |
|
| 103 | + $options = get_option( '_lsx_lsx-settings', false ); |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // If there are new CMB2 options available, then use those. |
|
| 108 | + $new_options = get_option( 'lsx_projects_options', false ); |
|
| 109 | + if ( false !== $new_options ) { |
|
| 110 | + $options['display'] = $new_options; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) { |
|
| 114 | + $value = $options['display'][ $key ]; |
|
| 115 | + } |
|
| 116 | + return $value; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | * @return void |
| 125 | 125 | */ |
| 126 | 126 | function portfolio_modify_archive_title( $title ) { |
| 127 | - if ( ! is_post_type_archive( 'project' ) ) { |
|
| 128 | - return $title; |
|
| 129 | - } |
|
| 130 | - $title = __( 'Portfolio', 'lsx' ); |
|
| 131 | - return $title; |
|
| 127 | + if ( ! is_post_type_archive( 'project' ) ) { |
|
| 128 | + return $title; |
|
| 129 | + } |
|
| 130 | + $title = __( 'Portfolio', 'lsx' ); |
|
| 131 | + return $title; |
|
| 132 | 132 | } |
| 133 | 133 | add_filter( 'get_the_archive_title', 'portfolio_modify_archive_title', 10, 1 ); |
@@ -15,39 +15,39 @@ discard block |
||
| 15 | 15 | $button_cf_id = ''; |
| 16 | 16 | |
| 17 | 17 | if ( ! empty( projects_get_option( 'projects_modal_enable' ) ) ) { |
| 18 | - if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) { |
|
| 19 | - $button_label = projects_get_option( 'projects_modal_cta_label' ); |
|
| 20 | - $button_cf_id = projects_get_option( 'projects_modal_form_id' ); |
|
| 21 | - } |
|
| 18 | + if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) { |
|
| 19 | + $button_label = projects_get_option( 'projects_modal_cta_label' ); |
|
| 20 | + $button_cf_id = projects_get_option( 'projects_modal_form_id' ); |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if ( ! empty( $client_logo ) ) { |
| 25 | - $client_logo = '<img src="' . $client_logo . '">'; |
|
| 25 | + $client_logo = '<img src="' . $client_logo . '">'; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $groups = ''; |
| 29 | 29 | $terms = get_the_terms( get_the_ID(), 'project-group' ); |
| 30 | 30 | |
| 31 | 31 | if ( $terms && ! is_wp_error( $terms ) ) { |
| 32 | - $groups = array(); |
|
| 32 | + $groups = array(); |
|
| 33 | 33 | |
| 34 | - foreach ( $terms as $term ) { |
|
| 35 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 36 | - } |
|
| 34 | + foreach ( $terms as $term ) { |
|
| 35 | + $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $groups = join( ', ', $groups ); |
|
| 38 | + $groups = join( ', ', $groups ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $product_groups = ''; |
| 42 | 42 | $product_terms = get_post_meta( get_the_ID(), 'lsx_project__alt_products', false ); |
| 43 | 43 | |
| 44 | 44 | if ( $product_terms && ! is_wp_error( $product_terms ) ) { |
| 45 | - $product_groups = array(); |
|
| 46 | - foreach ( $product_terms[0] as $product_term ) { |
|
| 47 | - $product_groups[] = '<a href="' . $product_term['lsx_project_alt_product_link'] . '">' . $product_term['lsx_project_alt_product_title'] . '</a>'; |
|
| 48 | - } |
|
| 45 | + $product_groups = array(); |
|
| 46 | + foreach ( $product_terms[0] as $product_term ) { |
|
| 47 | + $product_groups[] = '<a href="' . $product_term['lsx_project_alt_product_link'] . '">' . $product_term['lsx_project_alt_product_title'] . '</a>'; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $product_groups = join( ', ', $product_groups ); |
|
| 50 | + $product_groups = join( ', ', $product_groups ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -55,83 +55,83 @@ discard block |
||
| 55 | 55 | // Connection Projects. |
| 56 | 56 | |
| 57 | 57 | if ( post_type_exists( 'project' ) && $terms && ! is_wp_error( $terms ) ) { |
| 58 | - $groups_ = array(); |
|
| 59 | - |
|
| 60 | - foreach ( $terms as $term ) { |
|
| 61 | - $groups_[] = $term->term_id; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if ( count( $groups_ ) > 0 ) { |
|
| 65 | - $connection_project['post_type'] = 'project'; |
|
| 66 | - $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
| 67 | - $connection_project['posts'] = array(); |
|
| 68 | - |
|
| 69 | - $args = array( |
|
| 70 | - 'post_type' => 'project', |
|
| 71 | - 'post__not_in' => array( get_the_ID() ), |
|
| 72 | - 'no_found_rows' => true, |
|
| 73 | - 'ignore_sticky_posts' => 1, |
|
| 74 | - 'update_post_meta_cache' => false, |
|
| 75 | - 'tax_query' => array( |
|
| 76 | - array( |
|
| 77 | - 'taxonomy' => 'project-group', |
|
| 78 | - 'terms' => $groups_, |
|
| 79 | - ), |
|
| 80 | - ), |
|
| 81 | - ); |
|
| 82 | - |
|
| 83 | - $projects_ = new \WP_Query( $args ); |
|
| 84 | - |
|
| 85 | - if ( $projects_->have_posts() ) { |
|
| 86 | - while ( $projects_->have_posts() ) { |
|
| 87 | - $projects_->the_post(); |
|
| 88 | - $connection_project['posts'][] = get_the_ID(); |
|
| 89 | - wp_reset_postdata(); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - if ( ! empty( $connection_project['posts'] ) ) { |
|
| 94 | - $post_ids = join( ',', $connection_project['posts'] ); |
|
| 95 | - $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 96 | - $connections[] = $connection_project; |
|
| 97 | - } |
|
| 98 | - } |
|
| 58 | + $groups_ = array(); |
|
| 59 | + |
|
| 60 | + foreach ( $terms as $term ) { |
|
| 61 | + $groups_[] = $term->term_id; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + if ( count( $groups_ ) > 0 ) { |
|
| 65 | + $connection_project['post_type'] = 'project'; |
|
| 66 | + $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
| 67 | + $connection_project['posts'] = array(); |
|
| 68 | + |
|
| 69 | + $args = array( |
|
| 70 | + 'post_type' => 'project', |
|
| 71 | + 'post__not_in' => array( get_the_ID() ), |
|
| 72 | + 'no_found_rows' => true, |
|
| 73 | + 'ignore_sticky_posts' => 1, |
|
| 74 | + 'update_post_meta_cache' => false, |
|
| 75 | + 'tax_query' => array( |
|
| 76 | + array( |
|
| 77 | + 'taxonomy' => 'project-group', |
|
| 78 | + 'terms' => $groups_, |
|
| 79 | + ), |
|
| 80 | + ), |
|
| 81 | + ); |
|
| 82 | + |
|
| 83 | + $projects_ = new \WP_Query( $args ); |
|
| 84 | + |
|
| 85 | + if ( $projects_->have_posts() ) { |
|
| 86 | + while ( $projects_->have_posts() ) { |
|
| 87 | + $projects_->the_post(); |
|
| 88 | + $connection_project['posts'][] = get_the_ID(); |
|
| 89 | + wp_reset_postdata(); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + if ( ! empty( $connection_project['posts'] ) ) { |
|
| 94 | + $post_ids = join( ',', $connection_project['posts'] ); |
|
| 95 | + $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 96 | + $connections[] = $connection_project; |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Connection Products. |
| 102 | 102 | if ( class_exists( 'WooCommerce' ) ) { |
| 103 | - $connection_product['post_type'] = 'product'; |
|
| 104 | - $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
| 105 | - $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
| 106 | - |
|
| 107 | - if ( ! empty( $connection_product['posts'] ) ) { |
|
| 108 | - $connection_product['small_list_html'] = ''; |
|
| 109 | - |
|
| 110 | - $args = array( |
|
| 111 | - 'post_type' => 'product', |
|
| 112 | - 'post__in' => $connection_product['posts'][0], |
|
| 113 | - 'orderby' => 'post__in', |
|
| 114 | - 'no_found_rows' => true, |
|
| 115 | - 'ignore_sticky_posts' => 1, |
|
| 116 | - 'update_post_term_cache' => false, |
|
| 117 | - 'update_post_meta_cache' => false, |
|
| 118 | - ); |
|
| 119 | - $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
| 120 | - |
|
| 121 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 122 | - $connection_product['small_list_html'] = array(); |
|
| 123 | - |
|
| 124 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 125 | - $connection_product['posts_obj']->the_post(); |
|
| 126 | - $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 127 | - wp_reset_postdata(); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - $connection_product['posts_obj']->rewind_posts(); |
|
| 131 | - $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
| 132 | - } |
|
| 133 | - $connections[] = $connection_product; |
|
| 134 | - } |
|
| 103 | + $connection_product['post_type'] = 'product'; |
|
| 104 | + $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
| 105 | + $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
| 106 | + |
|
| 107 | + if ( ! empty( $connection_product['posts'] ) ) { |
|
| 108 | + $connection_product['small_list_html'] = ''; |
|
| 109 | + |
|
| 110 | + $args = array( |
|
| 111 | + 'post_type' => 'product', |
|
| 112 | + 'post__in' => $connection_product['posts'][0], |
|
| 113 | + 'orderby' => 'post__in', |
|
| 114 | + 'no_found_rows' => true, |
|
| 115 | + 'ignore_sticky_posts' => 1, |
|
| 116 | + 'update_post_term_cache' => false, |
|
| 117 | + 'update_post_meta_cache' => false, |
|
| 118 | + ); |
|
| 119 | + $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
| 120 | + |
|
| 121 | + if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 122 | + $connection_product['small_list_html'] = array(); |
|
| 123 | + |
|
| 124 | + while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 125 | + $connection_product['posts_obj']->the_post(); |
|
| 126 | + $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 127 | + wp_reset_postdata(); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + $connection_product['posts_obj']->rewind_posts(); |
|
| 131 | + $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
| 132 | + } |
|
| 133 | + $connections[] = $connection_product; |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Connection Services. |
@@ -139,81 +139,81 @@ discard block |
||
| 139 | 139 | $connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false ); |
| 140 | 140 | |
| 141 | 141 | if ( ! empty( $connection_service['pages'] ) ) { |
| 142 | - $post_ids = join( ',', $connection_service['pages'] ); |
|
| 143 | - $connection_service['small_list_html'] = ''; |
|
| 144 | - |
|
| 145 | - $args = array( |
|
| 146 | - 'post_type' => 'page', |
|
| 147 | - 'post__in' => $connection_service['pages'], |
|
| 148 | - 'orderby' => 'post__in', |
|
| 149 | - 'no_found_rows' => true, |
|
| 150 | - 'ignore_sticky_posts' => 1, |
|
| 151 | - 'update_post_term_cache' => false, |
|
| 152 | - 'update_post_meta_cache' => false, |
|
| 153 | - ); |
|
| 154 | - $services_ = new \WP_Query( $args ); |
|
| 155 | - |
|
| 156 | - if ( $services_->have_posts() ) { |
|
| 157 | - $connection_service['small_list_html'] = array(); |
|
| 158 | - |
|
| 159 | - while ( $services_->have_posts() ) { |
|
| 160 | - $services_->the_post(); |
|
| 161 | - $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 162 | - wp_reset_postdata(); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
| 166 | - } |
|
| 167 | - $connections[] = $connection_service; |
|
| 142 | + $post_ids = join( ',', $connection_service['pages'] ); |
|
| 143 | + $connection_service['small_list_html'] = ''; |
|
| 144 | + |
|
| 145 | + $args = array( |
|
| 146 | + 'post_type' => 'page', |
|
| 147 | + 'post__in' => $connection_service['pages'], |
|
| 148 | + 'orderby' => 'post__in', |
|
| 149 | + 'no_found_rows' => true, |
|
| 150 | + 'ignore_sticky_posts' => 1, |
|
| 151 | + 'update_post_term_cache' => false, |
|
| 152 | + 'update_post_meta_cache' => false, |
|
| 153 | + ); |
|
| 154 | + $services_ = new \WP_Query( $args ); |
|
| 155 | + |
|
| 156 | + if ( $services_->have_posts() ) { |
|
| 157 | + $connection_service['small_list_html'] = array(); |
|
| 158 | + |
|
| 159 | + while ( $services_->have_posts() ) { |
|
| 160 | + $services_->the_post(); |
|
| 161 | + $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 162 | + wp_reset_postdata(); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
| 166 | + } |
|
| 167 | + $connections[] = $connection_service; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // Connection Testimonials. |
| 171 | 171 | if ( post_type_exists( 'testimonial' ) ) { |
| 172 | - $connection_testimonial['post_type'] = 'testimonial'; |
|
| 173 | - $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
| 174 | - |
|
| 175 | - if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
| 176 | - $post_ids = join( ',', $connection_testimonial['posts'][0] ); |
|
| 177 | - $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
|
| 178 | - $connections[] = $connection_testimonial; |
|
| 179 | - } |
|
| 172 | + $connection_testimonial['post_type'] = 'testimonial'; |
|
| 173 | + $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
| 174 | + |
|
| 175 | + if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
| 176 | + $post_ids = join( ',', $connection_testimonial['posts'][0] ); |
|
| 177 | + $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
|
| 178 | + $connections[] = $connection_testimonial; |
|
| 179 | + } |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Connection Team. |
| 183 | 183 | if ( post_type_exists( 'team' ) ) { |
| 184 | - $connection_team['post_type'] = 'team'; |
|
| 185 | - $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
| 186 | - |
|
| 187 | - if ( ! empty( $connection_team['posts'] ) ) { |
|
| 188 | - $post_ids = join( ',', $connection_team['posts'][0] ); |
|
| 189 | - $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
|
| 190 | - $connection_team['small_list_html'] = ''; |
|
| 191 | - |
|
| 192 | - $args = array( |
|
| 193 | - 'post_type' => 'team', |
|
| 194 | - 'post__in' => $connection_team['posts'][0], |
|
| 195 | - 'orderby' => 'post__in', |
|
| 196 | - 'no_found_rows' => true, |
|
| 197 | - 'ignore_sticky_posts' => 1, |
|
| 198 | - 'update_post_term_cache' => false, |
|
| 199 | - 'update_post_meta_cache' => false, |
|
| 200 | - ); |
|
| 201 | - $team_ = new \WP_Query( $args ); |
|
| 202 | - |
|
| 203 | - if ( $team_->have_posts() ) { |
|
| 204 | - global $lsx_team; |
|
| 205 | - $connection_team['small_list_html'] = array(); |
|
| 206 | - |
|
| 207 | - while ( $team_->have_posts() ) { |
|
| 208 | - $team_->the_post(); |
|
| 209 | - $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
| 210 | - wp_reset_postdata(); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
| 214 | - } |
|
| 215 | - $connections[] = $connection_team; |
|
| 216 | - } |
|
| 184 | + $connection_team['post_type'] = 'team'; |
|
| 185 | + $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
| 186 | + |
|
| 187 | + if ( ! empty( $connection_team['posts'] ) ) { |
|
| 188 | + $post_ids = join( ',', $connection_team['posts'][0] ); |
|
| 189 | + $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
|
| 190 | + $connection_team['small_list_html'] = ''; |
|
| 191 | + |
|
| 192 | + $args = array( |
|
| 193 | + 'post_type' => 'team', |
|
| 194 | + 'post__in' => $connection_team['posts'][0], |
|
| 195 | + 'orderby' => 'post__in', |
|
| 196 | + 'no_found_rows' => true, |
|
| 197 | + 'ignore_sticky_posts' => 1, |
|
| 198 | + 'update_post_term_cache' => false, |
|
| 199 | + 'update_post_meta_cache' => false, |
|
| 200 | + ); |
|
| 201 | + $team_ = new \WP_Query( $args ); |
|
| 202 | + |
|
| 203 | + if ( $team_->have_posts() ) { |
|
| 204 | + global $lsx_team; |
|
| 205 | + $connection_team['small_list_html'] = array(); |
|
| 206 | + |
|
| 207 | + while ( $team_->have_posts() ) { |
|
| 208 | + $team_->the_post(); |
|
| 209 | + $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
| 210 | + wp_reset_postdata(); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
| 214 | + } |
|
| 215 | + $connections[] = $connection_team; |
|
| 216 | + } |
|
| 217 | 217 | } |
| 218 | 218 | ?> |
| 219 | 219 | |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | <?php if ( count( $connections ) > 0 ) : ?> |
| 231 | 231 | <?php foreach ( $connections as $i => $connection ) : ?> |
| 232 | 232 | <?php |
| 233 | - if ( 'testimonial' === $connection['post_type'] ) { |
|
| 234 | - echo '<div class="tab-pane-fake">'; |
|
| 235 | - echo do_shortcode( $connection['shortcode'] ); |
|
| 236 | - echo '</div>'; |
|
| 237 | - } |
|
| 238 | - ?> |
|
| 233 | + if ( 'testimonial' === $connection['post_type'] ) { |
|
| 234 | + echo '<div class="tab-pane-fake">'; |
|
| 235 | + echo do_shortcode( $connection['shortcode'] ); |
|
| 236 | + echo '</div>'; |
|
| 237 | + } |
|
| 238 | + ?> |
|
| 239 | 239 | <?php endforeach; ?> |
| 240 | 240 | <?php endif; ?> |
| 241 | 241 | </div> |
@@ -291,13 +291,13 @@ discard block |
||
| 291 | 291 | <?php if ( count( $connections ) > 0 ) : ?> |
| 292 | 292 | <?php foreach ( $connections as $i => $connection ) : ?> |
| 293 | 293 | <?php |
| 294 | - // Team is now visible on detail box. |
|
| 295 | - // Services is now visible on detail box. |
|
| 296 | - // Testimonials is now visible below the content. |
|
| 297 | - if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) { |
|
| 298 | - continue; |
|
| 299 | - } |
|
| 300 | - ?> |
|
| 294 | + // Team is now visible on detail box. |
|
| 295 | + // Services is now visible on detail box. |
|
| 296 | + // Testimonials is now visible below the content. |
|
| 297 | + if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) { |
|
| 298 | + continue; |
|
| 299 | + } |
|
| 300 | + ?> |
|
| 301 | 301 | <?php if ( 'page' !== $connection['post_type'] ) { ?> |
| 302 | 302 | <div class="lsx-projects-section lsx-full-width"> |
| 303 | 303 | <div class="row"> |
@@ -305,34 +305,34 @@ discard block |
||
| 305 | 305 | <h3 class="lsx-title"><?php echo wp_kses_post( $connection['title'] ); ?></h3> |
| 306 | 306 | |
| 307 | 307 | <?php |
| 308 | - if ( 'product' === $connection['post_type'] ) { |
|
| 309 | - |
|
| 310 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 311 | - // @codingStandardsIgnoreLine |
|
| 312 | - echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 313 | - |
|
| 314 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 315 | - $connection_product['posts_obj']->the_post(); |
|
| 316 | - wc_get_template( 'content-widget-product.php', array( |
|
| 317 | - 'show_rating' => false, |
|
| 318 | - ) ); |
|
| 319 | - |
|
| 320 | - wp_reset_postdata(); |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - // @codingStandardsIgnoreLine |
|
| 324 | - echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
| 325 | - } |
|
| 326 | - } else { |
|
| 327 | - echo do_shortcode( $connection['shortcode'] ); |
|
| 328 | - } |
|
| 329 | - ?> |
|
| 308 | + if ( 'product' === $connection['post_type'] ) { |
|
| 309 | + |
|
| 310 | + if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 311 | + // @codingStandardsIgnoreLine |
|
| 312 | + echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 313 | + |
|
| 314 | + while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 315 | + $connection_product['posts_obj']->the_post(); |
|
| 316 | + wc_get_template( 'content-widget-product.php', array( |
|
| 317 | + 'show_rating' => false, |
|
| 318 | + ) ); |
|
| 319 | + |
|
| 320 | + wp_reset_postdata(); |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + // @codingStandardsIgnoreLine |
|
| 324 | + echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
| 325 | + } |
|
| 326 | + } else { |
|
| 327 | + echo do_shortcode( $connection['shortcode'] ); |
|
| 328 | + } |
|
| 329 | + ?> |
|
| 330 | 330 | </div> |
| 331 | 331 | </div> |
| 332 | 332 | </div> |
| 333 | 333 | <?php |
| 334 | - } |
|
| 335 | - ?> |
|
| 334 | + } |
|
| 335 | + ?> |
|
| 336 | 336 | <?php endforeach; ?> |
| 337 | 337 | <?php endif; ?> |
| 338 | 338 | |