@@ -8,124 +8,124 @@ |
||
8 | 8 | */ |
9 | 9 | class Frontend { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Frontend() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
22 | - */ |
|
23 | - public $endpoints; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
27 | - */ |
|
28 | - public $modals; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
32 | - */ |
|
33 | - public $gallery; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
37 | - */ |
|
38 | - public $plan_status; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
42 | - */ |
|
43 | - public $plan_query; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var object \lsx_health_plan\classes\frontend\General(); |
|
47 | - */ |
|
48 | - public $general; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
52 | - */ |
|
53 | - public $template_redirects; |
|
54 | - |
|
55 | - /** |
|
56 | - * Constructor |
|
57 | - */ |
|
58 | - public function __construct() { |
|
59 | - if ( ! is_admin() ) { |
|
60 | - $this->load_classes(); |
|
61 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * Return an instance of this class. |
|
67 | - * |
|
68 | - * @since 1.0.0 |
|
69 | - * |
|
70 | - * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
71 | - */ |
|
72 | - public static function get_instance() { |
|
73 | - // If the single instance hasn't been set, set it now. |
|
74 | - if ( null === self::$instance ) { |
|
75 | - self::$instance = new self(); |
|
76 | - } |
|
77 | - return self::$instance; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Loads the variable classes and the static classes. |
|
82 | - */ |
|
83 | - private function load_classes() { |
|
84 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
85 | - $this->endpoints = frontend\Endpoints::get_instance(); |
|
86 | - |
|
87 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
88 | - $this->modals = Modals::get_instance(); |
|
89 | - |
|
90 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
91 | - $this->gallery = frontend\Gallery::get_instance(); |
|
92 | - |
|
93 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
94 | - $this->plan_status = frontend\Plan_Status::get_instance(); |
|
95 | - |
|
96 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
97 | - $this->plan_query = frontend\Plan_Query::get_instance(); |
|
98 | - |
|
99 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
100 | - $this->general = frontend\General::get_instance(); |
|
101 | - |
|
102 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
103 | - $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public function redirect() { |
|
112 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
113 | - return; |
|
114 | - } |
|
115 | - } |
|
116 | - /** |
|
117 | - * Remove the "Archives:" from the post type recipes. |
|
118 | - * |
|
119 | - * @param string $title the term title. |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function get_the_archive_title( $title ) { |
|
123 | - if ( is_tax() ) { |
|
124 | - $queried_object = get_queried_object(); |
|
125 | - if ( isset( $queried_object->name ) ) { |
|
126 | - $title = $queried_object->name; |
|
127 | - } |
|
128 | - } |
|
129 | - return $title; |
|
130 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Frontend() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
22 | + */ |
|
23 | + public $endpoints; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
27 | + */ |
|
28 | + public $modals; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
32 | + */ |
|
33 | + public $gallery; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
37 | + */ |
|
38 | + public $plan_status; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
42 | + */ |
|
43 | + public $plan_query; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var object \lsx_health_plan\classes\frontend\General(); |
|
47 | + */ |
|
48 | + public $general; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
52 | + */ |
|
53 | + public $template_redirects; |
|
54 | + |
|
55 | + /** |
|
56 | + * Constructor |
|
57 | + */ |
|
58 | + public function __construct() { |
|
59 | + if ( ! is_admin() ) { |
|
60 | + $this->load_classes(); |
|
61 | + add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * Return an instance of this class. |
|
67 | + * |
|
68 | + * @since 1.0.0 |
|
69 | + * |
|
70 | + * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
71 | + */ |
|
72 | + public static function get_instance() { |
|
73 | + // If the single instance hasn't been set, set it now. |
|
74 | + if ( null === self::$instance ) { |
|
75 | + self::$instance = new self(); |
|
76 | + } |
|
77 | + return self::$instance; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Loads the variable classes and the static classes. |
|
82 | + */ |
|
83 | + private function load_classes() { |
|
84 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
85 | + $this->endpoints = frontend\Endpoints::get_instance(); |
|
86 | + |
|
87 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
88 | + $this->modals = Modals::get_instance(); |
|
89 | + |
|
90 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
91 | + $this->gallery = frontend\Gallery::get_instance(); |
|
92 | + |
|
93 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
94 | + $this->plan_status = frontend\Plan_Status::get_instance(); |
|
95 | + |
|
96 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
97 | + $this->plan_query = frontend\Plan_Query::get_instance(); |
|
98 | + |
|
99 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
100 | + $this->general = frontend\General::get_instance(); |
|
101 | + |
|
102 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
103 | + $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public function redirect() { |
|
112 | + if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
113 | + return; |
|
114 | + } |
|
115 | + } |
|
116 | + /** |
|
117 | + * Remove the "Archives:" from the post type recipes. |
|
118 | + * |
|
119 | + * @param string $title the term title. |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function get_the_archive_title( $title ) { |
|
123 | + if ( is_tax() ) { |
|
124 | + $queried_object = get_queried_object(); |
|
125 | + if ( isset( $queried_object->name ) ) { |
|
126 | + $title = $queried_object->name; |
|
127 | + } |
|
128 | + } |
|
129 | + return $title; |
|
130 | + } |
|
131 | 131 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | * @return void |
12 | 12 | */ |
13 | 13 | function lsx_hp_plan_archive_filters() { |
14 | - if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
15 | - ?> |
|
14 | + if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
15 | + ?> |
|
16 | 16 | <div id="type-nav"> |
17 | 17 | <ul class="nav nav-pills lsx-type-nav-filter"> |
18 | 18 | <li class="active"><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-health-plan' ); ?></a></li> |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | </ul> |
23 | 23 | </div> |
24 | 24 | <?php |
25 | - } |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function lsx_hp_plan_get_classes() { |
34 | - $classes = 'filter-free'; |
|
35 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
36 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
37 | - $linked_product = wc_get_product( $products[0] ); |
|
38 | - $price = $linked_product->get_price( 'raw' ); |
|
39 | - if ( empty( $price ) ) { |
|
40 | - $classes = 'filter-free'; |
|
41 | - } else { |
|
42 | - $classes = 'filter-paid'; |
|
43 | - } |
|
34 | + $classes = 'filter-free'; |
|
35 | + if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
36 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
37 | + $linked_product = wc_get_product( $products[0] ); |
|
38 | + $price = $linked_product->get_price( 'raw' ); |
|
39 | + if ( empty( $price ) ) { |
|
40 | + $classes = 'filter-free'; |
|
41 | + } else { |
|
42 | + $classes = 'filter-paid'; |
|
43 | + } |
|
44 | 44 | |
45 | - $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
46 | - if ( false !== $featured && '' !== $featured ) { |
|
47 | - $classes .= ' filter-featured'; |
|
48 | - } |
|
49 | - } |
|
50 | - return $classes; |
|
45 | + $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
46 | + if ( false !== $featured && '' !== $featured ) { |
|
47 | + $classes .= ' filter-featured'; |
|
48 | + } |
|
49 | + } |
|
50 | + return $classes; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | function lsx_health_plan_back_to_plan_button() { |
54 | - ?> |
|
54 | + ?> |
|
55 | 55 | <div class="back-plan-btn"> |
56 | 56 | <a class="btn" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Back To Plan', 'lsx-health-plan' ); ?></a> |
57 | 57 | </div> |
@@ -18,51 +18,51 @@ discard block |
||
18 | 18 | $linked_product = false; |
19 | 19 | $restricted = ''; |
20 | 20 | if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
21 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
22 | - $linked_product = wc_get_product( $products[0] ); |
|
23 | - $product = $linked_product; |
|
21 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
22 | + $linked_product = wc_get_product( $products[0] ); |
|
23 | + $product = $linked_product; |
|
24 | 24 | |
25 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
26 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
27 | - } |
|
25 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
26 | + $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // Check for shortcode overrides. |
31 | 31 | if ( null !== $shortcode_args ) { |
32 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
33 | - $column_class = $shortcode_args['columns']; |
|
34 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
35 | - } |
|
36 | - if ( isset( $shortcode_args['link'] ) ) { |
|
37 | - $link_setting = $shortcode_args['link']; |
|
38 | - // Setup our link and content. |
|
39 | - switch ( $link_setting ) { |
|
40 | - case 'single': |
|
41 | - $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
42 | - $link_close = '</a>'; |
|
43 | - break; |
|
32 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
33 | + $column_class = $shortcode_args['columns']; |
|
34 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
35 | + } |
|
36 | + if ( isset( $shortcode_args['link'] ) ) { |
|
37 | + $link_setting = $shortcode_args['link']; |
|
38 | + // Setup our link and content. |
|
39 | + switch ( $link_setting ) { |
|
40 | + case 'single': |
|
41 | + $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
42 | + $link_close = '</a>'; |
|
43 | + break; |
|
44 | 44 | |
45 | - case 'modal': |
|
46 | - $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
|
47 | - $link_close = '</a>'; |
|
48 | - $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
49 | - $modal_args = array( |
|
50 | - 'modal_content' => $modal_content_setting, |
|
51 | - ); |
|
52 | - // We call the button to register the modal, but we do not output it. |
|
53 | - lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
54 | - break; |
|
45 | + case 'modal': |
|
46 | + $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
|
47 | + $link_close = '</a>'; |
|
48 | + $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
49 | + $modal_args = array( |
|
50 | + 'modal_content' => $modal_content_setting, |
|
51 | + ); |
|
52 | + // We call the button to register the modal, but we do not output it. |
|
53 | + lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
54 | + break; |
|
55 | 55 | |
56 | - case 'none': |
|
57 | - default: |
|
58 | - $link_html = ''; |
|
59 | - $link_close = ''; |
|
60 | - break; |
|
61 | - } |
|
62 | - } |
|
63 | - if ( isset( $shortcode_args['description'] ) ) { |
|
64 | - $content_setting = $shortcode_args['description']; |
|
65 | - } |
|
56 | + case 'none': |
|
57 | + default: |
|
58 | + $link_html = ''; |
|
59 | + $link_close = ''; |
|
60 | + break; |
|
61 | + } |
|
62 | + } |
|
63 | + if ( isset( $shortcode_args['description'] ) ) { |
|
64 | + $content_setting = $shortcode_args['description']; |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
@@ -78,62 +78,62 @@ discard block |
||
78 | 78 | <?php } ?> |
79 | 79 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
80 | 80 | <?php |
81 | - $featured_image = get_the_post_thumbnail(); |
|
82 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
83 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
84 | - 'class' => 'aligncenter', |
|
85 | - ) ); |
|
86 | - } else { |
|
87 | - ?> |
|
81 | + $featured_image = get_the_post_thumbnail(); |
|
82 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
83 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
84 | + 'class' => 'aligncenter', |
|
85 | + ) ); |
|
86 | + } else { |
|
87 | + ?> |
|
88 | 88 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
89 | 89 | <?php |
90 | - } |
|
91 | - ?> |
|
90 | + } |
|
91 | + ?> |
|
92 | 92 | </a> |
93 | 93 | </div> |
94 | 94 | <div class="content-box plan-content-box white-bg"> |
95 | 95 | <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> |
96 | 96 | <?php |
97 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
98 | - ?> |
|
97 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
98 | + ?> |
|
99 | 99 | <?php |
100 | - if ( false !== $linked_product ) { |
|
101 | - echo '<div class="plan-price">'; |
|
102 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
103 | - echo '</div>'; |
|
104 | - } |
|
105 | - ?> |
|
100 | + if ( false !== $linked_product ) { |
|
101 | + echo '<div class="plan-price">'; |
|
102 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
103 | + echo '</div>'; |
|
104 | + } |
|
105 | + ?> |
|
106 | 106 | <div class="excerpt"> |
107 | 107 | <?php |
108 | - if ( ! has_excerpt() ) { |
|
109 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
110 | - $content = '<p>' . $content . '</p>'; |
|
111 | - } else { |
|
112 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
113 | - } |
|
114 | - echo wp_kses_post( $content ); |
|
115 | - ?> |
|
108 | + if ( ! has_excerpt() ) { |
|
109 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
110 | + $content = '<p>' . $content . '</p>'; |
|
111 | + } else { |
|
112 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
113 | + } |
|
114 | + echo wp_kses_post( $content ); |
|
115 | + ?> |
|
116 | 116 | </div> |
117 | 117 | |
118 | 118 | <?php |
119 | - $button_link = get_permalink(); |
|
120 | - $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
121 | - $button_class = ''; |
|
119 | + $button_link = get_permalink(); |
|
120 | + $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
121 | + $button_class = ''; |
|
122 | 122 | |
123 | - if ( true === $restricted ) { |
|
124 | - if ( 1 < count( $products ) ) { |
|
125 | - $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
126 | - } else { |
|
127 | - $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
|
128 | - $button_text = $linked_product->add_to_cart_text(); |
|
129 | - } |
|
130 | - ?> |
|
123 | + if ( true === $restricted ) { |
|
124 | + if ( 1 < count( $products ) ) { |
|
125 | + $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
126 | + } else { |
|
127 | + $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
|
128 | + $button_text = $linked_product->add_to_cart_text(); |
|
129 | + } |
|
130 | + ?> |
|
131 | 131 | <?php |
132 | - } elseif ( false === $restricted ) { |
|
133 | - $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
134 | - $button_class = 'btn-disabled'; |
|
135 | - } |
|
136 | - ?> |
|
132 | + } elseif ( false === $restricted ) { |
|
133 | + $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
134 | + $button_class = 'btn-disabled'; |
|
135 | + } |
|
136 | + ?> |
|
137 | 137 | <a class="btn <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_attr( $button_link ); ?>"><?php echo esc_attr( $button_text ); ?></a> |
138 | 138 | </div> |
139 | 139 | <?php lsx_entry_bottom(); ?> |
@@ -8,57 +8,57 @@ discard block |
||
8 | 8 | |
9 | 9 | // Check for any shortcode overrides. |
10 | 10 | if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
11 | - $connected_workouts = array( get_the_ID() ); |
|
11 | + $connected_workouts = array( get_the_ID() ); |
|
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | <div class="sets-wrapper"> |
15 | 15 | <?php |
16 | - if ( empty( $connected_workouts ) || null === $connected_workouts ) { |
|
17 | - $connected_workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
18 | - if ( empty( $connected_workouts ) ) { |
|
19 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
20 | - if ( isset( $options['connected_workouts'] ) && '' !== $options['connected_workouts'] && ! empty( $options['connected_workouts'] ) ) { |
|
21 | - $connected_workouts = $options['connected_workouts']; |
|
22 | - if ( ! array( $connected_workouts ) ) { |
|
23 | - $connected_workouts = array( $connected_workouts ); |
|
24 | - } |
|
25 | - } |
|
26 | - } |
|
27 | - } |
|
28 | - $args = array( |
|
29 | - 'orderby' => 'date', |
|
30 | - 'order' => 'DESC', |
|
31 | - 'post_type' => 'workout', |
|
32 | - 'post__in' => $connected_workouts, |
|
33 | - ); |
|
34 | - $workouts = new WP_Query( $args ); |
|
16 | + if ( empty( $connected_workouts ) || null === $connected_workouts ) { |
|
17 | + $connected_workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
18 | + if ( empty( $connected_workouts ) ) { |
|
19 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
20 | + if ( isset( $options['connected_workouts'] ) && '' !== $options['connected_workouts'] && ! empty( $options['connected_workouts'] ) ) { |
|
21 | + $connected_workouts = $options['connected_workouts']; |
|
22 | + if ( ! array( $connected_workouts ) ) { |
|
23 | + $connected_workouts = array( $connected_workouts ); |
|
24 | + } |
|
25 | + } |
|
26 | + } |
|
27 | + } |
|
28 | + $args = array( |
|
29 | + 'orderby' => 'date', |
|
30 | + 'order' => 'DESC', |
|
31 | + 'post_type' => 'workout', |
|
32 | + 'post__in' => $connected_workouts, |
|
33 | + ); |
|
34 | + $workouts = new WP_Query( $args ); |
|
35 | 35 | |
36 | - if ( $workouts->have_posts() ) { |
|
37 | - while ( $workouts->have_posts() ) { |
|
38 | - $workouts->the_post(); |
|
39 | - // Brings the workout post content first. |
|
40 | - echo wp_kses_post( lsx_health_plan_workout_main_content() ); |
|
36 | + if ( $workouts->have_posts() ) { |
|
37 | + while ( $workouts->have_posts() ) { |
|
38 | + $workouts->the_post(); |
|
39 | + // Brings the workout post content first. |
|
40 | + echo wp_kses_post( lsx_health_plan_workout_main_content() ); |
|
41 | 41 | |
42 | - $i = 1; |
|
43 | - $section_counter = 6; |
|
44 | - echo '<div class="sets">'; |
|
45 | - while ( $i <= $section_counter ) { |
|
42 | + $i = 1; |
|
43 | + $section_counter = 6; |
|
44 | + echo '<div class="sets">'; |
|
45 | + while ( $i <= $section_counter ) { |
|
46 | 46 | |
47 | - $workout_section = 'workout_section_' . ( $i ) . '_title'; |
|
48 | - $workout_desc = 'workout_section_' . ( $i ) . '_description'; |
|
47 | + $workout_section = 'workout_section_' . ( $i ) . '_title'; |
|
48 | + $workout_desc = 'workout_section_' . ( $i ) . '_description'; |
|
49 | 49 | |
50 | - $section_title = get_post_meta( get_the_ID(), $workout_section, true ); |
|
51 | - $description = get_post_meta( get_the_ID(), $workout_desc, true ); |
|
52 | - if ( is_singular( 'workout' ) ) { |
|
53 | - $section_title = get_post_meta( get_queried_object_id(), $workout_section, true ); |
|
54 | - $description = get_post_meta( get_queried_object_id(), $workout_desc, true ); |
|
55 | - } |
|
50 | + $section_title = get_post_meta( get_the_ID(), $workout_section, true ); |
|
51 | + $description = get_post_meta( get_the_ID(), $workout_desc, true ); |
|
52 | + if ( is_singular( 'workout' ) ) { |
|
53 | + $section_title = get_post_meta( get_queried_object_id(), $workout_section, true ); |
|
54 | + $description = get_post_meta( get_queried_object_id(), $workout_desc, true ); |
|
55 | + } |
|
56 | 56 | |
57 | - if ( '' === $section_title ) { |
|
58 | - $i++; |
|
59 | - continue; |
|
60 | - } |
|
61 | - ?> |
|
57 | + if ( '' === $section_title ) { |
|
58 | + $i++; |
|
59 | + continue; |
|
60 | + } |
|
61 | + ?> |
|
62 | 62 | <div class="set-box set content-box"> |
63 | 63 | <h3 class="set-title"><?php echo esc_html( $section_title ); ?></h3> |
64 | 64 | <div class="set-content"> |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | <?php lsx_health_plan_workout_tab_content( $i ); ?> |
68 | 68 | </div> |
69 | 69 | <?php |
70 | - $i++; |
|
71 | - } |
|
72 | - echo '</div>'; |
|
73 | - } |
|
74 | - ?> |
|
70 | + $i++; |
|
71 | + } |
|
72 | + echo '</div>'; |
|
73 | + } |
|
74 | + ?> |
|
75 | 75 | <?php } ?> |
76 | 76 | <?php wp_reset_postdata(); ?> |
77 | 77 | </div> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | $sharing = 'sharing-disabled'; |
19 | 19 | if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : |
20 | - $sharing = 'sharing-enabled'; |
|
20 | + $sharing = 'sharing-enabled'; |
|
21 | 21 | endif; |
22 | 22 | |
23 | 23 | ?> |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | <?php if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : ?> |
39 | 39 | |
40 | 40 | <?php |
41 | - if ( class_exists( 'LSX_Sharing' ) ) { |
|
42 | - lsx_content_sharing(); |
|
43 | - } else { |
|
44 | - if ( function_exists( 'sharing_display' ) ) { |
|
45 | - sharing_display( '', true ); |
|
46 | - } |
|
47 | - |
|
48 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
49 | - $custom_likes = new Jetpack_Likes(); |
|
50 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
51 | - } |
|
52 | - } |
|
53 | - ?> |
|
41 | + if ( class_exists( 'LSX_Sharing' ) ) { |
|
42 | + lsx_content_sharing(); |
|
43 | + } else { |
|
44 | + if ( function_exists( 'sharing_display' ) ) { |
|
45 | + sharing_display( '', true ); |
|
46 | + } |
|
47 | + |
|
48 | + if ( class_exists( 'Jetpack_Likes' ) ) { |
|
49 | + $custom_likes = new Jetpack_Likes(); |
|
50 | + echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
51 | + } |
|
52 | + } |
|
53 | + ?> |
|
54 | 54 | <?php endif ?> |
55 | 55 | |
56 | 56 | <?php lsx_health_plan_exercise_title( '<h2>', '</h2>', false ); ?> |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | <div class="col-md-6 exercise-image lsx-hp-shadow"> |
61 | 61 | |
62 | 62 | <?php |
63 | - $lsx_hp = lsx_health_plan(); |
|
64 | - |
|
65 | - if ( $lsx_hp->frontend->gallery->has_gallery( get_the_ID() ) ) { |
|
66 | - lsx_health_plan_gallery(); |
|
67 | - } else { |
|
68 | - $featured_image = get_the_post_thumbnail(); |
|
69 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
70 | - the_post_thumbnail( 'large', array( |
|
71 | - 'class' => 'aligncenter', |
|
72 | - ) ); |
|
73 | - } else { |
|
74 | - ?> |
|
63 | + $lsx_hp = lsx_health_plan(); |
|
64 | + |
|
65 | + if ( $lsx_hp->frontend->gallery->has_gallery( get_the_ID() ) ) { |
|
66 | + lsx_health_plan_gallery(); |
|
67 | + } else { |
|
68 | + $featured_image = get_the_post_thumbnail(); |
|
69 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
70 | + the_post_thumbnail( 'large', array( |
|
71 | + 'class' => 'aligncenter', |
|
72 | + ) ); |
|
73 | + } else { |
|
74 | + ?> |
|
75 | 75 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
76 | 76 | <?php |
77 | - } |
|
78 | - } |
|
79 | - ?> |
|
77 | + } |
|
78 | + } |
|
79 | + ?> |
|
80 | 80 | |
81 | 81 | <?php if ( ( ! empty( $exercise_type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?> |
82 | 82 | <div class="exercise-data"> |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | <?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?> |
90 | 90 | <div class="back-plan-btn"> |
91 | 91 | <?php |
92 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
93 | - ?> |
|
92 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
93 | + ?> |
|
94 | 94 | <a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back to my plans', 'lsx-health-plan' ); ?></a> |
95 | 95 | <?php |
96 | - } |
|
97 | - ?> |
|
96 | + } |
|
97 | + ?> |
|
98 | 98 | </div> |
99 | 99 | </div> |
100 | 100 | </div> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | <?php |
108 | 108 | if ( ! empty( $connected_articles ) ) { |
109 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
109 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | global $group_name,$shortcode_args; |
9 | 9 | $groups = get_post_meta( get_the_ID(), $group_name, true ); |
10 | 10 | if ( is_singular( 'workout' ) ) { |
11 | - $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
11 | + $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
12 | 12 | } |
13 | 13 | $link_setting = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' ); |
14 | 14 | $content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_content', '' ); |
@@ -16,113 +16,113 @@ discard block |
||
16 | 16 | |
17 | 17 | // Check for shortcode overrides. |
18 | 18 | if ( null !== $shortcode_args ) { |
19 | - if ( isset( $shortcode_args['link'] ) ) { |
|
20 | - $link_setting = $shortcode_args['link']; |
|
21 | - } |
|
22 | - if ( isset( $shortcode_args['description'] ) ) { |
|
23 | - $content_setting = $shortcode_args['description']; |
|
24 | - } |
|
25 | - if ( isset( $shortcode_args['modal_content'] ) ) { |
|
26 | - $modal_content_setting = $shortcode_args['modal_content']; |
|
27 | - } |
|
19 | + if ( isset( $shortcode_args['link'] ) ) { |
|
20 | + $link_setting = $shortcode_args['link']; |
|
21 | + } |
|
22 | + if ( isset( $shortcode_args['description'] ) ) { |
|
23 | + $content_setting = $shortcode_args['description']; |
|
24 | + } |
|
25 | + if ( isset( $shortcode_args['modal_content'] ) ) { |
|
26 | + $modal_content_setting = $shortcode_args['modal_content']; |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $modal_args = array( |
31 | - 'modal_content' => $modal_content_setting, |
|
31 | + 'modal_content' => $modal_content_setting, |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | if ( ! empty( $groups ) ) { |
35 | - ?> |
|
35 | + ?> |
|
36 | 36 | <div class="set-list"> |
37 | 37 | <div class="workout-list"> |
38 | 38 | <?php |
39 | - foreach ( $groups as $group ) { |
|
39 | + foreach ( $groups as $group ) { |
|
40 | 40 | |
41 | - $connected_exercise = false; |
|
42 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
43 | - $connected_exercise = true; |
|
44 | - } |
|
41 | + $connected_exercise = false; |
|
42 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
43 | + $connected_exercise = true; |
|
44 | + } |
|
45 | 45 | |
46 | - if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && '' !== $group['alt_title'] && isset( $group['alt_title'] ) ) ) { |
|
46 | + if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && '' !== $group['alt_title'] && isset( $group['alt_title'] ) ) ) { |
|
47 | 47 | |
48 | - $alt_title = ''; |
|
49 | - if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
50 | - $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
51 | - } |
|
48 | + $alt_title = ''; |
|
49 | + if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
50 | + $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
51 | + } |
|
52 | 52 | |
53 | - $alt_description = ''; |
|
54 | - if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
55 | - $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
56 | - } |
|
53 | + $alt_description = ''; |
|
54 | + if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
55 | + $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
56 | + } |
|
57 | 57 | |
58 | - $alt_image = ''; |
|
59 | - if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
60 | - $alt_image = $group['exercise_alt_thumbnail']; |
|
61 | - } |
|
58 | + $alt_image = ''; |
|
59 | + if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
60 | + $alt_image = $group['exercise_alt_thumbnail']; |
|
61 | + } |
|
62 | 62 | |
63 | - $reps = ''; |
|
64 | - if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
65 | - $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
66 | - } |
|
67 | - // Setup our link and content. |
|
68 | - switch ( $link_setting ) { |
|
69 | - case 'single': |
|
70 | - $link_html = ''; |
|
71 | - $link_close = ''; |
|
72 | - if ( $connected_exercise ) { |
|
73 | - $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
74 | - $link_close = '</a>'; |
|
75 | - } |
|
76 | - break; |
|
63 | + $reps = ''; |
|
64 | + if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
65 | + $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
66 | + } |
|
67 | + // Setup our link and content. |
|
68 | + switch ( $link_setting ) { |
|
69 | + case 'single': |
|
70 | + $link_html = ''; |
|
71 | + $link_close = ''; |
|
72 | + if ( $connected_exercise ) { |
|
73 | + $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
74 | + $link_close = '</a>'; |
|
75 | + } |
|
76 | + break; |
|
77 | 77 | |
78 | - case 'modal': |
|
79 | - $link_html = ''; |
|
80 | - $link_close = ''; |
|
81 | - if ( $connected_exercise ) { |
|
82 | - if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
83 | - $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
84 | - $link_close = '</a>'; |
|
85 | - // We call the button to register the alt modal, but we do not output it. |
|
86 | - lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
87 | - } else { |
|
88 | - $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
89 | - $link_close = '</a>'; |
|
90 | - // We call the button to register the modal, but we do not output it. |
|
91 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
92 | - } |
|
93 | - } |
|
94 | - break; |
|
78 | + case 'modal': |
|
79 | + $link_html = ''; |
|
80 | + $link_close = ''; |
|
81 | + if ( $connected_exercise ) { |
|
82 | + if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
83 | + $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
84 | + $link_close = '</a>'; |
|
85 | + // We call the button to register the alt modal, but we do not output it. |
|
86 | + lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
87 | + } else { |
|
88 | + $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
89 | + $link_close = '</a>'; |
|
90 | + // We call the button to register the modal, but we do not output it. |
|
91 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
92 | + } |
|
93 | + } |
|
94 | + break; |
|
95 | 95 | |
96 | - case 'none': |
|
97 | - default: |
|
98 | - $link_html = ''; |
|
99 | - $link_close = ''; |
|
100 | - break; |
|
101 | - } |
|
102 | - ?> |
|
96 | + case 'none': |
|
97 | + default: |
|
98 | + $link_html = ''; |
|
99 | + $link_close = ''; |
|
100 | + break; |
|
101 | + } |
|
102 | + ?> |
|
103 | 103 | <article class="lsx-slot box-shadow"> |
104 | 104 | <div class="row"> |
105 | 105 | <div class="col-sm-6 col-md-2"> |
106 | 106 | <div class="exercise-feature-img"> |
107 | 107 | <?php echo wp_kses_post( $link_html ); ?> |
108 | 108 | <?php |
109 | - // We call the button to register the modal, but we do not output it. |
|
110 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
111 | - $thumbnail_args = array( |
|
112 | - 'class' => 'aligncenter', |
|
113 | - ); |
|
114 | - $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
115 | - if ( $alt_image ) { |
|
116 | - $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
117 | - } |
|
118 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
119 | - echo wp_kses_post( $featured_image ); |
|
120 | - } else { |
|
121 | - ?> |
|
109 | + // We call the button to register the modal, but we do not output it. |
|
110 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
111 | + $thumbnail_args = array( |
|
112 | + 'class' => 'aligncenter', |
|
113 | + ); |
|
114 | + $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
115 | + if ( $alt_image ) { |
|
116 | + $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
117 | + } |
|
118 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
119 | + echo wp_kses_post( $featured_image ); |
|
120 | + } else { |
|
121 | + ?> |
|
122 | 122 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
123 | 123 | <?php |
124 | - } |
|
125 | - ?> |
|
124 | + } |
|
125 | + ?> |
|
126 | 126 | <?php echo wp_kses_post( $link_close ); ?> |
127 | 127 | </div> |
128 | 128 | </div> |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | <h3> |
132 | 132 | <?php echo wp_kses_post( $link_html ); ?> |
133 | 133 | <?php |
134 | - $exercise_title = lsx_health_plan_exercise_title( '', '', false, false, $group['connected_exercises'] ); |
|
135 | - if ( '' !== $alt_title ) { |
|
136 | - $exercise_title = $alt_title; |
|
137 | - } |
|
138 | - if ( '' !== $reps ) { |
|
139 | - $exercise_title .= $reps; |
|
140 | - } |
|
141 | - echo wp_kses_post( $exercise_title ); |
|
142 | - ?> |
|
134 | + $exercise_title = lsx_health_plan_exercise_title( '', '', false, false, $group['connected_exercises'] ); |
|
135 | + if ( '' !== $alt_title ) { |
|
136 | + $exercise_title = $alt_title; |
|
137 | + } |
|
138 | + if ( '' !== $reps ) { |
|
139 | + $exercise_title .= $reps; |
|
140 | + } |
|
141 | + echo wp_kses_post( $exercise_title ); |
|
142 | + ?> |
|
143 | 143 | <?php echo wp_kses_post( $link_close ); ?> |
144 | 144 | </h3> |
145 | 145 | </div> |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | </div> |
153 | 153 | </article> |
154 | 154 | <?php |
155 | - } |
|
156 | - } |
|
157 | - ?> |
|
155 | + } |
|
156 | + } |
|
157 | + ?> |
|
158 | 158 | </div> |
159 | 159 | </div> |
160 | 160 | <?php |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | global $group_name,$shortcode_args; |
9 | 9 | $groups = get_post_meta( get_the_ID(), $group_name, true ); |
10 | 10 | if ( is_singular( 'workout' ) ) { |
11 | - $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
11 | + $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $link_setting = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' ); |
@@ -18,169 +18,169 @@ discard block |
||
18 | 18 | |
19 | 19 | // Check for shortcode overrides. |
20 | 20 | if ( null !== $shortcode_args ) { |
21 | - if ( isset( $shortcode_args['link'] ) ) { |
|
22 | - $link_setting = $shortcode_args['link']; |
|
23 | - } |
|
24 | - if ( isset( $shortcode_args['description'] ) ) { |
|
25 | - $content_setting = $shortcode_args['description']; |
|
26 | - } |
|
27 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
28 | - $column_setting = $shortcode_args['columns']; |
|
29 | - $column_setting = \lsx_health_plan\functions\column_class( $column_setting ); |
|
30 | - } |
|
31 | - if ( isset( $shortcode_args['modal_content'] ) ) { |
|
32 | - $modal_content_setting = $shortcode_args['modal_content']; |
|
33 | - } |
|
21 | + if ( isset( $shortcode_args['link'] ) ) { |
|
22 | + $link_setting = $shortcode_args['link']; |
|
23 | + } |
|
24 | + if ( isset( $shortcode_args['description'] ) ) { |
|
25 | + $content_setting = $shortcode_args['description']; |
|
26 | + } |
|
27 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
28 | + $column_setting = $shortcode_args['columns']; |
|
29 | + $column_setting = \lsx_health_plan\functions\column_class( $column_setting ); |
|
30 | + } |
|
31 | + if ( isset( $shortcode_args['modal_content'] ) ) { |
|
32 | + $modal_content_setting = $shortcode_args['modal_content']; |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $modal_args = array( |
37 | - 'modal_content' => $modal_content_setting, |
|
37 | + 'modal_content' => $modal_content_setting, |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | $counter = 1; |
41 | 41 | |
42 | 42 | if ( ! empty( $groups ) ) { |
43 | - ?> |
|
43 | + ?> |
|
44 | 44 | <div class="set-grid"> |
45 | 45 | <div class="workout-grid row"> |
46 | 46 | <?php |
47 | - foreach ( $groups as $group ) { |
|
48 | - $connected_exercise = false; |
|
49 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
50 | - $connected_exercise = true; |
|
51 | - } |
|
47 | + foreach ( $groups as $group ) { |
|
48 | + $connected_exercise = false; |
|
49 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
50 | + $connected_exercise = true; |
|
51 | + } |
|
52 | 52 | |
53 | - if ( ! $connected_exercise ) { |
|
54 | - $group['connected_exercises'] = ''; |
|
55 | - } |
|
56 | - $alt_title_value = $group['alt_title'] ?? ''; |
|
57 | - if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && $alt_title_value ) ) { |
|
53 | + if ( ! $connected_exercise ) { |
|
54 | + $group['connected_exercises'] = ''; |
|
55 | + } |
|
56 | + $alt_title_value = $group['alt_title'] ?? ''; |
|
57 | + if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && $alt_title_value ) ) { |
|
58 | 58 | |
59 | - $alt_title = ''; |
|
60 | - if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
61 | - $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
62 | - } |
|
59 | + $alt_title = ''; |
|
60 | + if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
61 | + $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
62 | + } |
|
63 | 63 | |
64 | - $alt_description = ''; |
|
65 | - if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
66 | - $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
67 | - } |
|
64 | + $alt_description = ''; |
|
65 | + if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
66 | + $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
67 | + } |
|
68 | 68 | |
69 | - $alt_image = ''; |
|
70 | - if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
71 | - $alt_image = $group['exercise_alt_thumbnail']; |
|
72 | - } |
|
69 | + $alt_image = ''; |
|
70 | + if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
71 | + $alt_image = $group['exercise_alt_thumbnail']; |
|
72 | + } |
|
73 | 73 | |
74 | - $reps = ''; |
|
75 | - if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
76 | - $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
77 | - } |
|
78 | - $class_excerpt = 'no-excerpt'; |
|
79 | - if ( 'excerpt' === $content_setting ) { |
|
80 | - $class_excerpt = 'has-excerpt'; |
|
81 | - } |
|
82 | - // Setup our link and content. |
|
83 | - switch ( $link_setting ) { |
|
84 | - case 'single': |
|
85 | - $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
86 | - $link_close = '</a>'; |
|
87 | - break; |
|
74 | + $reps = ''; |
|
75 | + if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
76 | + $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
77 | + } |
|
78 | + $class_excerpt = 'no-excerpt'; |
|
79 | + if ( 'excerpt' === $content_setting ) { |
|
80 | + $class_excerpt = 'has-excerpt'; |
|
81 | + } |
|
82 | + // Setup our link and content. |
|
83 | + switch ( $link_setting ) { |
|
84 | + case 'single': |
|
85 | + $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
86 | + $link_close = '</a>'; |
|
87 | + break; |
|
88 | 88 | |
89 | - case 'modal': |
|
90 | - if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
91 | - $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
92 | - $link_close = '</a>'; |
|
93 | - // We call the button to register the alt modal, but we do not output it. |
|
94 | - lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
95 | - } else { |
|
96 | - $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
97 | - $link_close = '</a>'; |
|
98 | - // We call the button to register the modal, but we do not output it. |
|
99 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
100 | - } |
|
89 | + case 'modal': |
|
90 | + if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
91 | + $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
92 | + $link_close = '</a>'; |
|
93 | + // We call the button to register the alt modal, but we do not output it. |
|
94 | + lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
95 | + } else { |
|
96 | + $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
97 | + $link_close = '</a>'; |
|
98 | + // We call the button to register the modal, but we do not output it. |
|
99 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
100 | + } |
|
101 | 101 | |
102 | - break; |
|
102 | + break; |
|
103 | 103 | |
104 | - case 'none': |
|
105 | - default: |
|
106 | - $link_html = ''; |
|
107 | - $link_close = ''; |
|
108 | - break; |
|
109 | - } |
|
110 | - ?> |
|
104 | + case 'none': |
|
105 | + default: |
|
106 | + $link_html = ''; |
|
107 | + $link_close = ''; |
|
108 | + break; |
|
109 | + } |
|
110 | + ?> |
|
111 | 111 | <div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_setting ); ?>"> |
112 | 112 | <article class="lsx-slot box-shadow"> |
113 | 113 | <div class="exercise-feature-img"> |
114 | 114 | <?php echo wp_kses_post( $link_html ); ?> |
115 | 115 | <?php |
116 | - $thumbnail_args = array( |
|
117 | - 'class' => 'aligncenter', |
|
118 | - ); |
|
119 | - $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
120 | - if ( $alt_image ) { |
|
121 | - $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
122 | - } |
|
123 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
124 | - echo wp_kses_post( $featured_image ); |
|
125 | - } else { |
|
126 | - ?> |
|
116 | + $thumbnail_args = array( |
|
117 | + 'class' => 'aligncenter', |
|
118 | + ); |
|
119 | + $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
120 | + if ( $alt_image ) { |
|
121 | + $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
122 | + } |
|
123 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
124 | + echo wp_kses_post( $featured_image ); |
|
125 | + } else { |
|
126 | + ?> |
|
127 | 127 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
128 | 128 | <?php |
129 | - } |
|
130 | - ?> |
|
129 | + } |
|
130 | + ?> |
|
131 | 131 | <?php echo wp_kses_post( $link_close ); ?> |
132 | 132 | </div> |
133 | 133 | <div class="content-box exercise-content-box white-bg"> |
134 | 134 | <h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>"> |
135 | 135 | <?php echo wp_kses_post( $link_html ); ?> |
136 | 136 | <?php |
137 | - $exercise_title = lsx_health_plan_exercise_title( '', '', false, false, $group['connected_exercises'] ); |
|
137 | + $exercise_title = lsx_health_plan_exercise_title( '', '', false, false, $group['connected_exercises'] ); |
|
138 | 138 | |
139 | - if ( '' !== $alt_title ) { |
|
140 | - $exercise_title = '<span class="exercise-counter">' . $counter . '.</span>' . $alt_title; |
|
141 | - } else { |
|
142 | - $exercise_title = '<span class="exercise-counter">' . $counter . '.</span>' . $exercise_title; |
|
143 | - } |
|
144 | - echo wp_kses_post( $exercise_title ); |
|
145 | - ?> |
|
139 | + if ( '' !== $alt_title ) { |
|
140 | + $exercise_title = '<span class="exercise-counter">' . $counter . '.</span>' . $alt_title; |
|
141 | + } else { |
|
142 | + $exercise_title = '<span class="exercise-counter">' . $counter . '.</span>' . $exercise_title; |
|
143 | + } |
|
144 | + echo wp_kses_post( $exercise_title ); |
|
145 | + ?> |
|
146 | 146 | </a> |
147 | 147 | <?php echo wp_kses_post( $link_close ); ?> |
148 | 148 | </h3> |
149 | 149 | <?php |
150 | - if ( '' !== $content_setting ) { |
|
151 | - ?> |
|
150 | + if ( '' !== $content_setting ) { |
|
151 | + ?> |
|
152 | 152 | <p class="lsx-exercises-excerpt"> |
153 | 153 | <?php |
154 | - if ( 'excerpt' === $content_setting ) { |
|
155 | - $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] ); |
|
154 | + if ( 'excerpt' === $content_setting ) { |
|
155 | + $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] ); |
|
156 | 156 | |
157 | - if ( '' !== $alt_description ) { |
|
158 | - $excerpt = $alt_description; |
|
159 | - } |
|
160 | - echo wp_kses_post( $excerpt ); |
|
161 | - } |
|
162 | - if ( 'full' === $content_setting ) { |
|
163 | - echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) ); |
|
164 | - } |
|
165 | - ?> |
|
157 | + if ( '' !== $alt_description ) { |
|
158 | + $excerpt = $alt_description; |
|
159 | + } |
|
160 | + echo wp_kses_post( $excerpt ); |
|
161 | + } |
|
162 | + if ( 'full' === $content_setting ) { |
|
163 | + echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) ); |
|
164 | + } |
|
165 | + ?> |
|
166 | 166 | </p> |
167 | 167 | <?php |
168 | - } |
|
169 | - ?> |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | <?php |
171 | - $repsclass = ''; |
|
172 | - if ( '' !== $reps ) { |
|
173 | - $repsclass = 'have-reps'; |
|
174 | - } |
|
175 | - ?> |
|
171 | + $repsclass = ''; |
|
172 | + if ( '' !== $reps ) { |
|
173 | + $repsclass = 'have-reps'; |
|
174 | + } |
|
175 | + ?> |
|
176 | 176 | <div class="reps-container <?php echo esc_html( $repsclass ); ?>"> |
177 | 177 | <?php |
178 | - if ( '' !== $reps ) { |
|
179 | - ?> |
|
178 | + if ( '' !== $reps ) { |
|
179 | + ?> |
|
180 | 180 | <?php echo wp_kses_post( $reps ); ?> |
181 | 181 | <?php |
182 | - } |
|
183 | - ?> |
|
182 | + } |
|
183 | + ?> |
|
184 | 184 | <?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?> |
185 | 185 | <?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?> |
186 | 186 | <?php echo wp_kses_post( $link_close ); ?> |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | </article> |
191 | 191 | </div> |
192 | 192 | <?php |
193 | - $counter ++; |
|
194 | - } |
|
195 | - } |
|
196 | - ?> |
|
193 | + $counter ++; |
|
194 | + } |
|
195 | + } |
|
196 | + ?> |
|
197 | 197 | </div> |
198 | 198 | </div> |
199 | 199 | <?php |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | $column_class = '4'; |
10 | 10 | // Check for shortcode overrides. |
11 | 11 | if ( null !== $shortcode_args ) { |
12 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
13 | - $column_class = $shortcode_args['columns']; |
|
14 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
15 | - } |
|
12 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
13 | + $column_class = $shortcode_args['columns']; |
|
14 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | lsx_entry_before(); |
@@ -23,27 +23,27 @@ discard block |
||
23 | 23 | <div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?>"> |
24 | 24 | <div style="background-image:url('<?php echo esc_url( $featured_image ); ?>')" class="lsx-exercises-item bg-<?php echo esc_html( $image_size ); ?>"> |
25 | 25 | <?php |
26 | - if ( isset( $link ) && ( 'modal' === $link ) ) { |
|
27 | - echo wp_kses_post( lsx_health_plan_shortcode_exercise_button( $post_id, true ) ); |
|
28 | - } |
|
26 | + if ( isset( $link ) && ( 'modal' === $link ) ) { |
|
27 | + echo wp_kses_post( lsx_health_plan_shortcode_exercise_button( $post_id, true ) ); |
|
28 | + } |
|
29 | 29 | |
30 | - if ( 'item' === $link ) { |
|
31 | - ?> |
|
30 | + if ( 'item' === $link ) { |
|
31 | + ?> |
|
32 | 32 | <a href="<?php echo esc_url( get_permalink() ); ?>" class="exercise-link excerpt-<?php echo esc_html( $description ); ?>"> |
33 | 33 | <?php |
34 | - } else { |
|
35 | - ?> |
|
34 | + } else { |
|
35 | + ?> |
|
36 | 36 | <div class="exercise-link excerpt-<?php echo esc_html( $description ); ?>"> |
37 | 37 | <?php |
38 | - } |
|
39 | - ?> |
|
38 | + } |
|
39 | + ?> |
|
40 | 40 | |
41 | 41 | <?php lsx_health_plan_exercise_title( '<h4 class="lsx-exercises-title">', '</h4>', false ); ?> |
42 | 42 | <?php if ( isset( $description ) && ( 'none' !== $description ) ) { ?> |
43 | 43 | <?php |
44 | - if ( 'excerpt' === $description ) { |
|
45 | - $excerpt = \lsx_health_plan\functions\hp_excerpt( $post_id ); |
|
46 | - ?> |
|
44 | + if ( 'excerpt' === $description ) { |
|
45 | + $excerpt = \lsx_health_plan\functions\hp_excerpt( $post_id ); |
|
46 | + ?> |
|
47 | 47 | <p class="lsx-exercises-excerpt"><?php echo wp_kses_post( $excerpt ); ?></p> |
48 | 48 | <?php } ?> |
49 | 49 | <?php if ( 'full' === $description ) { ?> |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | <?php } ?> |
52 | 52 | <?php } ?> |
53 | 53 | <?php |
54 | - if ( isset( $link ) && ( 'item' === $link ) ) { |
|
55 | - ?> |
|
54 | + if ( isset( $link ) && ( 'item' === $link ) ) { |
|
55 | + ?> |
|
56 | 56 | </a> |
57 | 57 | <?php } else { ?> |
58 | 58 | </div> |
@@ -8,104 +8,104 @@ |
||
8 | 8 | global $group_name; |
9 | 9 | $groups = get_post_meta( get_the_ID(), $group_name, true ); |
10 | 10 | if ( is_singular( 'workout' ) ) { |
11 | - $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
11 | + $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
12 | 12 | } |
13 | 13 | if ( ! empty( $groups ) ) { |
14 | - ?> |
|
14 | + ?> |
|
15 | 15 | <div class="set-table"> |
16 | 16 | <table class="workout-table"> |
17 | 17 | <?php |
18 | - $table_headers = array(); |
|
19 | - $table_body = array(); |
|
18 | + $table_headers = array(); |
|
19 | + $table_body = array(); |
|
20 | 20 | |
21 | - foreach ( $groups as $group ) { |
|
22 | - $this_row = array(); |
|
21 | + foreach ( $groups as $group ) { |
|
22 | + $this_row = array(); |
|
23 | 23 | |
24 | - $this_row[] = '<tr>'; |
|
24 | + $this_row[] = '<tr>'; |
|
25 | 25 | |
26 | - // Getting the connected exercise. |
|
27 | - if ( post_type_exists( 'exercise' ) ) { |
|
28 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_exercises'] ) ) ) ) { |
|
29 | - $exercise = $group['connected_exercises']; |
|
30 | - $exercise_id = get_post( $exercise ); |
|
31 | - } |
|
32 | - } else { |
|
33 | - $exercise = false; |
|
34 | - $exercise_id = false; |
|
35 | - } |
|
26 | + // Getting the connected exercise. |
|
27 | + if ( post_type_exists( 'exercise' ) ) { |
|
28 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_exercises'] ) ) ) ) { |
|
29 | + $exercise = $group['connected_exercises']; |
|
30 | + $exercise_id = get_post( $exercise ); |
|
31 | + } |
|
32 | + } else { |
|
33 | + $exercise = false; |
|
34 | + $exercise_id = false; |
|
35 | + } |
|
36 | 36 | |
37 | - if ( false !== $exercise && '' !== $exercise ) { |
|
38 | - $exercise_name = get_the_title( $exercise_id ); |
|
39 | - $this_row[] = '<td class="workout-title-item">' . esc_html( $exercise_name ) . '</td>'; |
|
40 | - $table_headers['name'] = true; |
|
41 | - } else { |
|
42 | - if ( isset( $group['name'] ) && '' !== $group['name'] ) { |
|
43 | - $this_row[] = '<td class="workout-title-item">' . esc_html( $group['name'] ) . '</td>'; |
|
44 | - $table_headers['name'] = true; |
|
45 | - } |
|
46 | - } |
|
47 | - // Only display this is exercise is disabled. |
|
48 | - if ( false === $exercise && isset( $group['description'] ) && '' !== $group['description'] ) { |
|
49 | - $this_row[] = '<td class="workout-desc-item"><p>' . esc_html( $group['description'] ) . '</td>'; |
|
50 | - $table_headers['description'] = true; |
|
51 | - } |
|
37 | + if ( false !== $exercise && '' !== $exercise ) { |
|
38 | + $exercise_name = get_the_title( $exercise_id ); |
|
39 | + $this_row[] = '<td class="workout-title-item">' . esc_html( $exercise_name ) . '</td>'; |
|
40 | + $table_headers['name'] = true; |
|
41 | + } else { |
|
42 | + if ( isset( $group['name'] ) && '' !== $group['name'] ) { |
|
43 | + $this_row[] = '<td class="workout-title-item">' . esc_html( $group['name'] ) . '</td>'; |
|
44 | + $table_headers['name'] = true; |
|
45 | + } |
|
46 | + } |
|
47 | + // Only display this is exercise is disabled. |
|
48 | + if ( false === $exercise && isset( $group['description'] ) && '' !== $group['description'] ) { |
|
49 | + $this_row[] = '<td class="workout-desc-item"><p>' . esc_html( $group['description'] ) . '</td>'; |
|
50 | + $table_headers['description'] = true; |
|
51 | + } |
|
52 | 52 | |
53 | - if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
54 | - $this_row[] = '<td class="reps-field-item center-mobile">' . esc_html( $group['reps'] ) . '</td>'; |
|
55 | - $table_headers['reps'] = true; |
|
56 | - } |
|
53 | + if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
54 | + $this_row[] = '<td class="reps-field-item center-mobile">' . esc_html( $group['reps'] ) . '</td>'; |
|
55 | + $table_headers['reps'] = true; |
|
56 | + } |
|
57 | 57 | |
58 | - // Only display this is exercise is disabled. |
|
59 | - if ( false === $exercise ) { |
|
60 | - if ( isset( $group['equipment'] ) && '' !== $group['equipment'] ) { |
|
61 | - $this_row[] = '<td class="equipment-field-item center-mobile">' . esc_html( $group['equipment'] ) . '</td>'; |
|
62 | - $table_headers['equipment'] = true; |
|
63 | - } |
|
64 | - if ( isset( $group['muscle'] ) && '' !== $group['muscle'] ) { |
|
65 | - $this_row[] = '<td class="muscle-field-item center-mobile">' . esc_html( $group['muscle'] ) . '</td>'; |
|
66 | - $table_headers['muscle'] = true; |
|
67 | - } |
|
68 | - } |
|
69 | - if ( post_type_exists( 'video' ) && isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_videos'] ) ) ) ) { |
|
70 | - $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_video_play_button( $m, $group, false ) . '</td>'; |
|
71 | - $table_headers['video'] = true; |
|
72 | - } |
|
73 | - if ( post_type_exists( 'exercise' ) && isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_exercises'] ) ) ) ) { |
|
74 | - $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_exercise_button( $m, $group, false ) . '</td>'; |
|
75 | - $table_headers['exercise'] = true; |
|
76 | - } |
|
77 | - $this_row[] = '</tr>'; |
|
58 | + // Only display this is exercise is disabled. |
|
59 | + if ( false === $exercise ) { |
|
60 | + if ( isset( $group['equipment'] ) && '' !== $group['equipment'] ) { |
|
61 | + $this_row[] = '<td class="equipment-field-item center-mobile">' . esc_html( $group['equipment'] ) . '</td>'; |
|
62 | + $table_headers['equipment'] = true; |
|
63 | + } |
|
64 | + if ( isset( $group['muscle'] ) && '' !== $group['muscle'] ) { |
|
65 | + $this_row[] = '<td class="muscle-field-item center-mobile">' . esc_html( $group['muscle'] ) . '</td>'; |
|
66 | + $table_headers['muscle'] = true; |
|
67 | + } |
|
68 | + } |
|
69 | + if ( post_type_exists( 'video' ) && isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_videos'] ) ) ) ) { |
|
70 | + $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_video_play_button( $m, $group, false ) . '</td>'; |
|
71 | + $table_headers['video'] = true; |
|
72 | + } |
|
73 | + if ( post_type_exists( 'exercise' ) && isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_exercises'] ) ) ) ) { |
|
74 | + $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_exercise_button( $m, $group, false ) . '</td>'; |
|
75 | + $table_headers['exercise'] = true; |
|
76 | + } |
|
77 | + $this_row[] = '</tr>'; |
|
78 | 78 | |
79 | - $table_body[] = implode( '', $this_row ); |
|
80 | - $m++; |
|
81 | - } |
|
79 | + $table_body[] = implode( '', $this_row ); |
|
80 | + $m++; |
|
81 | + } |
|
82 | 82 | |
83 | - // Now we build the table header. |
|
84 | - $table_header = array(); |
|
85 | - $table_header[] = '<tr>'; |
|
86 | - if ( isset( $table_headers['name'] ) ) { |
|
87 | - $table_header[] = '<th class="center-mobile">' . __( 'Workout', 'lsx-health-plan' ) . '</th>'; |
|
88 | - } |
|
89 | - if ( isset( $table_headers['description'] ) ) { |
|
90 | - $table_header[] = '<th class="center-mobile">' . __( 'Description', 'lsx-health-plan' ) . '</th>'; |
|
91 | - } |
|
92 | - if ( isset( $table_headers['reps'] ) ) { |
|
93 | - $table_header[] = '<th class="center-mobile">' . __( 'Reps / Time / Distance', 'lsx-health-plan' ) . '</th>'; |
|
94 | - } |
|
95 | - if ( isset( $table_headers['equipment'] ) ) { |
|
96 | - $table_header[] = '<th class="center-mobile">' . __( 'Equipment', 'lsx-health-plan' ) . '</th>'; |
|
97 | - } |
|
98 | - if ( isset( $table_headers['muscle'] ) ) { |
|
99 | - $table_header[] = '<th class="center-mobile">' . __( 'Muscle', 'lsx-health-plan' ) . '</th>'; |
|
100 | - } |
|
101 | - if ( isset( $table_headers['video'] ) ) { |
|
102 | - $table_header[] = '<th class="center-mobile">' . __( 'How To', 'lsx-health-plan' ) . '</th>'; |
|
103 | - } |
|
104 | - if ( isset( $table_headers['exercise'] ) ) { |
|
105 | - $table_header[] = '<th class="center-mobile">' . __( 'How To', 'lsx-health-plan' ) . '</th>'; |
|
106 | - } |
|
107 | - $table_header[] = '</tr>'; |
|
108 | - ?> |
|
83 | + // Now we build the table header. |
|
84 | + $table_header = array(); |
|
85 | + $table_header[] = '<tr>'; |
|
86 | + if ( isset( $table_headers['name'] ) ) { |
|
87 | + $table_header[] = '<th class="center-mobile">' . __( 'Workout', 'lsx-health-plan' ) . '</th>'; |
|
88 | + } |
|
89 | + if ( isset( $table_headers['description'] ) ) { |
|
90 | + $table_header[] = '<th class="center-mobile">' . __( 'Description', 'lsx-health-plan' ) . '</th>'; |
|
91 | + } |
|
92 | + if ( isset( $table_headers['reps'] ) ) { |
|
93 | + $table_header[] = '<th class="center-mobile">' . __( 'Reps / Time / Distance', 'lsx-health-plan' ) . '</th>'; |
|
94 | + } |
|
95 | + if ( isset( $table_headers['equipment'] ) ) { |
|
96 | + $table_header[] = '<th class="center-mobile">' . __( 'Equipment', 'lsx-health-plan' ) . '</th>'; |
|
97 | + } |
|
98 | + if ( isset( $table_headers['muscle'] ) ) { |
|
99 | + $table_header[] = '<th class="center-mobile">' . __( 'Muscle', 'lsx-health-plan' ) . '</th>'; |
|
100 | + } |
|
101 | + if ( isset( $table_headers['video'] ) ) { |
|
102 | + $table_header[] = '<th class="center-mobile">' . __( 'How To', 'lsx-health-plan' ) . '</th>'; |
|
103 | + } |
|
104 | + if ( isset( $table_headers['exercise'] ) ) { |
|
105 | + $table_header[] = '<th class="center-mobile">' . __( 'How To', 'lsx-health-plan' ) . '</th>'; |
|
106 | + } |
|
107 | + $table_header[] = '</tr>'; |
|
108 | + ?> |
|
109 | 109 | <thead> |
110 | 110 | <?php echo wp_kses_post( implode( '', $table_header ) ); ?> |
111 | 111 | </thead> |