@@ -13,48 +13,48 @@ 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 | -add_action( 'init', 'lsx_projects_load_plugin_textdomain' ); |
|
| 18 | +add_action('init', 'lsx_projects_load_plugin_textdomain'); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Wraps the output class in a function to be called in templates |
| 22 | 22 | */ |
| 23 | -function lsx_projects( $args ) { |
|
| 23 | +function lsx_projects($args) { |
|
| 24 | 24 | $lsx_projects = new LSX_Projects; |
| 25 | - echo wp_kses_post( $lsx_projects->output( $args ) ); |
|
| 25 | + echo wp_kses_post($lsx_projects->output($args)); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Shortcode |
| 30 | 30 | */ |
| 31 | -function lsx_projects_shortcode( $atts ) { |
|
| 31 | +function lsx_projects_shortcode($atts) { |
|
| 32 | 32 | $lsx_projects = new LSX_Projects; |
| 33 | - return $lsx_projects->output( $atts ); |
|
| 33 | + return $lsx_projects->output($atts); |
|
| 34 | 34 | } |
| 35 | -add_shortcode( 'lsx_projects', 'lsx_projects_shortcode' ); |
|
| 35 | +add_shortcode('lsx_projects', 'lsx_projects_shortcode'); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 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 | /** |
@@ -66,19 +66,19 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | function projects_get_options() { |
| 68 | 68 | $options = array(); |
| 69 | - if ( function_exists( 'tour_operator' ) ) { |
|
| 70 | - $options = get_option( '_lsx-to_settings', false ); |
|
| 69 | + if (function_exists('tour_operator')) { |
|
| 70 | + $options = get_option('_lsx-to_settings', false); |
|
| 71 | 71 | } else { |
| 72 | - $options = get_option( '_lsx_settings', false ); |
|
| 72 | + $options = get_option('_lsx_settings', false); |
|
| 73 | 73 | |
| 74 | - if ( false === $options ) { |
|
| 75 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 74 | + if (false === $options) { |
|
| 75 | + $options = get_option('_lsx_lsx-settings', false); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 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 ) { |
|
| 80 | + $new_options = get_option('lsx_projects_options', false); |
|
| 81 | + if (false !== $new_options) { |
|
| 82 | 82 | $options['display'] = $new_options; |
| 83 | 83 | } |
| 84 | 84 | return $options; |
@@ -91,27 +91,27 @@ discard block |
||
| 91 | 91 | * @param mixed $default Optional default value |
| 92 | 92 | * @return mixed Option value |
| 93 | 93 | */ |
| 94 | -function projects_get_option( $key = '', $default = false ) { |
|
| 94 | +function projects_get_option($key = '', $default = false) { |
|
| 95 | 95 | $options = array(); |
| 96 | 96 | $value = $default; |
| 97 | - if ( function_exists( 'tour_operator' ) ) { |
|
| 98 | - $options = get_option( '_lsx-to_settings', false ); |
|
| 97 | + if (function_exists('tour_operator')) { |
|
| 98 | + $options = get_option('_lsx-to_settings', false); |
|
| 99 | 99 | } else { |
| 100 | - $options = get_option( '_lsx_settings', false ); |
|
| 100 | + $options = get_option('_lsx_settings', false); |
|
| 101 | 101 | |
| 102 | - if ( false === $options ) { |
|
| 103 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 102 | + if (false === $options) { |
|
| 103 | + $options = get_option('_lsx_lsx-settings', false); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 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 ) { |
|
| 108 | + $new_options = get_option('lsx_projects_options', false); |
|
| 109 | + if (false !== $new_options) { |
|
| 110 | 110 | $options['display'] = $new_options; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) { |
|
| 114 | - $value = $options['display'][ $key ]; |
|
| 113 | + if (isset($options['display']) && isset($options['display'][$key])) { |
|
| 114 | + $value = $options['display'][$key]; |
|
| 115 | 115 | } |
| 116 | 116 | return $value; |
| 117 | 117 | } |
@@ -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 ); |
|
| 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 | 73 | |
| 74 | - if ( false === $options ) { |
|
| 75 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 76 | - } |
|
| 77 | - } |
|
| 74 | + if ( false === $options ) { |
|
| 75 | + $options = get_option( '_lsx_lsx-settings', false ); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 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; |
|
| 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,26 +92,26 @@ 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 ); |
|
| 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 | 101 | |
| 102 | - if ( false === $options ) { |
|
| 103 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 104 | - } |
|
| 105 | - } |
|
| 102 | + if ( false === $options ) { |
|
| 103 | + $options = get_option( '_lsx_lsx-settings', false ); |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | 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 | - } |
|
| 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 | 112 | |
| 113 | - if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) { |
|
| 114 | - $value = $options['display'][ $key ]; |
|
| 115 | - } |
|
| 116 | - return $value; |
|
| 113 | + if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) { |
|
| 114 | + $value = $options['display'][ $key ]; |
|
| 115 | + } |
|
| 116 | + return $value; |
|
| 117 | 117 | } |
@@ -5,41 +5,41 @@ discard block |
||
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | 7 | <?php |
| 8 | - $client = get_post_meta( get_the_ID(), 'lsx_project_client', true ); |
|
| 9 | - $client_logo = get_post_meta( get_the_ID(), 'lsx_project_client_logo', true ); |
|
| 10 | - $url = get_post_meta( get_the_ID(), 'lsx_project_url', true ); |
|
| 8 | + $client = get_post_meta(get_the_ID(), 'lsx_project_client', true); |
|
| 9 | + $client_logo = get_post_meta(get_the_ID(), 'lsx_project_client_logo', true); |
|
| 10 | + $url = get_post_meta(get_the_ID(), 'lsx_project_url', true); |
|
| 11 | 11 | |
| 12 | 12 | global $lsx_projects; |
| 13 | 13 | |
| 14 | 14 | $button_label = ''; |
| 15 | 15 | $button_cf_id = ''; |
| 16 | 16 | |
| 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' ); |
|
| 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 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if ( ! empty( $client_logo ) ) { |
|
| 25 | - $client_logo = wp_get_attachment_image_src( $client_logo, 'full' ); |
|
| 24 | + if ( ! empty($client_logo)) { |
|
| 25 | + $client_logo = wp_get_attachment_image_src($client_logo, 'full'); |
|
| 26 | 26 | |
| 27 | - if ( is_array( $client_logo ) ) { |
|
| 27 | + if (is_array($client_logo)) { |
|
| 28 | 28 | $client_logo = '<img src="' . $client_logo[0] . '">'; |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $groups = ''; |
| 33 | - $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 33 | + $terms = get_the_terms(get_the_ID(), 'project-group'); |
|
| 34 | 34 | |
| 35 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 35 | + if ($terms && ! is_wp_error($terms)) { |
|
| 36 | 36 | $groups = array(); |
| 37 | 37 | |
| 38 | - foreach ( $terms as $term ) { |
|
| 39 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 38 | + foreach ($terms as $term) { |
|
| 39 | + $groups[] = '<a href="' . get_term_link($term) . '">' . $term->name . '</a>'; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $groups = join( ', ', $groups ); |
|
| 42 | + $groups = join(', ', $groups); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Connections |
@@ -48,22 +48,22 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | // Connection Projects |
| 50 | 50 | |
| 51 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 51 | + if ($terms && ! is_wp_error($terms)) { |
|
| 52 | 52 | $groups_ = array(); |
| 53 | 53 | |
| 54 | - foreach ( $terms as $term ) { |
|
| 54 | + foreach ($terms as $term) { |
|
| 55 | 55 | $groups_[] = $term->term_id; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ( count( $groups_ ) > 0 ) { |
|
| 58 | + if (count($groups_) > 0) { |
|
| 59 | 59 | $connection_project['post_type'] = 'project'; |
| 60 | - $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
| 60 | + $connection_project['title'] = esc_html__('Related Projects', 'lsx-projects'); |
|
| 61 | 61 | //$connection_project['posts'] = get_post_meta( get_the_ID(), 'project_to_project', false ); |
| 62 | 62 | $connection_project['posts'] = array(); |
| 63 | 63 | |
| 64 | 64 | $args = array( |
| 65 | 65 | 'post_type' => 'project', |
| 66 | - 'post__not_in' => array( get_the_ID() ), |
|
| 66 | + 'post__not_in' => array(get_the_ID()), |
|
| 67 | 67 | 'no_found_rows' => true, |
| 68 | 68 | 'ignore_sticky_posts' => 1, |
| 69 | 69 | 'update_post_meta_cache' => false, |
@@ -75,18 +75,18 @@ discard block |
||
| 75 | 75 | ), |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | - $projects_ = new \WP_Query( $args ); |
|
| 78 | + $projects_ = new \WP_Query($args); |
|
| 79 | 79 | |
| 80 | - if ( $projects_->have_posts() ) { |
|
| 81 | - while ( $projects_->have_posts() ) { |
|
| 80 | + if ($projects_->have_posts()) { |
|
| 81 | + while ($projects_->have_posts()) { |
|
| 82 | 82 | $projects_->the_post(); |
| 83 | 83 | $connection_project['posts'][] = get_the_ID(); |
| 84 | 84 | wp_reset_postdata(); |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if ( ! empty( $connection_project['posts'] ) ) { |
|
| 89 | - $post_ids = join( ',', $connection_project['posts'] ); |
|
| 88 | + if ( ! empty($connection_project['posts'])) { |
|
| 89 | + $post_ids = join(',', $connection_project['posts']); |
|
| 90 | 90 | $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
| 91 | 91 | $connections[] = $connection_project; |
| 92 | 92 | } |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | // Connection Products |
| 97 | 97 | |
| 98 | - if ( class_exists( 'WooCommerce' ) ) { |
|
| 98 | + if (class_exists('WooCommerce')) { |
|
| 99 | 99 | $connection_product['post_type'] = 'product'; |
| 100 | - $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
| 101 | - $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
| 100 | + $connection_product['title'] = esc_html__('Related Products', 'lsx-projects') . ' <small>' . esc_html__('Products used to build this project', 'lsx-projects') . '</small>'; |
|
| 101 | + $connection_product['posts'] = get_post_meta(get_the_ID(), 'product_to_project', false); |
|
| 102 | 102 | |
| 103 | - if ( ! empty( $connection_product['posts'] ) ) { |
|
| 103 | + if ( ! empty($connection_product['posts'])) { |
|
| 104 | 104 | $connection_product['small_list_html'] = ''; |
| 105 | 105 | |
| 106 | 106 | $args = array( |
@@ -113,19 +113,19 @@ discard block |
||
| 113 | 113 | 'update_post_meta_cache' => false, |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
| 116 | + $connection_product['posts_obj'] = new \WP_Query($args); |
|
| 117 | 117 | |
| 118 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 118 | + if ($connection_product['posts_obj']->have_posts()) { |
|
| 119 | 119 | $connection_product['small_list_html'] = array(); |
| 120 | 120 | |
| 121 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 121 | + while ($connection_product['posts_obj']->have_posts()) { |
|
| 122 | 122 | $connection_product['posts_obj']->the_post(); |
| 123 | - $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 123 | + $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title('', '', false) . '</a>'; |
|
| 124 | 124 | wp_reset_postdata(); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $connection_product['posts_obj']->rewind_posts(); |
| 128 | - $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
| 128 | + $connection_product['small_list_html'] = join(', ', $connection_product['small_list_html']); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $connections[] = $connection_product; |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $connection_service['post_type'] = 'page'; |
| 138 | 138 | // $connection_service['title'] = esc_html__( 'Services', 'lsx-projects' ); |
| 139 | - $connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false ); |
|
| 139 | + $connection_service['pages'] = get_post_meta(get_the_ID(), 'page_to_project', false); |
|
| 140 | 140 | |
| 141 | - if ( ! empty( $connection_service['pages'] ) ) { |
|
| 142 | - $post_ids = join( ',', $connection_service['pages'] ); |
|
| 141 | + if ( ! empty($connection_service['pages'])) { |
|
| 142 | + $post_ids = join(',', $connection_service['pages']); |
|
| 143 | 143 | //$connection_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
| 144 | 144 | $connection_service['small_list_html'] = ''; |
| 145 | 145 | |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | 'update_post_meta_cache' => false, |
| 154 | 154 | ); |
| 155 | 155 | |
| 156 | - $services_ = new \WP_Query( $args ); |
|
| 156 | + $services_ = new \WP_Query($args); |
|
| 157 | 157 | |
| 158 | - if ( $services_->have_posts() ) { |
|
| 158 | + if ($services_->have_posts()) { |
|
| 159 | 159 | $connection_service['small_list_html'] = array(); |
| 160 | 160 | |
| 161 | - while ( $services_->have_posts() ) { |
|
| 161 | + while ($services_->have_posts()) { |
|
| 162 | 162 | $services_->the_post(); |
| 163 | - $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 163 | + $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title('', '', false) . '</a>'; |
|
| 164 | 164 | wp_reset_postdata(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
| 167 | + $connection_service['small_list_html'] = join(', ', $connection_service['small_list_html']); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $connections[] = $connection_service; |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $connection_testimonial['post_type'] = 'testimonial'; |
| 176 | 176 | // $connection_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-projects' ); |
| 177 | - $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
| 177 | + $connection_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_project', false); |
|
| 178 | 178 | |
| 179 | - if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
| 180 | - $post_ids = join( ',', $connection_testimonial['posts'] ); |
|
| 179 | + if ( ! empty($connection_testimonial['posts'])) { |
|
| 180 | + $post_ids = join(',', $connection_testimonial['posts']); |
|
| 181 | 181 | $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
| 182 | 182 | $connections[] = $connection_testimonial; |
| 183 | 183 | } |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $connection_team['post_type'] = 'team'; |
| 188 | 188 | // $connection_team['title'] = esc_html__( 'Team', 'lsx-projects' ); |
| 189 | - $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
| 189 | + $connection_team['posts'] = get_post_meta(get_the_ID(), 'team_to_project', false); |
|
| 190 | 190 | |
| 191 | - if ( ! empty( $connection_team['posts'] ) ) { |
|
| 192 | - $post_ids = join( ',', $connection_team['posts'] ); |
|
| 191 | + if ( ! empty($connection_team['posts'])) { |
|
| 192 | + $post_ids = join(',', $connection_team['posts']); |
|
| 193 | 193 | $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
| 194 | 194 | $connection_team['small_list_html'] = ''; |
| 195 | 195 | |
@@ -203,19 +203,19 @@ discard block |
||
| 203 | 203 | 'update_post_meta_cache' => false, |
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | - $team_ = new \WP_Query( $args ); |
|
| 206 | + $team_ = new \WP_Query($args); |
|
| 207 | 207 | |
| 208 | - if ( $team_->have_posts() ) { |
|
| 208 | + if ($team_->have_posts()) { |
|
| 209 | 209 | global $lsx_team; |
| 210 | 210 | $connection_team['small_list_html'] = array(); |
| 211 | 211 | |
| 212 | - while ( $team_->have_posts() ) { |
|
| 212 | + while ($team_->have_posts()) { |
|
| 213 | 213 | $team_->the_post(); |
| 214 | - $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
| 214 | + $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail(get_the_ID(), 'lsx-team-archive') . '</a>'; |
|
| 215 | 215 | wp_reset_postdata(); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
| 218 | + $connection_team['small_list_html'] = join(' ', $connection_team['small_list_html']); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $connections[] = $connection_team; |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | <div class="col-xs-12 col-sm-7 col-md-8"> |
| 233 | 233 | <div class="entry-content"><?php the_content(); ?></div> |
| 234 | 234 | |
| 235 | - <?php if ( count( $connections ) > 0 ) : ?> |
|
| 236 | - <?php foreach ( $connections as $i => $connection ) : ?> |
|
| 235 | + <?php if (count($connections) > 0) : ?> |
|
| 236 | + <?php foreach ($connections as $i => $connection) : ?> |
|
| 237 | 237 | <?php |
| 238 | - if ( 'testimonial' === $connection['post_type'] ) { |
|
| 238 | + if ('testimonial' === $connection['post_type']) { |
|
| 239 | 239 | echo '<div class="tab-pane-fake">'; |
| 240 | - echo do_shortcode( $connection['shortcode'] ); |
|
| 240 | + echo do_shortcode($connection['shortcode']); |
|
| 241 | 241 | echo '</div>'; |
| 242 | 242 | } |
| 243 | 243 | ?> |
@@ -248,83 +248,83 @@ discard block |
||
| 248 | 248 | <div class="col-xs-12 col-sm-5 col-md-4"> |
| 249 | 249 | <div class="entry-fixed-sidebar-wrapper"> |
| 250 | 250 | <div class="entry-fixed-sidebar"> |
| 251 | - <?php if ( ! empty( $client_logo ) ) : ?> |
|
| 252 | - <div class="entry-meta-single"><?php echo wp_kses_post( $client_logo ); ?></div> |
|
| 253 | - <?php elseif ( ! empty( $client ) ) : ?> |
|
| 254 | - <div class="entry-meta-single"><?php echo esc_html( $client ); ?></div> |
|
| 251 | + <?php if ( ! empty($client_logo)) : ?> |
|
| 252 | + <div class="entry-meta-single"><?php echo wp_kses_post($client_logo); ?></div> |
|
| 253 | + <?php elseif ( ! empty($client)) : ?> |
|
| 254 | + <div class="entry-meta-single"><?php echo esc_html($client); ?></div> |
|
| 255 | 255 | <?php endif; ?> |
| 256 | 256 | |
| 257 | - <?php if ( ! empty( $groups ) ) : ?> |
|
| 258 | - <div class="entry-meta-key"><?php esc_html_e( 'Industry:', 'lsx-projects' ); ?></div> |
|
| 259 | - <div class="entry-meta-value"><?php echo wp_kses_post( $groups ); ?></div> |
|
| 257 | + <?php if ( ! empty($groups)) : ?> |
|
| 258 | + <div class="entry-meta-key"><?php esc_html_e('Industry:', 'lsx-projects'); ?></div> |
|
| 259 | + <div class="entry-meta-value"><?php echo wp_kses_post($groups); ?></div> |
|
| 260 | 260 | <?php endif; ?> |
| 261 | 261 | |
| 262 | - <?php if ( ! empty( $connection_service['small_list_html'] ) ) : ?> |
|
| 263 | - <div class="entry-meta-key"><?php esc_html_e( 'Services:', 'lsx-projects' ); ?></div> |
|
| 264 | - <div class="entry-meta-value"><?php echo wp_kses_post( $connection_service['small_list_html'] ); ?></div> |
|
| 262 | + <?php if ( ! empty($connection_service['small_list_html'])) : ?> |
|
| 263 | + <div class="entry-meta-key"><?php esc_html_e('Services:', 'lsx-projects'); ?></div> |
|
| 264 | + <div class="entry-meta-value"><?php echo wp_kses_post($connection_service['small_list_html']); ?></div> |
|
| 265 | 265 | <?php endif; ?> |
| 266 | 266 | |
| 267 | - <?php if ( ! empty( $connection_product['small_list_html'] ) ) : ?> |
|
| 267 | + <?php if ( ! empty($connection_product['small_list_html'])) : ?> |
|
| 268 | 268 | <!-- |
| 269 | - <div class="entry-meta-key"><?php esc_html_e( 'Products used:', 'lsx-projects' ); ?></div> |
|
| 270 | - <div class="entry-meta-value"><?php echo wp_kses_post( $connection_product['small_list_html'] ); ?></div> |
|
| 269 | + <div class="entry-meta-key"><?php esc_html_e('Products used:', 'lsx-projects'); ?></div> |
|
| 270 | + <div class="entry-meta-value"><?php echo wp_kses_post($connection_product['small_list_html']); ?></div> |
|
| 271 | 271 | --> |
| 272 | 272 | <?php endif; ?> |
| 273 | 273 | |
| 274 | - <?php if ( ! empty( $connection_team['small_list_html'] ) ) : ?> |
|
| 275 | - <div class="entry-meta-key"><?php esc_html_e( 'Team members involved:', 'lsx-projects' ); ?></div> |
|
| 276 | - <div class="entry-meta-value entry-meta-value-team"><?php echo wp_kses_post( $connection_team['small_list_html'] ); ?></div> |
|
| 274 | + <?php if ( ! empty($connection_team['small_list_html'])) : ?> |
|
| 275 | + <div class="entry-meta-key"><?php esc_html_e('Team members involved:', 'lsx-projects'); ?></div> |
|
| 276 | + <div class="entry-meta-value entry-meta-value-team"><?php echo wp_kses_post($connection_team['small_list_html']); ?></div> |
|
| 277 | 277 | <?php endif; ?> |
| 278 | 278 | |
| 279 | - <?php if ( ! empty( $url ) ) : ?> |
|
| 280 | - <div class="entry-meta-single"><a href="<?php echo esc_url( $url ); ?>" target="_blank" rel="nofollow" class="btn btn-block secondary-btn"><?php esc_html_e( 'See website', 'lsx-projects' ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div> |
|
| 279 | + <?php if ( ! empty($url)) : ?> |
|
| 280 | + <div class="entry-meta-single"><a href="<?php echo esc_url($url); ?>" target="_blank" rel="nofollow" class="btn btn-block secondary-btn"><?php esc_html_e('See website', 'lsx-projects'); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div> |
|
| 281 | 281 | <?php endif; ?> |
| 282 | 282 | |
| 283 | - <?php if ( ! empty( $button_label ) ) : ?> |
|
| 284 | - <div class="entry-meta-single"><a href="#lsx-project-contact" data-toggle="modal" class="btn btn-block cta-btn"><?php echo esc_html( $button_label ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div> |
|
| 283 | + <?php if ( ! empty($button_label)) : ?> |
|
| 284 | + <div class="entry-meta-single"><a href="#lsx-project-contact" data-toggle="modal" class="btn btn-block cta-btn"><?php echo esc_html($button_label); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div> |
|
| 285 | 285 | <?php endif; ?> |
| 286 | 286 | </div> |
| 287 | 287 | </div> |
| 288 | 288 | </div> |
| 289 | 289 | </div> |
| 290 | 290 | |
| 291 | - <?php if ( count( $connections ) > 0 ) : ?> |
|
| 292 | - <?php foreach ( $connections as $i => $connection ) : ?> |
|
| 291 | + <?php if (count($connections) > 0) : ?> |
|
| 292 | + <?php foreach ($connections as $i => $connection) : ?> |
|
| 293 | 293 | <?php |
| 294 | 294 | // Team is now visible on detail box |
| 295 | 295 | // Services is now visible on detail box |
| 296 | 296 | // Testimonials is now visible below the content |
| 297 | - if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) { |
|
| 297 | + if (in_array($connection['post_type'], array('team', 'testimonial', 'service'))) { |
|
| 298 | 298 | continue; |
| 299 | 299 | } |
| 300 | 300 | ?> |
| 301 | - <?php if ( 'page' !== $connection['post_type'] ) { ?> |
|
| 301 | + <?php if ('page' !== $connection['post_type']) { ?> |
|
| 302 | 302 | <div class="lsx-projects-section lsx-full-width"> |
| 303 | 303 | <div class="row"> |
| 304 | 304 | <div class="col-xs-12"> |
| 305 | - <h3 class="lsx-title"><?php echo wp_kses_post( $connection['title'] ); ?></h3> |
|
| 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 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 308 | + if ('product' === $connection['post_type']) { |
|
| 309 | + if ($connection_product['posts_obj']->have_posts()) { |
|
| 310 | 310 | // @codingStandardsIgnoreLine |
| 311 | - echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 311 | + echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">'); |
|
| 312 | 312 | |
| 313 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 313 | + while ($connection_product['posts_obj']->have_posts()) { |
|
| 314 | 314 | $connection_product['posts_obj']->the_post(); |
| 315 | 315 | |
| 316 | - wc_get_template( 'content-widget-product.php', array( |
|
| 316 | + wc_get_template('content-widget-product.php', array( |
|
| 317 | 317 | 'show_rating' => false, |
| 318 | - ) ); |
|
| 318 | + )); |
|
| 319 | 319 | |
| 320 | 320 | wp_reset_postdata(); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | // @codingStandardsIgnoreLine |
| 324 | - echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
| 324 | + echo apply_filters('woocommerce_after_widget_product_list', '</ul>'); |
|
| 325 | 325 | } |
| 326 | 326 | } else { |
| 327 | - echo do_shortcode( $connection['shortcode'] ); |
|
| 327 | + echo do_shortcode($connection['shortcode']); |
|
| 328 | 328 | } |
| 329 | 329 | ?> |
| 330 | 330 | </div> |
@@ -5,221 +5,221 @@ discard block |
||
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | 7 | <?php |
| 8 | - $client = get_post_meta( get_the_ID(), 'lsx_project_client', true ); |
|
| 9 | - $client_logo = get_post_meta( get_the_ID(), 'lsx_project_client_logo', true ); |
|
| 10 | - $url = get_post_meta( get_the_ID(), 'lsx_project_url', true ); |
|
| 11 | - |
|
| 12 | - global $lsx_projects; |
|
| 13 | - |
|
| 14 | - $button_label = ''; |
|
| 15 | - $button_cf_id = ''; |
|
| 16 | - |
|
| 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 | - } |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - if ( ! empty( $client_logo ) ) { |
|
| 25 | - $client_logo = wp_get_attachment_image_src( $client_logo, 'full' ); |
|
| 26 | - |
|
| 27 | - if ( is_array( $client_logo ) ) { |
|
| 28 | - $client_logo = '<img src="' . $client_logo[0] . '">'; |
|
| 29 | - } |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - $groups = ''; |
|
| 33 | - $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 34 | - |
|
| 35 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 36 | - $groups = array(); |
|
| 37 | - |
|
| 38 | - foreach ( $terms as $term ) { |
|
| 39 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $groups = join( ', ', $groups ); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - // Connections |
|
| 46 | - |
|
| 47 | - $connections = array(); |
|
| 48 | - |
|
| 49 | - // Connection Projects |
|
| 50 | - |
|
| 51 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 52 | - $groups_ = array(); |
|
| 53 | - |
|
| 54 | - foreach ( $terms as $term ) { |
|
| 55 | - $groups_[] = $term->term_id; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if ( count( $groups_ ) > 0 ) { |
|
| 59 | - $connection_project['post_type'] = 'project'; |
|
| 60 | - $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
| 61 | - //$connection_project['posts'] = get_post_meta( get_the_ID(), 'project_to_project', false ); |
|
| 62 | - $connection_project['posts'] = array(); |
|
| 63 | - |
|
| 64 | - $args = array( |
|
| 65 | - 'post_type' => 'project', |
|
| 66 | - 'post__not_in' => array( get_the_ID() ), |
|
| 67 | - 'no_found_rows' => true, |
|
| 68 | - 'ignore_sticky_posts' => 1, |
|
| 69 | - 'update_post_meta_cache' => false, |
|
| 70 | - 'tax_query' => array( |
|
| 71 | - array( |
|
| 72 | - 'taxonomy' => 'project-group', |
|
| 73 | - 'terms' => $groups_, |
|
| 74 | - ), |
|
| 75 | - ), |
|
| 76 | - ); |
|
| 77 | - |
|
| 78 | - $projects_ = new \WP_Query( $args ); |
|
| 79 | - |
|
| 80 | - if ( $projects_->have_posts() ) { |
|
| 81 | - while ( $projects_->have_posts() ) { |
|
| 82 | - $projects_->the_post(); |
|
| 83 | - $connection_project['posts'][] = get_the_ID(); |
|
| 84 | - wp_reset_postdata(); |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - if ( ! empty( $connection_project['posts'] ) ) { |
|
| 89 | - $post_ids = join( ',', $connection_project['posts'] ); |
|
| 90 | - $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 91 | - $connections[] = $connection_project; |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - // Connection Products |
|
| 97 | - |
|
| 98 | - if ( class_exists( 'WooCommerce' ) ) { |
|
| 99 | - $connection_product['post_type'] = 'product'; |
|
| 100 | - $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
| 101 | - $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
| 102 | - |
|
| 103 | - if ( ! empty( $connection_product['posts'] ) ) { |
|
| 104 | - $connection_product['small_list_html'] = ''; |
|
| 105 | - |
|
| 106 | - $args = array( |
|
| 107 | - 'post_type' => 'product', |
|
| 108 | - 'post__in' => $connection_product['posts'], |
|
| 109 | - 'orderby' => 'post__in', |
|
| 110 | - 'no_found_rows' => true, |
|
| 111 | - 'ignore_sticky_posts' => 1, |
|
| 112 | - 'update_post_term_cache' => false, |
|
| 113 | - 'update_post_meta_cache' => false, |
|
| 114 | - ); |
|
| 115 | - |
|
| 116 | - $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
| 117 | - |
|
| 118 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 119 | - $connection_product['small_list_html'] = array(); |
|
| 120 | - |
|
| 121 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 122 | - $connection_product['posts_obj']->the_post(); |
|
| 123 | - $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 124 | - wp_reset_postdata(); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $connection_product['posts_obj']->rewind_posts(); |
|
| 128 | - $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $connections[] = $connection_product; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - // Connection Services |
|
| 136 | - |
|
| 137 | - $connection_service['post_type'] = 'page'; |
|
| 138 | - // $connection_service['title'] = esc_html__( 'Services', 'lsx-projects' ); |
|
| 139 | - $connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false ); |
|
| 140 | - |
|
| 141 | - if ( ! empty( $connection_service['pages'] ) ) { |
|
| 142 | - $post_ids = join( ',', $connection_service['pages'] ); |
|
| 143 | - //$connection_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
| 144 | - $connection_service['small_list_html'] = ''; |
|
| 145 | - |
|
| 146 | - $args = array( |
|
| 147 | - 'post_type' => 'page', |
|
| 148 | - 'post__in' => $connection_service['pages'], |
|
| 149 | - 'orderby' => 'post__in', |
|
| 150 | - 'no_found_rows' => true, |
|
| 151 | - 'ignore_sticky_posts' => 1, |
|
| 152 | - 'update_post_term_cache' => false, |
|
| 153 | - 'update_post_meta_cache' => false, |
|
| 154 | - ); |
|
| 155 | - |
|
| 156 | - $services_ = new \WP_Query( $args ); |
|
| 157 | - |
|
| 158 | - if ( $services_->have_posts() ) { |
|
| 159 | - $connection_service['small_list_html'] = array(); |
|
| 160 | - |
|
| 161 | - while ( $services_->have_posts() ) { |
|
| 162 | - $services_->the_post(); |
|
| 163 | - $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 164 | - wp_reset_postdata(); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - $connections[] = $connection_service; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // Connection Testimonials |
|
| 174 | - |
|
| 175 | - $connection_testimonial['post_type'] = 'testimonial'; |
|
| 176 | - // $connection_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-projects' ); |
|
| 177 | - $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
| 178 | - |
|
| 179 | - if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
| 180 | - $post_ids = join( ',', $connection_testimonial['posts'] ); |
|
| 181 | - $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
|
| 182 | - $connections[] = $connection_testimonial; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - // Connection Team |
|
| 186 | - |
|
| 187 | - $connection_team['post_type'] = 'team'; |
|
| 188 | - // $connection_team['title'] = esc_html__( 'Team', 'lsx-projects' ); |
|
| 189 | - $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
| 190 | - |
|
| 191 | - if ( ! empty( $connection_team['posts'] ) ) { |
|
| 192 | - $post_ids = join( ',', $connection_team['posts'] ); |
|
| 193 | - $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
|
| 194 | - $connection_team['small_list_html'] = ''; |
|
| 195 | - |
|
| 196 | - $args = array( |
|
| 197 | - 'post_type' => 'team', |
|
| 198 | - 'post__in' => $connection_team['posts'], |
|
| 199 | - 'orderby' => 'post__in', |
|
| 200 | - 'no_found_rows' => true, |
|
| 201 | - 'ignore_sticky_posts' => 1, |
|
| 202 | - 'update_post_term_cache' => false, |
|
| 203 | - 'update_post_meta_cache' => false, |
|
| 204 | - ); |
|
| 205 | - |
|
| 206 | - $team_ = new \WP_Query( $args ); |
|
| 207 | - |
|
| 208 | - if ( $team_->have_posts() ) { |
|
| 209 | - global $lsx_team; |
|
| 210 | - $connection_team['small_list_html'] = array(); |
|
| 211 | - |
|
| 212 | - while ( $team_->have_posts() ) { |
|
| 213 | - $team_->the_post(); |
|
| 214 | - $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
| 215 | - wp_reset_postdata(); |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - $connections[] = $connection_team; |
|
| 222 | - } |
|
| 8 | + $client = get_post_meta( get_the_ID(), 'lsx_project_client', true ); |
|
| 9 | + $client_logo = get_post_meta( get_the_ID(), 'lsx_project_client_logo', true ); |
|
| 10 | + $url = get_post_meta( get_the_ID(), 'lsx_project_url', true ); |
|
| 11 | + |
|
| 12 | + global $lsx_projects; |
|
| 13 | + |
|
| 14 | + $button_label = ''; |
|
| 15 | + $button_cf_id = ''; |
|
| 16 | + |
|
| 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 | + } |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + if ( ! empty( $client_logo ) ) { |
|
| 25 | + $client_logo = wp_get_attachment_image_src( $client_logo, 'full' ); |
|
| 26 | + |
|
| 27 | + if ( is_array( $client_logo ) ) { |
|
| 28 | + $client_logo = '<img src="' . $client_logo[0] . '">'; |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + $groups = ''; |
|
| 33 | + $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 34 | + |
|
| 35 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 36 | + $groups = array(); |
|
| 37 | + |
|
| 38 | + foreach ( $terms as $term ) { |
|
| 39 | + $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $groups = join( ', ', $groups ); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + // Connections |
|
| 46 | + |
|
| 47 | + $connections = array(); |
|
| 48 | + |
|
| 49 | + // Connection Projects |
|
| 50 | + |
|
| 51 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 52 | + $groups_ = array(); |
|
| 53 | + |
|
| 54 | + foreach ( $terms as $term ) { |
|
| 55 | + $groups_[] = $term->term_id; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if ( count( $groups_ ) > 0 ) { |
|
| 59 | + $connection_project['post_type'] = 'project'; |
|
| 60 | + $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' ); |
|
| 61 | + //$connection_project['posts'] = get_post_meta( get_the_ID(), 'project_to_project', false ); |
|
| 62 | + $connection_project['posts'] = array(); |
|
| 63 | + |
|
| 64 | + $args = array( |
|
| 65 | + 'post_type' => 'project', |
|
| 66 | + 'post__not_in' => array( get_the_ID() ), |
|
| 67 | + 'no_found_rows' => true, |
|
| 68 | + 'ignore_sticky_posts' => 1, |
|
| 69 | + 'update_post_meta_cache' => false, |
|
| 70 | + 'tax_query' => array( |
|
| 71 | + array( |
|
| 72 | + 'taxonomy' => 'project-group', |
|
| 73 | + 'terms' => $groups_, |
|
| 74 | + ), |
|
| 75 | + ), |
|
| 76 | + ); |
|
| 77 | + |
|
| 78 | + $projects_ = new \WP_Query( $args ); |
|
| 79 | + |
|
| 80 | + if ( $projects_->have_posts() ) { |
|
| 81 | + while ( $projects_->have_posts() ) { |
|
| 82 | + $projects_->the_post(); |
|
| 83 | + $connection_project['posts'][] = get_the_ID(); |
|
| 84 | + wp_reset_postdata(); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + if ( ! empty( $connection_project['posts'] ) ) { |
|
| 89 | + $post_ids = join( ',', $connection_project['posts'] ); |
|
| 90 | + $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 91 | + $connections[] = $connection_project; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + // Connection Products |
|
| 97 | + |
|
| 98 | + if ( class_exists( 'WooCommerce' ) ) { |
|
| 99 | + $connection_product['post_type'] = 'product'; |
|
| 100 | + $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>'; |
|
| 101 | + $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false ); |
|
| 102 | + |
|
| 103 | + if ( ! empty( $connection_product['posts'] ) ) { |
|
| 104 | + $connection_product['small_list_html'] = ''; |
|
| 105 | + |
|
| 106 | + $args = array( |
|
| 107 | + 'post_type' => 'product', |
|
| 108 | + 'post__in' => $connection_product['posts'], |
|
| 109 | + 'orderby' => 'post__in', |
|
| 110 | + 'no_found_rows' => true, |
|
| 111 | + 'ignore_sticky_posts' => 1, |
|
| 112 | + 'update_post_term_cache' => false, |
|
| 113 | + 'update_post_meta_cache' => false, |
|
| 114 | + ); |
|
| 115 | + |
|
| 116 | + $connection_product['posts_obj'] = new \WP_Query( $args ); |
|
| 117 | + |
|
| 118 | + if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 119 | + $connection_product['small_list_html'] = array(); |
|
| 120 | + |
|
| 121 | + while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 122 | + $connection_product['posts_obj']->the_post(); |
|
| 123 | + $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 124 | + wp_reset_postdata(); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $connection_product['posts_obj']->rewind_posts(); |
|
| 128 | + $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] ); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $connections[] = $connection_product; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + // Connection Services |
|
| 136 | + |
|
| 137 | + $connection_service['post_type'] = 'page'; |
|
| 138 | + // $connection_service['title'] = esc_html__( 'Services', 'lsx-projects' ); |
|
| 139 | + $connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false ); |
|
| 140 | + |
|
| 141 | + if ( ! empty( $connection_service['pages'] ) ) { |
|
| 142 | + $post_ids = join( ',', $connection_service['pages'] ); |
|
| 143 | + //$connection_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
| 144 | + $connection_service['small_list_html'] = ''; |
|
| 145 | + |
|
| 146 | + $args = array( |
|
| 147 | + 'post_type' => 'page', |
|
| 148 | + 'post__in' => $connection_service['pages'], |
|
| 149 | + 'orderby' => 'post__in', |
|
| 150 | + 'no_found_rows' => true, |
|
| 151 | + 'ignore_sticky_posts' => 1, |
|
| 152 | + 'update_post_term_cache' => false, |
|
| 153 | + 'update_post_meta_cache' => false, |
|
| 154 | + ); |
|
| 155 | + |
|
| 156 | + $services_ = new \WP_Query( $args ); |
|
| 157 | + |
|
| 158 | + if ( $services_->have_posts() ) { |
|
| 159 | + $connection_service['small_list_html'] = array(); |
|
| 160 | + |
|
| 161 | + while ( $services_->have_posts() ) { |
|
| 162 | + $services_->the_post(); |
|
| 163 | + $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>'; |
|
| 164 | + wp_reset_postdata(); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] ); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + $connections[] = $connection_service; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // Connection Testimonials |
|
| 174 | + |
|
| 175 | + $connection_testimonial['post_type'] = 'testimonial'; |
|
| 176 | + // $connection_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-projects' ); |
|
| 177 | + $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false ); |
|
| 178 | + |
|
| 179 | + if ( ! empty( $connection_testimonial['posts'] ) ) { |
|
| 180 | + $post_ids = join( ',', $connection_testimonial['posts'] ); |
|
| 181 | + $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]'; |
|
| 182 | + $connections[] = $connection_testimonial; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + // Connection Team |
|
| 186 | + |
|
| 187 | + $connection_team['post_type'] = 'team'; |
|
| 188 | + // $connection_team['title'] = esc_html__( 'Team', 'lsx-projects' ); |
|
| 189 | + $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false ); |
|
| 190 | + |
|
| 191 | + if ( ! empty( $connection_team['posts'] ) ) { |
|
| 192 | + $post_ids = join( ',', $connection_team['posts'] ); |
|
| 193 | + $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]'; |
|
| 194 | + $connection_team['small_list_html'] = ''; |
|
| 195 | + |
|
| 196 | + $args = array( |
|
| 197 | + 'post_type' => 'team', |
|
| 198 | + 'post__in' => $connection_team['posts'], |
|
| 199 | + 'orderby' => 'post__in', |
|
| 200 | + 'no_found_rows' => true, |
|
| 201 | + 'ignore_sticky_posts' => 1, |
|
| 202 | + 'update_post_term_cache' => false, |
|
| 203 | + 'update_post_meta_cache' => false, |
|
| 204 | + ); |
|
| 205 | + |
|
| 206 | + $team_ = new \WP_Query( $args ); |
|
| 207 | + |
|
| 208 | + if ( $team_->have_posts() ) { |
|
| 209 | + global $lsx_team; |
|
| 210 | + $connection_team['small_list_html'] = array(); |
|
| 211 | + |
|
| 212 | + while ( $team_->have_posts() ) { |
|
| 213 | + $team_->the_post(); |
|
| 214 | + $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>'; |
|
| 215 | + wp_reset_postdata(); |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] ); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + $connections[] = $connection_team; |
|
| 222 | + } |
|
| 223 | 223 | ?> |
| 224 | 224 | |
| 225 | 225 | <?php lsx_entry_before(); ?> |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | <?php if ( count( $connections ) > 0 ) : ?> |
| 236 | 236 | <?php foreach ( $connections as $i => $connection ) : ?> |
| 237 | 237 | <?php |
| 238 | - if ( 'testimonial' === $connection['post_type'] ) { |
|
| 239 | - echo '<div class="tab-pane-fake">'; |
|
| 240 | - echo do_shortcode( $connection['shortcode'] ); |
|
| 241 | - echo '</div>'; |
|
| 242 | - } |
|
| 243 | - ?> |
|
| 238 | + if ( 'testimonial' === $connection['post_type'] ) { |
|
| 239 | + echo '<div class="tab-pane-fake">'; |
|
| 240 | + echo do_shortcode( $connection['shortcode'] ); |
|
| 241 | + echo '</div>'; |
|
| 242 | + } |
|
| 243 | + ?> |
|
| 244 | 244 | <?php endforeach; ?> |
| 245 | 245 | <?php endif; ?> |
| 246 | 246 | </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 | - if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 310 | - // @codingStandardsIgnoreLine |
|
| 311 | - echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 312 | - |
|
| 313 | - while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 314 | - $connection_product['posts_obj']->the_post(); |
|
| 315 | - |
|
| 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 | + if ( $connection_product['posts_obj']->have_posts() ) { |
|
| 310 | + // @codingStandardsIgnoreLine |
|
| 311 | + echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 312 | + |
|
| 313 | + while ( $connection_product['posts_obj']->have_posts() ) { |
|
| 314 | + $connection_product['posts_obj']->the_post(); |
|
| 315 | + |
|
| 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 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * Contructor |
| 30 | 30 | */ |
| 31 | 31 | public function __construct() { |
| 32 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
| 32 | + add_action('init', array($this, 'cmb2_post_search_ajax')); |
|
| 33 | 33 | $this->load_vendors(); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public static function get_instance() { |
| 44 | 44 | |
| 45 | 45 | // If the single instance hasn't been set, set it now. |
| 46 | - if ( null === self::$instance ) { |
|
| 46 | + if (null === self::$instance) { |
|
| 47 | 47 | self::$instance = new self(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | private function load_vendors() { |
| 58 | 58 | // Configure custom fields. |
| 59 | - if ( ! class_exists( 'CMB2' ) ) { |
|
| 59 | + if ( ! class_exists('CMB2')) { |
|
| 60 | 60 | require_once LSX_PROJECTS_PATH . 'vendor/CMB2/init.php'; |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | 69 | public function get_post_types() { |
| 70 | - $post_types = apply_filters( 'lsx_projects_post_types', isset( $this->post_types ) ); |
|
| 71 | - foreach ( $post_types as $index => $post_type ) { |
|
| 72 | - $is_disabled = \cmb2_get_option( 'lsx_projects_options', $post_type . '_disabled', false ); |
|
| 73 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
| 74 | - unset( $post_types[ $index ] ); |
|
| 70 | + $post_types = apply_filters('lsx_projects_post_types', isset($this->post_types)); |
|
| 71 | + foreach ($post_types as $index => $post_type) { |
|
| 72 | + $is_disabled = \cmb2_get_option('lsx_projects_options', $post_type . '_disabled', false); |
|
| 73 | + if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) { |
|
| 74 | + unset($post_types[$index]); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | return $post_types; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function cmb2_post_search_ajax() { |
| 86 | 86 | require_once LSX_PROJECTS_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
| 87 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
| 87 | + if (method_exists('MAG_CMB2_Field_Post_Search_Ajax', 'get_instance')) { |
|
| 88 | 88 | $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -7,87 +7,87 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class LSX_Projects_Core { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * Holds class instance |
|
| 12 | - * |
|
| 13 | - * @since 1.0.0 |
|
| 14 | - * |
|
| 15 | - * @var object \lsx_projects\classes\Core() |
|
| 16 | - */ |
|
| 17 | - protected static $instance = null; |
|
| 10 | + /** |
|
| 11 | + * Holds class instance |
|
| 12 | + * |
|
| 13 | + * @since 1.0.0 |
|
| 14 | + * |
|
| 15 | + * @var object \lsx_projects\classes\Core() |
|
| 16 | + */ |
|
| 17 | + protected static $instance = null; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Holds class instance |
|
| 21 | - * |
|
| 22 | - * @since 1.0.0 |
|
| 23 | - * |
|
| 24 | - * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
| 25 | - */ |
|
| 26 | - public $cmb2_post_search_ajax = false; |
|
| 19 | + /** |
|
| 20 | + * Holds class instance |
|
| 21 | + * |
|
| 22 | + * @since 1.0.0 |
|
| 23 | + * |
|
| 24 | + * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
| 25 | + */ |
|
| 26 | + public $cmb2_post_search_ajax = false; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Contructor |
|
| 30 | - */ |
|
| 31 | - public function __construct() { |
|
| 32 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
| 33 | - $this->load_vendors(); |
|
| 34 | - } |
|
| 28 | + /** |
|
| 29 | + * Contructor |
|
| 30 | + */ |
|
| 31 | + public function __construct() { |
|
| 32 | + add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
| 33 | + $this->load_vendors(); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Return an instance of this class. |
|
| 38 | - * |
|
| 39 | - * @since 1.0.0 |
|
| 40 | - * |
|
| 41 | - * @return object \lsx_projects\classes\Core() A single instance of this class. |
|
| 42 | - */ |
|
| 43 | - public static function get_instance() { |
|
| 36 | + /** |
|
| 37 | + * Return an instance of this class. |
|
| 38 | + * |
|
| 39 | + * @since 1.0.0 |
|
| 40 | + * |
|
| 41 | + * @return object \lsx_projects\classes\Core() A single instance of this class. |
|
| 42 | + */ |
|
| 43 | + public static function get_instance() { |
|
| 44 | 44 | |
| 45 | - // If the single instance hasn't been set, set it now. |
|
| 46 | - if ( null === self::$instance ) { |
|
| 47 | - self::$instance = new self(); |
|
| 48 | - } |
|
| 45 | + // If the single instance hasn't been set, set it now. |
|
| 46 | + if ( null === self::$instance ) { |
|
| 47 | + self::$instance = new self(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return self::$instance; |
|
| 50 | + return self::$instance; |
|
| 51 | 51 | |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Loads the plugin functions. |
|
| 56 | - */ |
|
| 57 | - private function load_vendors() { |
|
| 58 | - // Configure custom fields. |
|
| 59 | - if ( ! class_exists( 'CMB2' ) ) { |
|
| 60 | - require_once LSX_PROJECTS_PATH . 'vendor/CMB2/init.php'; |
|
| 61 | - } |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * Loads the plugin functions. |
|
| 56 | + */ |
|
| 57 | + private function load_vendors() { |
|
| 58 | + // Configure custom fields. |
|
| 59 | + if ( ! class_exists( 'CMB2' ) ) { |
|
| 60 | + require_once LSX_PROJECTS_PATH . 'vendor/CMB2/init.php'; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Returns the post types currently active |
|
| 66 | - * |
|
| 67 | - * @return void |
|
| 68 | - */ |
|
| 69 | - public function get_post_types() { |
|
| 70 | - $post_types = apply_filters( 'lsx_projects_post_types', isset( $this->post_types ) ); |
|
| 71 | - foreach ( $post_types as $index => $post_type ) { |
|
| 72 | - $is_disabled = \cmb2_get_option( 'lsx_projects_options', $post_type . '_disabled', false ); |
|
| 73 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
| 74 | - unset( $post_types[ $index ] ); |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - return $post_types; |
|
| 78 | - } |
|
| 64 | + /** |
|
| 65 | + * Returns the post types currently active |
|
| 66 | + * |
|
| 67 | + * @return void |
|
| 68 | + */ |
|
| 69 | + public function get_post_types() { |
|
| 70 | + $post_types = apply_filters( 'lsx_projects_post_types', isset( $this->post_types ) ); |
|
| 71 | + foreach ( $post_types as $index => $post_type ) { |
|
| 72 | + $is_disabled = \cmb2_get_option( 'lsx_projects_options', $post_type . '_disabled', false ); |
|
| 73 | + if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
| 74 | + unset( $post_types[ $index ] ); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + return $post_types; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Includes the Post Search Ajax if it is there. |
|
| 82 | - * |
|
| 83 | - * @return void |
|
| 84 | - */ |
|
| 85 | - public function cmb2_post_search_ajax() { |
|
| 86 | - require_once LSX_PROJECTS_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
| 87 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
| 88 | - $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
| 89 | - } |
|
| 90 | - } |
|
| 80 | + /** |
|
| 81 | + * Includes the Post Search Ajax if it is there. |
|
| 82 | + * |
|
| 83 | + * @return void |
|
| 84 | + */ |
|
| 85 | + public function cmb2_post_search_ajax() { |
|
| 86 | + require_once LSX_PROJECTS_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
| 87 | + if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
| 88 | + $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | LSX_Projects_Core::get_instance(); |
@@ -7,55 +7,55 @@ |
||
| 7 | 7 | <?php |
| 8 | 8 | $groups = ''; |
| 9 | 9 | $groups_class = ''; |
| 10 | - $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 10 | + $terms = get_the_terms(get_the_ID(), 'project-group'); |
|
| 11 | 11 | $lsx_projects_frontend = projects_get_options(); |
| 12 | 12 | |
| 13 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 13 | + if ($terms && ! is_wp_error($terms)) { |
|
| 14 | 14 | $groups = array(); |
| 15 | 15 | $groups_class = array(); |
| 16 | 16 | |
| 17 | - foreach ( $terms as $term ) { |
|
| 18 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 17 | + foreach ($terms as $term) { |
|
| 18 | + $groups[] = '<a href="' . get_term_link($term) . '">' . $term->name . '</a>'; |
|
| 19 | 19 | $groups_class[] = 'filter-' . $term->slug; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - $groups = join( ', ', $groups ); |
|
| 23 | - $groups_class = join( ' ', $groups_class ); |
|
| 22 | + $groups = join(', ', $groups); |
|
| 23 | + $groups_class = join(' ', $groups_class); |
|
| 24 | 24 | } |
| 25 | 25 | ?> |
| 26 | 26 | |
| 27 | -<div class="col-xs-12 col-sm-6 col-md-4 lsx-projects-column <?php echo esc_attr( $groups_class ); ?>"> |
|
| 27 | +<div class="col-xs-12 col-sm-6 col-md-4 lsx-projects-column <?php echo esc_attr($groups_class); ?>"> |
|
| 28 | 28 | <article class="lsx-projects-slot"> |
| 29 | - <?php if ( ! empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) { ?> |
|
| 30 | - <?php if ( 'on' !== projects_get_option( 'projects_disable_single', false ) ) { ?> |
|
| 31 | - <a href="<?php the_permalink(); ?>"><figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure></a> |
|
| 29 | + <?php if ( ! empty(lsx_get_thumbnail('lsx-thumbnail-single'))) { ?> |
|
| 30 | + <?php if ('on' !== projects_get_option('projects_disable_single', false)) { ?> |
|
| 31 | + <a href="<?php the_permalink(); ?>"><figure class="lsx-projects-avatar"><?php lsx_thumbnail('lsx-thumbnail-single'); ?></figure></a> |
|
| 32 | 32 | <?php } else { ?> |
| 33 | - <figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure> |
|
| 33 | + <figure class="lsx-projects-avatar"><?php lsx_thumbnail('lsx-thumbnail-single'); ?></figure> |
|
| 34 | 34 | <?php } ?> |
| 35 | 35 | <?php } ?> |
| 36 | 36 | |
| 37 | 37 | <?php |
| 38 | - if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) { |
|
| 39 | - if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) { |
|
| 40 | - echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' ); |
|
| 38 | + if (empty(lsx_get_thumbnail('lsx-thumbnail-single'))) { |
|
| 39 | + if ( ! empty(projects_get_option('projects_placeholder'))) { |
|
| 40 | + echo wp_kses_post('<img src="' . projects_get_option('projects_placeholder') . '" width="auto" alt="placeholder" />'); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | ?> |
| 44 | 44 | |
| 45 | 45 | <h5 class="lsx-projects-title"> |
| 46 | - <?php if ( 'on' !== projects_get_option( 'projects_disable_single', false ) ) { ?> |
|
| 46 | + <?php if ('on' !== projects_get_option('projects_disable_single', false)) { ?> |
|
| 47 | 47 | <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
| 48 | 48 | <?php } else { ?> |
| 49 | 49 | <?php the_title(); ?> |
| 50 | 50 | <?php } ?> |
| 51 | 51 | </h5> |
| 52 | 52 | |
| 53 | - <?php if ( ! empty( $groups ) ) : ?> |
|
| 54 | - <p class="lsx-projects-groups"><?php echo wp_kses_post( $groups ); ?></p> |
|
| 53 | + <?php if ( ! empty($groups)) : ?> |
|
| 54 | + <p class="lsx-projects-groups"><?php echo wp_kses_post($groups); ?></p> |
|
| 55 | 55 | <?php endif; ?> |
| 56 | 56 | |
| 57 | - <?php if ( 'on' !== projects_get_option( 'projects_disable_single', false ) ) { ?> |
|
| 58 | - <div class="lsx-projects-content"><a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-projects' ); ?></a></div> |
|
| 57 | + <?php if ('on' !== projects_get_option('projects_disable_single', false)) { ?> |
|
| 58 | + <div class="lsx-projects-content"><a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e('View more', 'lsx-projects'); ?></a></div> |
|
| 59 | 59 | <?php } ?> |
| 60 | 60 | </article> |
| 61 | 61 | </div> |
@@ -5,23 +5,23 @@ discard block |
||
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | 7 | <?php |
| 8 | - $groups = ''; |
|
| 9 | - $groups_class = ''; |
|
| 10 | - $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 11 | - $lsx_projects_frontend = projects_get_options(); |
|
| 12 | - |
|
| 13 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 14 | - $groups = array(); |
|
| 15 | - $groups_class = array(); |
|
| 16 | - |
|
| 17 | - foreach ( $terms as $term ) { |
|
| 18 | - $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 19 | - $groups_class[] = 'filter-' . $term->slug; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - $groups = join( ', ', $groups ); |
|
| 23 | - $groups_class = join( ' ', $groups_class ); |
|
| 24 | - } |
|
| 8 | + $groups = ''; |
|
| 9 | + $groups_class = ''; |
|
| 10 | + $terms = get_the_terms( get_the_ID(), 'project-group' ); |
|
| 11 | + $lsx_projects_frontend = projects_get_options(); |
|
| 12 | + |
|
| 13 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 14 | + $groups = array(); |
|
| 15 | + $groups_class = array(); |
|
| 16 | + |
|
| 17 | + foreach ( $terms as $term ) { |
|
| 18 | + $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>'; |
|
| 19 | + $groups_class[] = 'filter-' . $term->slug; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + $groups = join( ', ', $groups ); |
|
| 23 | + $groups_class = join( ' ', $groups_class ); |
|
| 24 | + } |
|
| 25 | 25 | ?> |
| 26 | 26 | |
| 27 | 27 | <div class="col-xs-12 col-sm-6 col-md-4 lsx-projects-column <?php echo esc_attr( $groups_class ); ?>"> |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | <?php } ?> |
| 36 | 36 | |
| 37 | 37 | <?php |
| 38 | - if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) { |
|
| 39 | - if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) { |
|
| 40 | - echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' ); |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - ?> |
|
| 38 | + if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) { |
|
| 39 | + if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) { |
|
| 40 | + echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' ); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + ?> |
|
| 44 | 44 | |
| 45 | 45 | <h5 class="lsx-projects-title"> |
| 46 | 46 | <?php if ( 'on' !== projects_get_option( 'projects_disable_single', false ) ) { ?> |
@@ -11,186 +11,186 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class Settings_Theme { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Holds class instance |
|
| 16 | - * |
|
| 17 | - * @since 1.0.0 |
|
| 18 | - * |
|
| 19 | - * @var object \lsx\projects\classes\admin\Settings_Theme() |
|
| 20 | - */ |
|
| 21 | - protected static $instance = null; |
|
| 14 | + /** |
|
| 15 | + * Holds class instance |
|
| 16 | + * |
|
| 17 | + * @since 1.0.0 |
|
| 18 | + * |
|
| 19 | + * @var object \lsx\projects\classes\admin\Settings_Theme() |
|
| 20 | + */ |
|
| 21 | + protected static $instance = null; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Will return true if this is the LSX projects settings page. |
|
| 25 | - * |
|
| 26 | - * @var array |
|
| 27 | - */ |
|
| 28 | - public $is_options_page = false; |
|
| 23 | + /** |
|
| 24 | + * Will return true if this is the LSX projects settings page. |
|
| 25 | + * |
|
| 26 | + * @var array |
|
| 27 | + */ |
|
| 28 | + public $is_options_page = false; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Holds the id and labels for the navigation. |
|
| 32 | - * |
|
| 33 | - * @var array |
|
| 34 | - */ |
|
| 35 | - public $navigation = array(); |
|
| 30 | + /** |
|
| 31 | + * Holds the id and labels for the navigation. |
|
| 32 | + * |
|
| 33 | + * @var array |
|
| 34 | + */ |
|
| 35 | + public $navigation = array(); |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Contructor |
|
| 39 | - */ |
|
| 40 | - public function __construct() { |
|
| 41 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
| 42 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
| 43 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
| 44 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
| 45 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
| 46 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
| 47 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
| 48 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
| 49 | - } |
|
| 37 | + /** |
|
| 38 | + * Contructor |
|
| 39 | + */ |
|
| 40 | + public function __construct() { |
|
| 41 | + add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
| 42 | + add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
| 43 | + add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
| 44 | + add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
| 45 | + add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
| 46 | + add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
| 47 | + add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
| 48 | + add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Return an instance of this class. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * |
|
| 56 | - * @return object \lsx\projects\classes\admin\Settings_Theme() A single instance of this class. |
|
| 57 | - */ |
|
| 58 | - public static function get_instance() { |
|
| 59 | - // If the single instance hasn't been set, set it now. |
|
| 60 | - if ( null == self::$instance ) { |
|
| 61 | - self::$instance = new self(); |
|
| 62 | - } |
|
| 63 | - return self::$instance; |
|
| 64 | - } |
|
| 51 | + /** |
|
| 52 | + * Return an instance of this class. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * |
|
| 56 | + * @return object \lsx\projects\classes\admin\Settings_Theme() A single instance of this class. |
|
| 57 | + */ |
|
| 58 | + public static function get_instance() { |
|
| 59 | + // If the single instance hasn't been set, set it now. |
|
| 60 | + if ( null == self::$instance ) { |
|
| 61 | + self::$instance = new self(); |
|
| 62 | + } |
|
| 63 | + return self::$instance; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Disable CMB2 styles on front end forms. |
|
| 68 | - * |
|
| 69 | - * @return bool $enabled Whether to enable (enqueue) styles. |
|
| 70 | - */ |
|
| 71 | - public function disable_cmb2_styles( $enabled ) { |
|
| 72 | - if ( is_admin() ) { |
|
| 73 | - $current_screen = get_current_screen(); |
|
| 74 | - if ( is_object( $current_screen ) && 'project_page_lsx_projects_options' === $current_screen->id ) { |
|
| 75 | - $enabled = false; |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - return $enabled; |
|
| 79 | - } |
|
| 66 | + /** |
|
| 67 | + * Disable CMB2 styles on front end forms. |
|
| 68 | + * |
|
| 69 | + * @return bool $enabled Whether to enable (enqueue) styles. |
|
| 70 | + */ |
|
| 71 | + public function disable_cmb2_styles( $enabled ) { |
|
| 72 | + if ( is_admin() ) { |
|
| 73 | + $current_screen = get_current_screen(); |
|
| 74 | + if ( is_object( $current_screen ) && 'project_page_lsx_projects_options' === $current_screen->id ) { |
|
| 75 | + $enabled = false; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + return $enabled; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Generates the tabbed navigation for the settings page. |
|
| 83 | - * |
|
| 84 | - * @param string $cmb_id |
|
| 85 | - * @param string $object_id |
|
| 86 | - * @param string $object_type |
|
| 87 | - * @param object $cmb2_obj |
|
| 88 | - * @return void |
|
| 89 | - */ |
|
| 90 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 91 | - if ( 'lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type ) { |
|
| 92 | - $this->navigation = array(); |
|
| 93 | - $this->is_options_page = true; |
|
| 94 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
| 95 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
| 96 | - if ( 'title' === $field['type'] ) { |
|
| 97 | - $this->navigation[ $field_index ] = $field['name']; |
|
| 98 | - } |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - $this->output_navigation(); |
|
| 102 | - } |
|
| 103 | - } |
|
| 81 | + /** |
|
| 82 | + * Generates the tabbed navigation for the settings page. |
|
| 83 | + * |
|
| 84 | + * @param string $cmb_id |
|
| 85 | + * @param string $object_id |
|
| 86 | + * @param string $object_type |
|
| 87 | + * @param object $cmb2_obj |
|
| 88 | + * @return void |
|
| 89 | + */ |
|
| 90 | + public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 91 | + if ( 'lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type ) { |
|
| 92 | + $this->navigation = array(); |
|
| 93 | + $this->is_options_page = true; |
|
| 94 | + if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
| 95 | + foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
| 96 | + if ( 'title' === $field['type'] ) { |
|
| 97 | + $this->navigation[ $field_index ] = $field['name']; |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + $this->output_navigation(); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Outputs the WP style navigation for the Settings page. |
|
| 107 | - * |
|
| 108 | - * @return void |
|
| 109 | - */ |
|
| 110 | - public function output_navigation() { |
|
| 111 | - if ( ! empty( $this->navigation ) ) { |
|
| 112 | - ?> |
|
| 105 | + /** |
|
| 106 | + * Outputs the WP style navigation for the Settings page. |
|
| 107 | + * |
|
| 108 | + * @return void |
|
| 109 | + */ |
|
| 110 | + public function output_navigation() { |
|
| 111 | + if ( ! empty( $this->navigation ) ) { |
|
| 112 | + ?> |
|
| 113 | 113 | <div class="wp-filter hide-if-no-js"> |
| 114 | 114 | <ul class="filter-links"> |
| 115 | 115 | <?php |
| 116 | - $first_tab = true; |
|
| 117 | - $total = count( $this->navigation ); |
|
| 118 | - $count = 0; |
|
| 119 | - $separator = ' |'; |
|
| 120 | - $selected_tab = ''; |
|
| 121 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
| 122 | - $selected_tab = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) ); |
|
| 123 | - $selected_tab = 'settings_' . $selected_tab; |
|
| 124 | - } |
|
| 125 | - foreach ( $this->navigation as $key => $label ) { |
|
| 126 | - $count++; |
|
| 127 | - $current_css = ''; |
|
| 128 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
| 129 | - $first_tab = false; |
|
| 130 | - $current_css = 'current'; |
|
| 131 | - } |
|
| 132 | - if ( $count === $total ) { |
|
| 133 | - $separator = ''; |
|
| 134 | - } |
|
| 135 | - ?> |
|
| 116 | + $first_tab = true; |
|
| 117 | + $total = count( $this->navigation ); |
|
| 118 | + $count = 0; |
|
| 119 | + $separator = ' |'; |
|
| 120 | + $selected_tab = ''; |
|
| 121 | + if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
| 122 | + $selected_tab = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) ); |
|
| 123 | + $selected_tab = 'settings_' . $selected_tab; |
|
| 124 | + } |
|
| 125 | + foreach ( $this->navigation as $key => $label ) { |
|
| 126 | + $count++; |
|
| 127 | + $current_css = ''; |
|
| 128 | + if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
| 129 | + $first_tab = false; |
|
| 130 | + $current_css = 'current'; |
|
| 131 | + } |
|
| 132 | + if ( $count === $total ) { |
|
| 133 | + $separator = ''; |
|
| 134 | + } |
|
| 135 | + ?> |
|
| 136 | 136 | <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
| 137 | 137 | <?php |
| 138 | - } |
|
| 139 | - ?> |
|
| 138 | + } |
|
| 139 | + ?> |
|
| 140 | 140 | </ul> |
| 141 | 141 | </div> |
| 142 | 142 | <?php |
| 143 | - } |
|
| 144 | - } |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Outputs the opening tab div. |
|
| 148 | - * |
|
| 149 | - * @param object $field CMB2_Field(); |
|
| 150 | - * @return void |
|
| 151 | - */ |
|
| 152 | - public function output_tab_open_div( $field ) { |
|
| 153 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
| 154 | - ?> |
|
| 146 | + /** |
|
| 147 | + * Outputs the opening tab div. |
|
| 148 | + * |
|
| 149 | + * @param object $field CMB2_Field(); |
|
| 150 | + * @return void |
|
| 151 | + */ |
|
| 152 | + public function output_tab_open_div( $field ) { |
|
| 153 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
| 154 | + ?> |
|
| 155 | 155 | <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
| 156 | 156 | <?php |
| 157 | - } |
|
| 158 | - } |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * Outputs the opening closing div. |
|
| 162 | - * |
|
| 163 | - * @param object $field CMB2_Field(); |
|
| 164 | - * @return void |
|
| 165 | - */ |
|
| 166 | - public function output_tab_closing_div( $field ) { |
|
| 167 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
| 168 | - ?> |
|
| 160 | + /** |
|
| 161 | + * Outputs the opening closing div. |
|
| 162 | + * |
|
| 163 | + * @param object $field CMB2_Field(); |
|
| 164 | + * @return void |
|
| 165 | + */ |
|
| 166 | + public function output_tab_closing_div( $field ) { |
|
| 167 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
| 168 | + ?> |
|
| 169 | 169 | </div> |
| 170 | 170 | <?php |
| 171 | - } |
|
| 172 | - } |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
| 175 | - return; |
|
| 176 | - } |
|
| 174 | + public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
| 179 | - return ''; |
|
| 180 | - } |
|
| 178 | + public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
| 179 | + return ''; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - /** |
|
| 183 | - * Outputs the Script for the tabbed navigation. |
|
| 184 | - * |
|
| 185 | - * @param string $cmb_id |
|
| 186 | - * @param string $object_id |
|
| 187 | - * @param string $object_type |
|
| 188 | - * @param object $cmb2_obj |
|
| 189 | - * @return void |
|
| 190 | - */ |
|
| 191 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 192 | - if ( 'lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type ) { |
|
| 193 | - ?> |
|
| 182 | + /** |
|
| 183 | + * Outputs the Script for the tabbed navigation. |
|
| 184 | + * |
|
| 185 | + * @param string $cmb_id |
|
| 186 | + * @param string $object_id |
|
| 187 | + * @param string $object_type |
|
| 188 | + * @param object $cmb2_obj |
|
| 189 | + * @return void |
|
| 190 | + */ |
|
| 191 | + public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 192 | + if ( 'lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type ) { |
|
| 193 | + ?> |
|
| 194 | 194 | <script> |
| 195 | 195 | var LSX_PROJECTS_CMB2 = Object.create( null ); |
| 196 | 196 | |
@@ -262,25 +262,25 @@ discard block |
||
| 262 | 262 | } )( jQuery, window, document ); |
| 263 | 263 | </script> |
| 264 | 264 | <?php |
| 265 | - } |
|
| 266 | - } |
|
| 265 | + } |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * This will add the tab selection to the url. |
|
| 270 | - * |
|
| 271 | - * @param string $url |
|
| 272 | - * @return void |
|
| 273 | - */ |
|
| 274 | - public function add_tab_argument( $url ) { |
|
| 275 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
| 276 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
| 277 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
| 278 | - if ( 'single' !== $tab_selection ) { |
|
| 279 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
| 280 | - } else { |
|
| 281 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - return $url; |
|
| 285 | - } |
|
| 268 | + /** |
|
| 269 | + * This will add the tab selection to the url. |
|
| 270 | + * |
|
| 271 | + * @param string $url |
|
| 272 | + * @return void |
|
| 273 | + */ |
|
| 274 | + public function add_tab_argument( $url ) { |
|
| 275 | + if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
| 276 | + $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
| 277 | + $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
| 278 | + if ( 'single' !== $tab_selection ) { |
|
| 279 | + $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
| 280 | + } else { |
|
| 281 | + $url = remove_query_arg( 'cmb_tab', $url ); |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + return $url; |
|
| 285 | + } |
|
| 286 | 286 | } |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | * Contructor |
| 39 | 39 | */ |
| 40 | 40 | public function __construct() { |
| 41 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
| 42 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
| 43 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
| 44 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
| 45 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
| 46 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
| 47 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
| 48 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
| 41 | + add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1); |
|
| 42 | + add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4); |
|
| 43 | + add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1); |
|
| 44 | + add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1); |
|
| 45 | + add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5); |
|
| 46 | + add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2); |
|
| 47 | + add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4); |
|
| 48 | + add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public static function get_instance() { |
| 59 | 59 | // If the single instance hasn't been set, set it now. |
| 60 | - if ( null == self::$instance ) { |
|
| 60 | + if (null == self::$instance) { |
|
| 61 | 61 | self::$instance = new self(); |
| 62 | 62 | } |
| 63 | 63 | return self::$instance; |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool $enabled Whether to enable (enqueue) styles. |
| 70 | 70 | */ |
| 71 | - public function disable_cmb2_styles( $enabled ) { |
|
| 72 | - if ( is_admin() ) { |
|
| 71 | + public function disable_cmb2_styles($enabled) { |
|
| 72 | + if (is_admin()) { |
|
| 73 | 73 | $current_screen = get_current_screen(); |
| 74 | - if ( is_object( $current_screen ) && 'project_page_lsx_projects_options' === $current_screen->id ) { |
|
| 74 | + if (is_object($current_screen) && 'project_page_lsx_projects_options' === $current_screen->id) { |
|
| 75 | 75 | $enabled = false; |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | * @param object $cmb2_obj |
| 88 | 88 | * @return void |
| 89 | 89 | */ |
| 90 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 91 | - if ( 'lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type ) { |
|
| 90 | + public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
| 91 | + if ('lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type) { |
|
| 92 | 92 | $this->navigation = array(); |
| 93 | 93 | $this->is_options_page = true; |
| 94 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
| 95 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
| 96 | - if ( 'title' === $field['type'] ) { |
|
| 97 | - $this->navigation[ $field_index ] = $field['name']; |
|
| 94 | + if (isset($cmb2_obj->meta_box['fields']) && ! empty($cmb2_obj->meta_box['fields'])) { |
|
| 95 | + foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) { |
|
| 96 | + if ('title' === $field['type']) { |
|
| 97 | + $this->navigation[$field_index] = $field['name']; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -108,32 +108,32 @@ discard block |
||
| 108 | 108 | * @return void |
| 109 | 109 | */ |
| 110 | 110 | public function output_navigation() { |
| 111 | - if ( ! empty( $this->navigation ) ) { |
|
| 111 | + if ( ! empty($this->navigation)) { |
|
| 112 | 112 | ?> |
| 113 | 113 | <div class="wp-filter hide-if-no-js"> |
| 114 | 114 | <ul class="filter-links"> |
| 115 | 115 | <?php |
| 116 | 116 | $first_tab = true; |
| 117 | - $total = count( $this->navigation ); |
|
| 117 | + $total = count($this->navigation); |
|
| 118 | 118 | $count = 0; |
| 119 | 119 | $separator = ' |'; |
| 120 | 120 | $selected_tab = ''; |
| 121 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
| 122 | - $selected_tab = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) ); |
|
| 121 | + if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) { |
|
| 122 | + $selected_tab = sanitize_text_field(wp_unslash($_GET['cmb_tab'])); |
|
| 123 | 123 | $selected_tab = 'settings_' . $selected_tab; |
| 124 | 124 | } |
| 125 | - foreach ( $this->navigation as $key => $label ) { |
|
| 125 | + foreach ($this->navigation as $key => $label) { |
|
| 126 | 126 | $count++; |
| 127 | 127 | $current_css = ''; |
| 128 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
| 128 | + if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) { |
|
| 129 | 129 | $first_tab = false; |
| 130 | 130 | $current_css = 'current'; |
| 131 | 131 | } |
| 132 | - if ( $count === $total ) { |
|
| 132 | + if ($count === $total) { |
|
| 133 | 133 | $separator = ''; |
| 134 | 134 | } |
| 135 | 135 | ?> |
| 136 | - <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
|
| 136 | + <li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li> |
|
| 137 | 137 | <?php |
| 138 | 138 | } |
| 139 | 139 | ?> |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | * @param object $field CMB2_Field(); |
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | - public function output_tab_open_div( $field ) { |
|
| 153 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
| 152 | + public function output_tab_open_div($field) { |
|
| 153 | + if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) { |
|
| 154 | 154 | ?> |
| 155 | - <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
|
| 155 | + <div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden"> |
|
| 156 | 156 | <?php |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -163,19 +163,19 @@ discard block |
||
| 163 | 163 | * @param object $field CMB2_Field(); |
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | - public function output_tab_closing_div( $field ) { |
|
| 167 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
| 166 | + public function output_tab_closing_div($field) { |
|
| 167 | + if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) { |
|
| 168 | 168 | ?> |
| 169 | 169 | </div> |
| 170 | 170 | <?php |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
| 174 | + public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
| 175 | 175 | return; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
| 178 | + public function cmb2_sanitize_tab_closing_callback($override_value, $value) { |
|
| 179 | 179 | return ''; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | * @param object $cmb2_obj |
| 189 | 189 | * @return void |
| 190 | 190 | */ |
| 191 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 192 | - if ( 'lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type ) { |
|
| 191 | + public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
| 192 | + if ('lsx_projects_settings' === $cmb_id && 'lsx_projects_options' === $object_id && 'options-page' === $object_type) { |
|
| 193 | 193 | ?> |
| 194 | 194 | <script> |
| 195 | 195 | var LSX_PROJECTS_CMB2 = Object.create( null ); |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | * @param string $url |
| 272 | 272 | * @return void |
| 273 | 273 | */ |
| 274 | - public function add_tab_argument( $url ) { |
|
| 275 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
| 276 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
| 277 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
| 278 | - if ( 'single' !== $tab_selection ) { |
|
| 279 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
| 274 | + public function add_tab_argument($url) { |
|
| 275 | + if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine |
|
| 276 | + $tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine |
|
| 277 | + $tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine |
|
| 278 | + if ('single' !== $tab_selection) { |
|
| 279 | + $url = add_query_arg('cmb_tab', $tab_selection, $url); |
|
| 280 | 280 | } else { |
| 281 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
| 281 | + $url = remove_query_arg('cmb_tab', $url); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | return $url; |