@@ -18,40 +18,40 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | // Check for shortcode overrides. |
| 20 | 20 | if ( null !== $shortcode_args ) { |
| 21 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
| 22 | - $column_class = $shortcode_args['columns']; |
|
| 23 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 24 | - } |
|
| 25 | - if ( isset( $shortcode_args['link'] ) ) { |
|
| 26 | - $link_setting = $shortcode_args['link']; |
|
| 27 | - // Setup our link and content. |
|
| 28 | - switch ( $link_setting ) { |
|
| 29 | - case 'single': |
|
| 30 | - $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
| 31 | - $link_close = '</a>'; |
|
| 32 | - break; |
|
| 21 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
| 22 | + $column_class = $shortcode_args['columns']; |
|
| 23 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 24 | + } |
|
| 25 | + if ( isset( $shortcode_args['link'] ) ) { |
|
| 26 | + $link_setting = $shortcode_args['link']; |
|
| 27 | + // Setup our link and content. |
|
| 28 | + switch ( $link_setting ) { |
|
| 29 | + case 'single': |
|
| 30 | + $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
| 31 | + $link_close = '</a>'; |
|
| 32 | + break; |
|
| 33 | 33 | |
| 34 | - case 'modal': |
|
| 35 | - $link_html = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
| 36 | - $link_close = '</a>'; |
|
| 37 | - $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
| 38 | - $modal_args = array( |
|
| 39 | - 'modal_content' => $modal_content_setting, |
|
| 40 | - ); |
|
| 41 | - // We call the button to register the modal, but we do not output it. |
|
| 42 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
| 43 | - break; |
|
| 34 | + case 'modal': |
|
| 35 | + $link_html = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
| 36 | + $link_close = '</a>'; |
|
| 37 | + $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
| 38 | + $modal_args = array( |
|
| 39 | + 'modal_content' => $modal_content_setting, |
|
| 40 | + ); |
|
| 41 | + // We call the button to register the modal, but we do not output it. |
|
| 42 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
| 43 | + break; |
|
| 44 | 44 | |
| 45 | - case 'none': |
|
| 46 | - default: |
|
| 47 | - $link_html = ''; |
|
| 48 | - $link_close = ''; |
|
| 49 | - break; |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - if ( isset( $shortcode_args['description'] ) ) { |
|
| 53 | - $content_setting = $shortcode_args['description']; |
|
| 54 | - } |
|
| 45 | + case 'none': |
|
| 46 | + default: |
|
| 47 | + $link_html = ''; |
|
| 48 | + $link_close = ''; |
|
| 49 | + break; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + if ( isset( $shortcode_args['description'] ) ) { |
|
| 53 | + $content_setting = $shortcode_args['description']; |
|
| 54 | + } |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | ?> |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | <div class="exercise-feature-img"> |
| 64 | 64 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 65 | 65 | <?php |
| 66 | - $featured_image = get_the_post_thumbnail(); |
|
| 67 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 68 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 69 | - 'class' => 'aligncenter', |
|
| 70 | - ) ); |
|
| 71 | - } else { |
|
| 72 | - ?> |
|
| 66 | + $featured_image = get_the_post_thumbnail(); |
|
| 67 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 68 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 69 | + 'class' => 'aligncenter', |
|
| 70 | + ) ); |
|
| 71 | + } else { |
|
| 72 | + ?> |
|
| 73 | 73 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 74 | 74 | <?php |
| 75 | - } |
|
| 76 | - ?> |
|
| 75 | + } |
|
| 76 | + ?> |
|
| 77 | 77 | </a> |
| 78 | 78 | </div> |
| 79 | 79 | <div class="content-box exercise-content-box white-bg"> |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | <?php lsx_health_plan_exercise_data(); ?> |
| 83 | 83 | </div> |
| 84 | 84 | <?php |
| 85 | - if ( '' !== $content_setting && 'excerpt' === $content_setting ) { |
|
| 86 | - if ( ! has_excerpt() ) { |
|
| 87 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 88 | - $content = '<p>' . $content . '</p>'; |
|
| 89 | - } else { |
|
| 90 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 91 | - } |
|
| 92 | - echo wp_kses_post( $content ); |
|
| 93 | - } |
|
| 94 | - if ( '' !== $content_setting && 'full' === $content_setting ) { |
|
| 95 | - the_content(); |
|
| 96 | - } |
|
| 97 | - ?> |
|
| 85 | + if ( '' !== $content_setting && 'excerpt' === $content_setting ) { |
|
| 86 | + if ( ! has_excerpt() ) { |
|
| 87 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 88 | + $content = '<p>' . $content . '</p>'; |
|
| 89 | + } else { |
|
| 90 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 91 | + } |
|
| 92 | + echo wp_kses_post( $content ); |
|
| 93 | + } |
|
| 94 | + if ( '' !== $content_setting && 'full' === $content_setting ) { |
|
| 95 | + the_content(); |
|
| 96 | + } |
|
| 97 | + ?> |
|
| 98 | 98 | <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See exercise', 'lsx-health-plan' ); ?></a> |
| 99 | 99 | </div> |
| 100 | 100 | <?php lsx_entry_bottom(); ?> |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | <div id="lsx-tips-shortcode" class="daily-plan-block"> |
| 15 | 15 | <div class="lsx-tips-shortcode lsx-tips-slider slick-slider slick-dotted" > |
| 16 | 16 | <?php |
| 17 | - if (is_array($connected_tips) || is_object($connected_tips)) { |
|
| 18 | - foreach ( $connected_tips as $tip ) { |
|
| 19 | - $tip_link = get_permalink( $tip ); |
|
| 20 | - $tip_name = get_the_title( $tip ); |
|
| 21 | - $tip_content = get_post_field( 'post_content', $tip ); |
|
| 22 | - $icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg'; |
|
| 23 | - ?> |
|
| 17 | + if (is_array($connected_tips) || is_object($connected_tips)) { |
|
| 18 | + foreach ( $connected_tips as $tip ) { |
|
| 19 | + $tip_link = get_permalink( $tip ); |
|
| 20 | + $tip_name = get_the_title( $tip ); |
|
| 21 | + $tip_content = get_post_field( 'post_content', $tip ); |
|
| 22 | + $icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg'; |
|
| 23 | + ?> |
|
| 24 | 24 | <div class="content-box diet-tip-wrapper quick-tip"> |
| 25 | 25 | <div class="row"> |
| 26 | 26 | <div class="col-xs-2"> |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | </div> |
| 34 | 34 | </div> |
| 35 | 35 | <?php |
| 36 | - } |
|
| 37 | - } |
|
| 38 | - ?> |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | </div> |
| 41 | 41 | <?php |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | 12 | <?php |
| 13 | - $page_id = get_the_ID(); |
|
| 14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
| 13 | + $page_id = get_the_ID(); |
|
| 14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | <!-- Begining restricted content --> |
| 22 | 22 | <?php |
| 23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 24 | + ?> |
|
| 25 | 25 | <main id="main" role="main"> |
| 26 | 26 | |
| 27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | <div class="row"> |
| 31 | 31 | <?php if ( have_posts() ) : ?> |
| 32 | 32 | <?php |
| 33 | - while ( have_posts() ) : |
|
| 34 | - the_post(); |
|
| 35 | - ?> |
|
| 33 | + while ( have_posts() ) : |
|
| 34 | + the_post(); |
|
| 35 | + ?> |
|
| 36 | 36 | |
| 37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; ?> |
| 38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | </main><!-- #main --> |
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | - } else { |
|
| 55 | - wp_redirect( $redirect ); |
|
| 56 | - exit; |
|
| 57 | - } |
|
| 58 | - ?> |
|
| 54 | + } else { |
|
| 55 | + wp_redirect( $redirect ); |
|
| 56 | + exit; |
|
| 57 | + } |
|
| 58 | + ?> |
|
| 59 | 59 | |
| 60 | 60 | <?php lsx_content_after(); ?> |
| 61 | 61 | |
@@ -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,167 +18,167 @@ 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 | <span class="exercise-counter"><?php echo esc_html( $counter ); ?>.</span> |
| 115 | 115 | <?php echo wp_kses_post( $link_html ); ?> |
| 116 | 116 | <?php |
| 117 | - $thumbnail_args = array( |
|
| 118 | - 'class' => 'aligncenter', |
|
| 119 | - ); |
|
| 120 | - $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
| 121 | - if ( $alt_image ) { |
|
| 122 | - $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
| 123 | - } |
|
| 124 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 125 | - echo wp_kses_post( $featured_image ); |
|
| 126 | - } else { |
|
| 127 | - ?> |
|
| 117 | + $thumbnail_args = array( |
|
| 118 | + 'class' => 'aligncenter', |
|
| 119 | + ); |
|
| 120 | + $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
| 121 | + if ( $alt_image ) { |
|
| 122 | + $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
| 123 | + } |
|
| 124 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 125 | + echo wp_kses_post( $featured_image ); |
|
| 126 | + } else { |
|
| 127 | + ?> |
|
| 128 | 128 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 129 | 129 | <?php |
| 130 | - } |
|
| 131 | - ?> |
|
| 130 | + } |
|
| 131 | + ?> |
|
| 132 | 132 | <?php echo wp_kses_post( $link_close ); ?> |
| 133 | 133 | </div> |
| 134 | 134 | <div class="content-box exercise-content-box white-bg"> |
| 135 | 135 | <h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>"> |
| 136 | 136 | <?php echo wp_kses_post( $link_html ); ?> |
| 137 | 137 | <?php |
| 138 | - $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] ); |
|
| 139 | - if ( '' !== $alt_title ) { |
|
| 140 | - $exercise_title = $alt_title; |
|
| 141 | - } |
|
| 142 | - echo wp_kses_post( $exercise_title ); |
|
| 143 | - ?> |
|
| 138 | + $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] ); |
|
| 139 | + if ( '' !== $alt_title ) { |
|
| 140 | + $exercise_title = $alt_title; |
|
| 141 | + } |
|
| 142 | + echo wp_kses_post( $exercise_title ); |
|
| 143 | + ?> |
|
| 144 | 144 | </a> |
| 145 | 145 | <?php echo wp_kses_post( $link_close ); ?> |
| 146 | 146 | </h3> |
| 147 | 147 | <?php |
| 148 | - if ( '' !== $content_setting ) { |
|
| 149 | - ?> |
|
| 148 | + if ( '' !== $content_setting ) { |
|
| 149 | + ?> |
|
| 150 | 150 | <p class="lsx-exercises-excerpt"> |
| 151 | 151 | <?php |
| 152 | - if ( 'excerpt' === $content_setting ) { |
|
| 153 | - $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] ); |
|
| 152 | + if ( 'excerpt' === $content_setting ) { |
|
| 153 | + $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] ); |
|
| 154 | 154 | |
| 155 | - if ( '' !== $alt_description ) { |
|
| 156 | - $excerpt = $alt_description; |
|
| 157 | - } |
|
| 158 | - echo wp_kses_post( $excerpt ); |
|
| 159 | - } |
|
| 160 | - if ( 'full' === $content_setting ) { |
|
| 161 | - echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) ); |
|
| 162 | - } |
|
| 163 | - ?> |
|
| 155 | + if ( '' !== $alt_description ) { |
|
| 156 | + $excerpt = $alt_description; |
|
| 157 | + } |
|
| 158 | + echo wp_kses_post( $excerpt ); |
|
| 159 | + } |
|
| 160 | + if ( 'full' === $content_setting ) { |
|
| 161 | + echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) ); |
|
| 162 | + } |
|
| 163 | + ?> |
|
| 164 | 164 | </p> |
| 165 | 165 | <?php |
| 166 | - } |
|
| 167 | - ?> |
|
| 166 | + } |
|
| 167 | + ?> |
|
| 168 | 168 | <?php |
| 169 | - $repsclass = ''; |
|
| 170 | - if ( '' !== $reps ) { |
|
| 171 | - $repsclass = 'have-reps'; |
|
| 172 | - } |
|
| 173 | - ?> |
|
| 169 | + $repsclass = ''; |
|
| 170 | + if ( '' !== $reps ) { |
|
| 171 | + $repsclass = 'have-reps'; |
|
| 172 | + } |
|
| 173 | + ?> |
|
| 174 | 174 | <div class="reps-container <?php echo esc_html( $repsclass ); ?>"> |
| 175 | 175 | <?php |
| 176 | - if ( '' !== $reps ) { |
|
| 177 | - ?> |
|
| 176 | + if ( '' !== $reps ) { |
|
| 177 | + ?> |
|
| 178 | 178 | <?php echo wp_kses_post( $reps ); ?> |
| 179 | 179 | <?php |
| 180 | - } |
|
| 181 | - ?> |
|
| 180 | + } |
|
| 181 | + ?> |
|
| 182 | 182 | <?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?> |
| 183 | 183 | <?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?> |
| 184 | 184 | <?php echo wp_kses_post( $link_close ); ?> |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | </article> |
| 189 | 189 | </div> |
| 190 | 190 | <?php |
| 191 | - $counter ++; |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - ?> |
|
| 191 | + $counter ++; |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + ?> |
|
| 195 | 195 | </div> |
| 196 | 196 | </div> |
| 197 | 197 | <?php |
@@ -16,40 +16,40 @@ discard block |
||
| 16 | 16 | $image_size = $args['image_size']; |
| 17 | 17 | |
| 18 | 18 | $query_array = array( |
| 19 | - 'orderby' => $args['orderby'], |
|
| 20 | - 'order' => $args['order'], |
|
| 21 | - 'post_type' => $args['post_type'], |
|
| 22 | - 'posts_per_page' => $limit, |
|
| 19 | + 'orderby' => $args['orderby'], |
|
| 20 | + 'order' => $args['order'], |
|
| 21 | + 'post_type' => $args['post_type'], |
|
| 22 | + 'posts_per_page' => $limit, |
|
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | // If we are calling the exercises with the parent workout. |
| 26 | 26 | if ( false !== 'parent' && 'exercise' === $args['post_type'] ) { |
| 27 | - $items = \lsx_health_plan\functions\get_exercises_by_workout( $args['parent'] ); |
|
| 28 | - if ( ! empty( $items ) ) { |
|
| 29 | - $args['include'] = $items; |
|
| 30 | - } |
|
| 27 | + $items = \lsx_health_plan\functions\get_exercises_by_workout( $args['parent'] ); |
|
| 28 | + if ( ! empty( $items ) ) { |
|
| 29 | + $args['include'] = $items; |
|
| 30 | + } |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if ( isset( $args['include'] ) && ( '' !== $args['include'] ) ) { |
| 34 | - if ( is_array( $args['include'] ) ) { |
|
| 35 | - $include = $args['include']; |
|
| 36 | - } else { |
|
| 37 | - $include = explode( ',', $args['include'] ); |
|
| 38 | - } |
|
| 39 | - $include_filter = $include; |
|
| 40 | - $query_array['post__in'] = $include_filter; |
|
| 41 | - $query_array['orderby'] = 'post__in'; |
|
| 34 | + if ( is_array( $args['include'] ) ) { |
|
| 35 | + $include = $args['include']; |
|
| 36 | + } else { |
|
| 37 | + $include = explode( ',', $args['include'] ); |
|
| 38 | + } |
|
| 39 | + $include_filter = $include; |
|
| 40 | + $query_array['post__in'] = $include_filter; |
|
| 41 | + $query_array['orderby'] = 'post__in'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if ( isset( $taxonomy ) && ( '' !== $taxonomy ) && isset( $term ) && ( '' !== $term ) ) { |
| 45 | - $taxonomy_filter = array( |
|
| 46 | - array( |
|
| 47 | - 'taxonomy' => $taxonomy, |
|
| 48 | - 'field' => 'slug', |
|
| 49 | - 'terms' => $term, |
|
| 50 | - ), |
|
| 51 | - ); |
|
| 52 | - $query_array['tax_query'] = $taxonomy_filter; |
|
| 45 | + $taxonomy_filter = array( |
|
| 46 | + array( |
|
| 47 | + 'taxonomy' => $taxonomy, |
|
| 48 | + 'field' => 'slug', |
|
| 49 | + 'terms' => $term, |
|
| 50 | + ), |
|
| 51 | + ); |
|
| 52 | + $query_array['tax_query'] = $taxonomy_filter; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $exercises = new WP_Query( $query_array ); |
@@ -58,46 +58,46 @@ discard block |
||
| 58 | 58 | <div id="lsx-exercises-shortcode" class="daily-plan-block layout-<?php echo esc_html( $args['layout'] ); ?> columns-<?php echo esc_html( $args['columns'] ); ?> shortcode-type-<?php echo esc_html( $args['post_type'] ); ?>"> |
| 59 | 59 | <div class="lsx-exercises-shortcode" > |
| 60 | 60 | <?php |
| 61 | - if ( $exercises->have_posts() ) { |
|
| 62 | - while ( $exercises->have_posts() ) { |
|
| 63 | - $exercises->the_post(); |
|
| 64 | - switch ( $args['post_type'] ) { |
|
| 65 | - case 'workout': |
|
| 66 | - include LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 67 | - break; |
|
| 61 | + if ( $exercises->have_posts() ) { |
|
| 62 | + while ( $exercises->have_posts() ) { |
|
| 63 | + $exercises->the_post(); |
|
| 64 | + switch ( $args['post_type'] ) { |
|
| 65 | + case 'workout': |
|
| 66 | + include LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 67 | + break; |
|
| 68 | 68 | |
| 69 | - case 'meal': |
|
| 70 | - include LSX_HEALTH_PLAN_PATH . 'templates/partials/meal-plans.php'; |
|
| 71 | - break; |
|
| 69 | + case 'meal': |
|
| 70 | + include LSX_HEALTH_PLAN_PATH . 'templates/partials/meal-plans.php'; |
|
| 71 | + break; |
|
| 72 | 72 | |
| 73 | - /*case 'exercise': |
|
| 73 | + /*case 'exercise': |
|
| 74 | 74 | include LSX_HEALTH_PLAN_PATH . 'templates/partials/content-shortcode-exercise.php'; |
| 75 | 75 | break;*/ |
| 76 | 76 | |
| 77 | - case 'exercise': |
|
| 78 | - case 'recipe': |
|
| 79 | - case 'tip': |
|
| 80 | - include LSX_HEALTH_PLAN_PATH . 'templates/content-archive-' . $args['post_type'] . '.php'; |
|
| 81 | - break; |
|
| 77 | + case 'exercise': |
|
| 78 | + case 'recipe': |
|
| 79 | + case 'tip': |
|
| 80 | + include LSX_HEALTH_PLAN_PATH . 'templates/content-archive-' . $args['post_type'] . '.php'; |
|
| 81 | + break; |
|
| 82 | 82 | |
| 83 | - default: |
|
| 84 | - include LSX_HEALTH_PLAN_PATH . 'templates/partials/content-default.php'; |
|
| 85 | - break; |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - } |
|
| 89 | - wp_reset_postdata(); |
|
| 90 | - ?> |
|
| 83 | + default: |
|
| 84 | + include LSX_HEALTH_PLAN_PATH . 'templates/partials/content-default.php'; |
|
| 85 | + break; |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | + wp_reset_postdata(); |
|
| 90 | + ?> |
|
| 91 | 91 | </div> |
| 92 | 92 | <?php |
| 93 | - if ( isset( $args['view_more'] ) && false !== $args['view_more'] ) { |
|
| 94 | - ?> |
|
| 93 | + if ( isset( $args['view_more'] ) && false !== $args['view_more'] ) { |
|
| 94 | + ?> |
|
| 95 | 95 | <div class="col-md-12"> |
| 96 | 96 | <a class="<?php echo esc_html( $link_class ); ?>" href="<?php echo esc_url( get_post_type_archive_link( $args['post_type'] ) ); ?>"><?php echo esc_html_e( 'Show More', 'lsx-health-plan' ); ?></a> |
| 97 | 97 | </div> |
| 98 | 98 | <?php |
| 99 | - } |
|
| 100 | - ?> |
|
| 99 | + } |
|
| 100 | + ?> |
|
| 101 | 101 | </div> |
| 102 | 102 | <?php |
| 103 | 103 | $shortcode_args = null; |
@@ -20,63 +20,63 @@ discard block |
||
| 20 | 20 | <?php } ?> |
| 21 | 21 | <tbody> |
| 22 | 22 | <?php |
| 23 | - if ( 1 >= (int) $serves ) { |
|
| 24 | - $serves = '1'; |
|
| 25 | - $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
| 26 | - } else { |
|
| 27 | - $serves_label = __( 'People', 'lsx-health-plan' ); |
|
| 28 | - } |
|
| 29 | - ?> |
|
| 23 | + if ( 1 >= (int) $serves ) { |
|
| 24 | + $serves = '1'; |
|
| 25 | + $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
| 26 | + } else { |
|
| 27 | + $serves_label = __( 'People', 'lsx-health-plan' ); |
|
| 28 | + } |
|
| 29 | + ?> |
|
| 30 | 30 | <tr class="serves"> |
| 31 | 31 | <td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?> </td> |
| 32 | 32 | <td> |
| 33 | 33 | <?php |
| 34 | - echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
| 35 | - ?> |
|
| 34 | + echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
| 35 | + ?> |
|
| 36 | 36 | </td> |
| 37 | 37 | </tr> |
| 38 | 38 | <?php |
| 39 | - if ( ! empty( $prep_time ) ) { |
|
| 40 | - ?> |
|
| 39 | + if ( ! empty( $prep_time ) ) { |
|
| 40 | + ?> |
|
| 41 | 41 | <tr class="prep-time"> |
| 42 | 42 | <td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?> </td> |
| 43 | 43 | <td> |
| 44 | 44 | <?php |
| 45 | - echo wp_kses_post( $prep_time ); |
|
| 46 | - ?> |
|
| 45 | + echo wp_kses_post( $prep_time ); |
|
| 46 | + ?> |
|
| 47 | 47 | </td> |
| 48 | 48 | </tr> |
| 49 | 49 | <?php |
| 50 | - } |
|
| 51 | - ?> |
|
| 50 | + } |
|
| 51 | + ?> |
|
| 52 | 52 | <?php |
| 53 | - if ( ! empty( $cooking_time ) ) { |
|
| 54 | - ?> |
|
| 53 | + if ( ! empty( $cooking_time ) ) { |
|
| 54 | + ?> |
|
| 55 | 55 | <tr class="cooking-time"> |
| 56 | 56 | <td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?> </td> |
| 57 | 57 | <td> |
| 58 | 58 | <?php |
| 59 | - echo wp_kses_post( $cooking_time ); |
|
| 60 | - ?> |
|
| 59 | + echo wp_kses_post( $cooking_time ); |
|
| 60 | + ?> |
|
| 61 | 61 | </td> |
| 62 | 62 | </tr> |
| 63 | 63 | <?php |
| 64 | - } |
|
| 65 | - ?> |
|
| 64 | + } |
|
| 65 | + ?> |
|
| 66 | 66 | <?php |
| 67 | - if ( ! empty( $portion ) ) { |
|
| 68 | - ?> |
|
| 67 | + if ( ! empty( $portion ) ) { |
|
| 68 | + ?> |
|
| 69 | 69 | <tr class="portion-size"> |
| 70 | 70 | <td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?> </td> |
| 71 | 71 | <td> |
| 72 | 72 | <?php |
| 73 | - echo wp_kses_post( $portion ); |
|
| 74 | - ?> |
|
| 73 | + echo wp_kses_post( $portion ); |
|
| 74 | + ?> |
|
| 75 | 75 | </td> |
| 76 | 76 | </tr> |
| 77 | 77 | <?php |
| 78 | - } |
|
| 79 | - ?> |
|
| 78 | + } |
|
| 79 | + ?> |
|
| 80 | 80 | </tbody> |
| 81 | 81 | </table> |
| 82 | 82 | <?php } ?> |
@@ -89,75 +89,75 @@ discard block |
||
| 89 | 89 | </thead> |
| 90 | 90 | <tbody> |
| 91 | 91 | <?php |
| 92 | - if ( ! empty( $energy ) ) { |
|
| 93 | - ?> |
|
| 92 | + if ( ! empty( $energy ) ) { |
|
| 93 | + ?> |
|
| 94 | 94 | <tr class="energy"> |
| 95 | 95 | <td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?> </td> |
| 96 | 96 | <td> |
| 97 | 97 | <?php |
| 98 | - echo wp_kses_post( $energy ); |
|
| 99 | - ?> |
|
| 98 | + echo wp_kses_post( $energy ); |
|
| 99 | + ?> |
|
| 100 | 100 | </td> |
| 101 | 101 | </tr> |
| 102 | 102 | <?php |
| 103 | - } |
|
| 104 | - ?> |
|
| 103 | + } |
|
| 104 | + ?> |
|
| 105 | 105 | <?php |
| 106 | - if ( ! empty( $protein ) ) { |
|
| 107 | - ?> |
|
| 106 | + if ( ! empty( $protein ) ) { |
|
| 107 | + ?> |
|
| 108 | 108 | <tr class="protein"> |
| 109 | 109 | <td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?> </td> |
| 110 | 110 | <td> |
| 111 | 111 | <?php |
| 112 | - echo wp_kses_post( $protein ); |
|
| 113 | - ?> |
|
| 112 | + echo wp_kses_post( $protein ); |
|
| 113 | + ?> |
|
| 114 | 114 | </td> |
| 115 | 115 | </tr> |
| 116 | 116 | <?php |
| 117 | - } |
|
| 118 | - ?> |
|
| 117 | + } |
|
| 118 | + ?> |
|
| 119 | 119 | <?php |
| 120 | - if ( ! empty( $carbohydrates ) ) { |
|
| 121 | - ?> |
|
| 120 | + if ( ! empty( $carbohydrates ) ) { |
|
| 121 | + ?> |
|
| 122 | 122 | <tr class="carbohydrates"> |
| 123 | 123 | <td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?> </td> |
| 124 | 124 | <td> |
| 125 | 125 | <?php |
| 126 | - echo wp_kses_post( $carbohydrates ); |
|
| 127 | - ?> |
|
| 126 | + echo wp_kses_post( $carbohydrates ); |
|
| 127 | + ?> |
|
| 128 | 128 | </td> |
| 129 | 129 | </tr> |
| 130 | 130 | <?php |
| 131 | - } |
|
| 132 | - ?> |
|
| 131 | + } |
|
| 132 | + ?> |
|
| 133 | 133 | <?php |
| 134 | - if ( ! empty( $fibre ) ) { |
|
| 135 | - ?> |
|
| 134 | + if ( ! empty( $fibre ) ) { |
|
| 135 | + ?> |
|
| 136 | 136 | <tr class="fibre"> |
| 137 | 137 | <td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?> </td> |
| 138 | 138 | <td> |
| 139 | 139 | <?php |
| 140 | - echo wp_kses_post( $fibre ); |
|
| 141 | - ?> |
|
| 140 | + echo wp_kses_post( $fibre ); |
|
| 141 | + ?> |
|
| 142 | 142 | </td> |
| 143 | 143 | </tr> |
| 144 | 144 | <?php |
| 145 | - } |
|
| 146 | - ?> |
|
| 145 | + } |
|
| 146 | + ?> |
|
| 147 | 147 | <?php |
| 148 | - if ( ! empty( $fat ) ) { |
|
| 149 | - ?> |
|
| 148 | + if ( ! empty( $fat ) ) { |
|
| 149 | + ?> |
|
| 150 | 150 | <tr class="fat"> |
| 151 | 151 | <td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?> </td> |
| 152 | 152 | <td> |
| 153 | 153 | <?php |
| 154 | - echo wp_kses_post( $fat ); |
|
| 155 | - ?> |
|
| 154 | + echo wp_kses_post( $fat ); |
|
| 155 | + ?> |
|
| 156 | 156 | </td> |
| 157 | 157 | </tr> |
| 158 | 158 | <?php |
| 159 | - } |
|
| 160 | - ?> |
|
| 159 | + } |
|
| 160 | + ?> |
|
| 161 | 161 | </tbody> |
| 162 | 162 | </table> |
| 163 | 163 | <?php } ?> |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | 12 | <?php |
| 13 | - $page_id = get_the_ID(); |
|
| 14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
| 13 | + $page_id = get_the_ID(); |
|
| 14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | <!-- Begining restricted content --> |
| 22 | 22 | <?php |
| 23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 24 | + ?> |
|
| 25 | 25 | <main id="main" role="main"> |
| 26 | 26 | |
| 27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | <div class="row"> |
| 31 | 31 | <?php if ( have_posts() ) : ?> |
| 32 | 32 | <?php |
| 33 | - while ( have_posts() ) : |
|
| 34 | - the_post(); |
|
| 35 | - ?> |
|
| 33 | + while ( have_posts() ) : |
|
| 34 | + the_post(); |
|
| 35 | + ?> |
|
| 36 | 36 | |
| 37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-meal.php'; ?> |
| 38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | </main><!-- #main --> |
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | - } else { |
|
| 55 | - wp_redirect( $redirect ); |
|
| 56 | - exit; |
|
| 57 | - } |
|
| 58 | - ?> |
|
| 54 | + } else { |
|
| 55 | + wp_redirect( $redirect ); |
|
| 56 | + exit; |
|
| 57 | + } |
|
| 58 | + ?> |
|
| 59 | 59 | |
| 60 | 60 | <?php lsx_content_after(); ?> |
| 61 | 61 | |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | 12 | <?php |
| 13 | - $page_id = get_the_ID(); |
|
| 14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
| 13 | + $page_id = get_the_ID(); |
|
| 14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | <!-- Begining restricted content --> |
| 22 | 22 | <?php |
| 23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 24 | + ?> |
|
| 25 | 25 | <main id="main" role="main"> |
| 26 | 26 | |
| 27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | <div class="row"> |
| 31 | 31 | <?php if ( have_posts() ) : ?> |
| 32 | 32 | <?php |
| 33 | - while ( have_posts() ) : |
|
| 34 | - the_post(); |
|
| 35 | - ?> |
|
| 33 | + while ( have_posts() ) : |
|
| 34 | + the_post(); |
|
| 35 | + ?> |
|
| 36 | 36 | |
| 37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-recipe.php'; ?> |
| 38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | </main><!-- #main --> |
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | - } else { |
|
| 55 | - wp_redirect( $redirect ); |
|
| 56 | - exit; |
|
| 57 | - } |
|
| 58 | - ?> |
|
| 54 | + } else { |
|
| 55 | + wp_redirect( $redirect ); |
|
| 56 | + exit; |
|
| 57 | + } |
|
| 58 | + ?> |
|
| 59 | 59 | |
| 60 | 60 | <?php lsx_content_after(); ?> |
| 61 | 61 | |
@@ -8,424 +8,424 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Exercise { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Exercise() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Holds post_type slug used as an index |
|
| 22 | - * |
|
| 23 | - * @since 1.0.0 |
|
| 24 | - * |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - public $slug = 'exercise'; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Constructor |
|
| 31 | - */ |
|
| 32 | - public function __construct() { |
|
| 33 | - |
|
| 34 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 35 | - // Post Type and Taxonomies. |
|
| 36 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 37 | - add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) ); |
|
| 38 | - add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) ); |
|
| 39 | - add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) ); |
|
| 40 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 41 | - |
|
| 42 | - // Custom Fields. |
|
| 43 | - add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 ); |
|
| 44 | - add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 ); |
|
| 45 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 46 | - |
|
| 47 | - // Template Redirects. |
|
| 48 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 49 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 50 | - |
|
| 51 | - //Breadcrumbs |
|
| 52 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 ); |
|
| 53 | - |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Return an instance of this class. |
|
| 61 | - * |
|
| 62 | - * @since 1.0.0 |
|
| 63 | - * |
|
| 64 | - * @return object \lsx_health_plan\classes\Exercise() A single instance of this class. |
|
| 65 | - */ |
|
| 66 | - public static function get_instance() { |
|
| 67 | - // If the single instance hasn't been set, set it now. |
|
| 68 | - if ( null === self::$instance ) { |
|
| 69 | - self::$instance = new self(); |
|
| 70 | - } |
|
| 71 | - return self::$instance; |
|
| 72 | - } |
|
| 73 | - /** |
|
| 74 | - * Register the post type. |
|
| 75 | - */ |
|
| 76 | - public function register_post_type() { |
|
| 77 | - $labels = array( |
|
| 78 | - 'name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
| 79 | - 'singular_name' => esc_html__( 'Exercise', 'lsx-health-plan' ), |
|
| 80 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 81 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 82 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 83 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 84 | - 'all_items' => esc_html__( 'All Exercises', 'lsx-health-plan' ), |
|
| 85 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 86 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 87 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 88 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 89 | - 'parent_item_colon' => '', |
|
| 90 | - 'menu_name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
| 91 | - ); |
|
| 92 | - $args = array( |
|
| 93 | - 'labels' => $labels, |
|
| 94 | - 'public' => true, |
|
| 95 | - 'publicly_queryable' => true, |
|
| 96 | - 'show_ui' => true, |
|
| 97 | - 'show_in_menu' => false, |
|
| 98 | - 'show_in_rest' => true, |
|
| 99 | - 'menu_icon' => 'dashicons-universal-access', |
|
| 100 | - 'query_var' => true, |
|
| 101 | - 'rewrite' => array( |
|
| 102 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 103 | - ), |
|
| 104 | - 'capability_type' => 'page', |
|
| 105 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ), |
|
| 106 | - 'hierarchical' => false, |
|
| 107 | - 'menu_position' => null, |
|
| 108 | - 'supports' => array( |
|
| 109 | - 'title', |
|
| 110 | - 'thumbnail', |
|
| 111 | - 'editor', |
|
| 112 | - 'excerpt', |
|
| 113 | - 'custom-fields', |
|
| 114 | - ), |
|
| 115 | - ); |
|
| 116 | - register_post_type( 'exercise', $args ); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * Register the Exercise taxonomy. |
|
| 121 | - * |
|
| 122 | - * @return void |
|
| 123 | - */ |
|
| 124 | - public function exercise_type_taxonomy_setup() { |
|
| 125 | - $labels = array( |
|
| 126 | - 'name' => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 127 | - 'singular_name' => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 128 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 129 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 130 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 131 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 132 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 133 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 134 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 135 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 136 | - 'menu_name' => esc_html__( 'Exercise Types', 'lsx-health-plan' ), |
|
| 137 | - ); |
|
| 138 | - |
|
| 139 | - $args = array( |
|
| 140 | - 'hierarchical' => true, |
|
| 141 | - 'labels' => $labels, |
|
| 142 | - 'show_ui' => true, |
|
| 143 | - 'show_admin_column' => true, |
|
| 144 | - 'query_var' => true, |
|
| 145 | - 'rewrite' => array( |
|
| 146 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ), |
|
| 147 | - ), |
|
| 148 | - 'show_in_rest' => true, |
|
| 149 | - ); |
|
| 150 | - |
|
| 151 | - register_taxonomy( 'exercise-type', array( 'exercise' ), $args ); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Register the Exercise taxonomy. |
|
| 156 | - * |
|
| 157 | - * @return void |
|
| 158 | - */ |
|
| 159 | - public function equipment_taxonomy_setup() { |
|
| 160 | - $labels = array( |
|
| 161 | - 'name' => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 162 | - 'singular_name' => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 163 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 164 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 165 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 166 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 167 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 168 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 169 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 170 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 171 | - 'menu_name' => esc_html__( 'Equipment', 'lsx-health-plan' ), |
|
| 172 | - ); |
|
| 173 | - |
|
| 174 | - $args = array( |
|
| 175 | - 'hierarchical' => true, |
|
| 176 | - 'labels' => $labels, |
|
| 177 | - 'show_ui' => true, |
|
| 178 | - 'show_admin_column' => true, |
|
| 179 | - 'query_var' => true, |
|
| 180 | - 'rewrite' => array( |
|
| 181 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ), |
|
| 182 | - ), |
|
| 183 | - 'show_in_rest' => true, |
|
| 184 | - ); |
|
| 185 | - |
|
| 186 | - register_taxonomy( 'equipment', array( 'exercise' ), $args ); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Register the Muscle Group taxonomy. |
|
| 191 | - * |
|
| 192 | - * @return void |
|
| 193 | - */ |
|
| 194 | - public function muscle_group_taxonomy_setup() { |
|
| 195 | - $labels = array( |
|
| 196 | - 'name' => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 197 | - 'singular_name' => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 198 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 199 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 200 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 201 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 202 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 203 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 204 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 205 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 206 | - 'menu_name' => esc_html__( 'Muscle Groups', 'lsx-health-plan' ), |
|
| 207 | - ); |
|
| 208 | - |
|
| 209 | - $args = array( |
|
| 210 | - 'hierarchical' => true, |
|
| 211 | - 'labels' => $labels, |
|
| 212 | - 'show_ui' => true, |
|
| 213 | - 'show_admin_column' => true, |
|
| 214 | - 'query_var' => true, |
|
| 215 | - 'rewrite' => array( |
|
| 216 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_muscle_group', 'muscle-group' ), |
|
| 217 | - ), |
|
| 218 | - 'show_in_rest' => true, |
|
| 219 | - ); |
|
| 220 | - |
|
| 221 | - register_taxonomy( 'muscle-group', array( 'exercise' ), $args ); |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * Registers the Recipes under the Meals Post type menu. |
|
| 226 | - * |
|
| 227 | - * @return void |
|
| 228 | - */ |
|
| 229 | - public function register_menus() { |
|
| 230 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' ); |
|
| 231 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' ); |
|
| 232 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' ); |
|
| 233 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' ); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * Adds the post type to the different arrays. |
|
| 238 | - * |
|
| 239 | - * @param array $post_types |
|
| 240 | - * @return array |
|
| 241 | - */ |
|
| 242 | - public function enable_post_type( $post_types = array() ) { |
|
| 243 | - $post_types[] = $this->slug; |
|
| 244 | - return $post_types; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * Enables the Bi Directional relationships |
|
| 249 | - * |
|
| 250 | - * @param array $connections |
|
| 251 | - * @return void |
|
| 252 | - */ |
|
| 253 | - public function enable_connections( $connections = array() ) { |
|
| 254 | - $connections['exercise']['connected_workouts'] = 'connected_exercises'; |
|
| 255 | - $connections['workout']['connected_exercises'] = 'connected_workouts'; |
|
| 256 | - return $connections; |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * Define the metabox and field configurations. |
|
| 261 | - */ |
|
| 262 | - public function gallery_metabox() { |
|
| 263 | - $cmb = new_cmb2_box( |
|
| 264 | - array( |
|
| 265 | - 'id' => $this->slug . '_gallery_details_metabox', |
|
| 266 | - 'title' => __( 'Exercise Gallery', 'lsx-health-plan' ), |
|
| 267 | - 'object_types' => array( $this->slug ), |
|
| 268 | - 'context' => 'normal', |
|
| 269 | - 'priority' => 'low', |
|
| 270 | - 'show_names' => true, |
|
| 271 | - ) |
|
| 272 | - ); |
|
| 273 | - |
|
| 274 | - $cmb->add_field( |
|
| 275 | - array( |
|
| 276 | - 'name' => __( 'Layout', 'lsx-health-plan' ), |
|
| 277 | - 'id' => $this->slug . '_gallery_layout', |
|
| 278 | - 'type' => 'radio', |
|
| 279 | - 'options' => array( |
|
| 280 | - 'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
| 281 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 282 | - ), |
|
| 283 | - 'default' => 'grid', |
|
| 284 | - ) |
|
| 285 | - ); |
|
| 286 | - |
|
| 287 | - $cmb->add_field( |
|
| 288 | - array( |
|
| 289 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 290 | - 'id' => $this->slug . '_gallery_columns', |
|
| 291 | - 'type' => 'text', |
|
| 292 | - 'default' => '1', |
|
| 293 | - ) |
|
| 294 | - ); |
|
| 295 | - |
|
| 296 | - // Repeatable group. |
|
| 297 | - $gallery_group = $cmb->add_field( |
|
| 298 | - array( |
|
| 299 | - 'id' => $this->slug . '_gallery', |
|
| 300 | - 'type' => 'group', |
|
| 301 | - 'options' => array( |
|
| 302 | - 'group_title' => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
| 303 | - 'add_button' => __( 'Add Item', 'lsx-health-plan' ), |
|
| 304 | - 'remove_button' => __( 'Remove Item', 'lsx-health-plan' ), |
|
| 305 | - 'sortable' => true, |
|
| 306 | - ), |
|
| 307 | - 'classes' => 'lsx-admin-row', |
|
| 308 | - ) |
|
| 309 | - ); |
|
| 310 | - |
|
| 311 | - // Title. |
|
| 312 | - $cmb->add_group_field( |
|
| 313 | - $gallery_group, |
|
| 314 | - array( |
|
| 315 | - 'name' => __( 'Image', 'lsx-health-plan' ), |
|
| 316 | - 'id' => $this->slug . '_gallery_image', |
|
| 317 | - 'type' => 'file', |
|
| 318 | - 'text' => array( |
|
| 319 | - 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
| 320 | - ), |
|
| 321 | - 'desc' => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ), |
|
| 322 | - 'query_args' => array( |
|
| 323 | - 'type' => array( |
|
| 324 | - 'image/gif', |
|
| 325 | - 'image/jpeg', |
|
| 326 | - 'image/png', |
|
| 327 | - ), |
|
| 328 | - ), |
|
| 329 | - 'preview_size' => 'lsx-thumbnail-wide', |
|
| 330 | - ) |
|
| 331 | - ); |
|
| 332 | - |
|
| 333 | - // Title. |
|
| 334 | - $cmb->add_group_field( |
|
| 335 | - $gallery_group, |
|
| 336 | - array( |
|
| 337 | - 'name' => __( 'oEmbed', 'lsx-health-plan' ), |
|
| 338 | - 'id' => $this->slug . '_gallery_embed', |
|
| 339 | - 'type' => 'text', |
|
| 340 | - 'desc' => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ), |
|
| 341 | - ) |
|
| 342 | - ); |
|
| 343 | - |
|
| 344 | - $cmb->add_group_field( |
|
| 345 | - $gallery_group, |
|
| 346 | - array( |
|
| 347 | - 'name' => __( 'External Media', 'lsx-health-plan' ), |
|
| 348 | - 'id' => $this->slug . '_gallery_external', |
|
| 349 | - 'type' => 'textarea_code', |
|
| 350 | - 'desc' => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: <iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen></iframe>', 'lsx-health-plan' ), |
|
| 351 | - ) |
|
| 352 | - ); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - /** |
|
| 356 | - * Registers the general settings for the exercise. |
|
| 357 | - * |
|
| 358 | - * @return void |
|
| 359 | - */ |
|
| 360 | - public function exercise_details() { |
|
| 361 | - $cmb = new_cmb2_box( |
|
| 362 | - array( |
|
| 363 | - 'id' => $this->slug . '_general_details_metabox', |
|
| 364 | - 'title' => __( 'Details', 'lsx-health-plan' ), |
|
| 365 | - 'object_types' => array( $this->slug ), |
|
| 366 | - 'context' => 'normal', |
|
| 367 | - 'priority' => 'high', |
|
| 368 | - 'show_names' => true, |
|
| 369 | - ) |
|
| 370 | - ); |
|
| 371 | - |
|
| 372 | - $cmb->add_field( |
|
| 373 | - array( |
|
| 374 | - 'name' => __( 'Side', 'lsx-health-plan' ), |
|
| 375 | - 'id' => $this->slug . '_side', |
|
| 376 | - 'type' => 'select', |
|
| 377 | - 'options' => array( |
|
| 378 | - '' => __( 'Select', 'lsx-health-plan' ), |
|
| 379 | - 'left' => __( 'Left', 'lsx-health-plan' ), |
|
| 380 | - 'right' => __( 'Right', 'lsx-health-plan' ), |
|
| 381 | - ), |
|
| 382 | - 'desc' => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ), |
|
| 383 | - ) |
|
| 384 | - ); |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * Holds the array for the single exercise breadcrumbs. |
|
| 389 | - * |
|
| 390 | - * @var array $crumbs |
|
| 391 | - * @return array |
|
| 392 | - */ |
|
| 393 | - public function exercise_breadcrumb_filter( $crumbs ) { |
|
| 394 | - $exercise = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' ); |
|
| 395 | - $exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' ); |
|
| 396 | - $url = get_post_type_archive_link( $exercise ); |
|
| 397 | - |
|
| 398 | - if ( is_singular( 'exercise' ) ) { |
|
| 399 | - $exercise_name = get_the_title(); |
|
| 400 | - $term_obj_list = get_the_terms( get_the_ID(), 'exercise-type' ); |
|
| 401 | - $exercise_type = $term_obj_list[0]->name; |
|
| 402 | - $exercise_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\Exercise() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Holds post_type slug used as an index |
|
| 22 | + * |
|
| 23 | + * @since 1.0.0 |
|
| 24 | + * |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + public $slug = 'exercise'; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Constructor |
|
| 31 | + */ |
|
| 32 | + public function __construct() { |
|
| 33 | + |
|
| 34 | + if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 35 | + // Post Type and Taxonomies. |
|
| 36 | + add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 37 | + add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) ); |
|
| 38 | + add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) ); |
|
| 39 | + add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) ); |
|
| 40 | + add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 41 | + |
|
| 42 | + // Custom Fields. |
|
| 43 | + add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 ); |
|
| 44 | + add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 ); |
|
| 45 | + add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 46 | + |
|
| 47 | + // Template Redirects. |
|
| 48 | + add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 49 | + add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 50 | + |
|
| 51 | + //Breadcrumbs |
|
| 52 | + add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 ); |
|
| 53 | + |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Return an instance of this class. |
|
| 61 | + * |
|
| 62 | + * @since 1.0.0 |
|
| 63 | + * |
|
| 64 | + * @return object \lsx_health_plan\classes\Exercise() A single instance of this class. |
|
| 65 | + */ |
|
| 66 | + public static function get_instance() { |
|
| 67 | + // If the single instance hasn't been set, set it now. |
|
| 68 | + if ( null === self::$instance ) { |
|
| 69 | + self::$instance = new self(); |
|
| 70 | + } |
|
| 71 | + return self::$instance; |
|
| 72 | + } |
|
| 73 | + /** |
|
| 74 | + * Register the post type. |
|
| 75 | + */ |
|
| 76 | + public function register_post_type() { |
|
| 77 | + $labels = array( |
|
| 78 | + 'name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
| 79 | + 'singular_name' => esc_html__( 'Exercise', 'lsx-health-plan' ), |
|
| 80 | + 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 81 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 82 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 83 | + 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 84 | + 'all_items' => esc_html__( 'All Exercises', 'lsx-health-plan' ), |
|
| 85 | + 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 86 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 87 | + 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 88 | + 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 89 | + 'parent_item_colon' => '', |
|
| 90 | + 'menu_name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
| 91 | + ); |
|
| 92 | + $args = array( |
|
| 93 | + 'labels' => $labels, |
|
| 94 | + 'public' => true, |
|
| 95 | + 'publicly_queryable' => true, |
|
| 96 | + 'show_ui' => true, |
|
| 97 | + 'show_in_menu' => false, |
|
| 98 | + 'show_in_rest' => true, |
|
| 99 | + 'menu_icon' => 'dashicons-universal-access', |
|
| 100 | + 'query_var' => true, |
|
| 101 | + 'rewrite' => array( |
|
| 102 | + 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 103 | + ), |
|
| 104 | + 'capability_type' => 'page', |
|
| 105 | + 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ), |
|
| 106 | + 'hierarchical' => false, |
|
| 107 | + 'menu_position' => null, |
|
| 108 | + 'supports' => array( |
|
| 109 | + 'title', |
|
| 110 | + 'thumbnail', |
|
| 111 | + 'editor', |
|
| 112 | + 'excerpt', |
|
| 113 | + 'custom-fields', |
|
| 114 | + ), |
|
| 115 | + ); |
|
| 116 | + register_post_type( 'exercise', $args ); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * Register the Exercise taxonomy. |
|
| 121 | + * |
|
| 122 | + * @return void |
|
| 123 | + */ |
|
| 124 | + public function exercise_type_taxonomy_setup() { |
|
| 125 | + $labels = array( |
|
| 126 | + 'name' => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 127 | + 'singular_name' => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 128 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 129 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 130 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 131 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 132 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 133 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 134 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 135 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 136 | + 'menu_name' => esc_html__( 'Exercise Types', 'lsx-health-plan' ), |
|
| 137 | + ); |
|
| 138 | + |
|
| 139 | + $args = array( |
|
| 140 | + 'hierarchical' => true, |
|
| 141 | + 'labels' => $labels, |
|
| 142 | + 'show_ui' => true, |
|
| 143 | + 'show_admin_column' => true, |
|
| 144 | + 'query_var' => true, |
|
| 145 | + 'rewrite' => array( |
|
| 146 | + 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ), |
|
| 147 | + ), |
|
| 148 | + 'show_in_rest' => true, |
|
| 149 | + ); |
|
| 150 | + |
|
| 151 | + register_taxonomy( 'exercise-type', array( 'exercise' ), $args ); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Register the Exercise taxonomy. |
|
| 156 | + * |
|
| 157 | + * @return void |
|
| 158 | + */ |
|
| 159 | + public function equipment_taxonomy_setup() { |
|
| 160 | + $labels = array( |
|
| 161 | + 'name' => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 162 | + 'singular_name' => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 163 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 164 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 165 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 166 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 167 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 168 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 169 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 170 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 171 | + 'menu_name' => esc_html__( 'Equipment', 'lsx-health-plan' ), |
|
| 172 | + ); |
|
| 173 | + |
|
| 174 | + $args = array( |
|
| 175 | + 'hierarchical' => true, |
|
| 176 | + 'labels' => $labels, |
|
| 177 | + 'show_ui' => true, |
|
| 178 | + 'show_admin_column' => true, |
|
| 179 | + 'query_var' => true, |
|
| 180 | + 'rewrite' => array( |
|
| 181 | + 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ), |
|
| 182 | + ), |
|
| 183 | + 'show_in_rest' => true, |
|
| 184 | + ); |
|
| 185 | + |
|
| 186 | + register_taxonomy( 'equipment', array( 'exercise' ), $args ); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Register the Muscle Group taxonomy. |
|
| 191 | + * |
|
| 192 | + * @return void |
|
| 193 | + */ |
|
| 194 | + public function muscle_group_taxonomy_setup() { |
|
| 195 | + $labels = array( |
|
| 196 | + 'name' => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 197 | + 'singular_name' => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 198 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 199 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 200 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 201 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 202 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 203 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 204 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 205 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 206 | + 'menu_name' => esc_html__( 'Muscle Groups', 'lsx-health-plan' ), |
|
| 207 | + ); |
|
| 208 | + |
|
| 209 | + $args = array( |
|
| 210 | + 'hierarchical' => true, |
|
| 211 | + 'labels' => $labels, |
|
| 212 | + 'show_ui' => true, |
|
| 213 | + 'show_admin_column' => true, |
|
| 214 | + 'query_var' => true, |
|
| 215 | + 'rewrite' => array( |
|
| 216 | + 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_muscle_group', 'muscle-group' ), |
|
| 217 | + ), |
|
| 218 | + 'show_in_rest' => true, |
|
| 219 | + ); |
|
| 220 | + |
|
| 221 | + register_taxonomy( 'muscle-group', array( 'exercise' ), $args ); |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * Registers the Recipes under the Meals Post type menu. |
|
| 226 | + * |
|
| 227 | + * @return void |
|
| 228 | + */ |
|
| 229 | + public function register_menus() { |
|
| 230 | + add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' ); |
|
| 231 | + add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' ); |
|
| 232 | + add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' ); |
|
| 233 | + add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' ); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * Adds the post type to the different arrays. |
|
| 238 | + * |
|
| 239 | + * @param array $post_types |
|
| 240 | + * @return array |
|
| 241 | + */ |
|
| 242 | + public function enable_post_type( $post_types = array() ) { |
|
| 243 | + $post_types[] = $this->slug; |
|
| 244 | + return $post_types; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * Enables the Bi Directional relationships |
|
| 249 | + * |
|
| 250 | + * @param array $connections |
|
| 251 | + * @return void |
|
| 252 | + */ |
|
| 253 | + public function enable_connections( $connections = array() ) { |
|
| 254 | + $connections['exercise']['connected_workouts'] = 'connected_exercises'; |
|
| 255 | + $connections['workout']['connected_exercises'] = 'connected_workouts'; |
|
| 256 | + return $connections; |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * Define the metabox and field configurations. |
|
| 261 | + */ |
|
| 262 | + public function gallery_metabox() { |
|
| 263 | + $cmb = new_cmb2_box( |
|
| 264 | + array( |
|
| 265 | + 'id' => $this->slug . '_gallery_details_metabox', |
|
| 266 | + 'title' => __( 'Exercise Gallery', 'lsx-health-plan' ), |
|
| 267 | + 'object_types' => array( $this->slug ), |
|
| 268 | + 'context' => 'normal', |
|
| 269 | + 'priority' => 'low', |
|
| 270 | + 'show_names' => true, |
|
| 271 | + ) |
|
| 272 | + ); |
|
| 273 | + |
|
| 274 | + $cmb->add_field( |
|
| 275 | + array( |
|
| 276 | + 'name' => __( 'Layout', 'lsx-health-plan' ), |
|
| 277 | + 'id' => $this->slug . '_gallery_layout', |
|
| 278 | + 'type' => 'radio', |
|
| 279 | + 'options' => array( |
|
| 280 | + 'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
| 281 | + 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 282 | + ), |
|
| 283 | + 'default' => 'grid', |
|
| 284 | + ) |
|
| 285 | + ); |
|
| 286 | + |
|
| 287 | + $cmb->add_field( |
|
| 288 | + array( |
|
| 289 | + 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 290 | + 'id' => $this->slug . '_gallery_columns', |
|
| 291 | + 'type' => 'text', |
|
| 292 | + 'default' => '1', |
|
| 293 | + ) |
|
| 294 | + ); |
|
| 295 | + |
|
| 296 | + // Repeatable group. |
|
| 297 | + $gallery_group = $cmb->add_field( |
|
| 298 | + array( |
|
| 299 | + 'id' => $this->slug . '_gallery', |
|
| 300 | + 'type' => 'group', |
|
| 301 | + 'options' => array( |
|
| 302 | + 'group_title' => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
| 303 | + 'add_button' => __( 'Add Item', 'lsx-health-plan' ), |
|
| 304 | + 'remove_button' => __( 'Remove Item', 'lsx-health-plan' ), |
|
| 305 | + 'sortable' => true, |
|
| 306 | + ), |
|
| 307 | + 'classes' => 'lsx-admin-row', |
|
| 308 | + ) |
|
| 309 | + ); |
|
| 310 | + |
|
| 311 | + // Title. |
|
| 312 | + $cmb->add_group_field( |
|
| 313 | + $gallery_group, |
|
| 314 | + array( |
|
| 315 | + 'name' => __( 'Image', 'lsx-health-plan' ), |
|
| 316 | + 'id' => $this->slug . '_gallery_image', |
|
| 317 | + 'type' => 'file', |
|
| 318 | + 'text' => array( |
|
| 319 | + 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
| 320 | + ), |
|
| 321 | + 'desc' => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ), |
|
| 322 | + 'query_args' => array( |
|
| 323 | + 'type' => array( |
|
| 324 | + 'image/gif', |
|
| 325 | + 'image/jpeg', |
|
| 326 | + 'image/png', |
|
| 327 | + ), |
|
| 328 | + ), |
|
| 329 | + 'preview_size' => 'lsx-thumbnail-wide', |
|
| 330 | + ) |
|
| 331 | + ); |
|
| 332 | + |
|
| 333 | + // Title. |
|
| 334 | + $cmb->add_group_field( |
|
| 335 | + $gallery_group, |
|
| 336 | + array( |
|
| 337 | + 'name' => __( 'oEmbed', 'lsx-health-plan' ), |
|
| 338 | + 'id' => $this->slug . '_gallery_embed', |
|
| 339 | + 'type' => 'text', |
|
| 340 | + 'desc' => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ), |
|
| 341 | + ) |
|
| 342 | + ); |
|
| 343 | + |
|
| 344 | + $cmb->add_group_field( |
|
| 345 | + $gallery_group, |
|
| 346 | + array( |
|
| 347 | + 'name' => __( 'External Media', 'lsx-health-plan' ), |
|
| 348 | + 'id' => $this->slug . '_gallery_external', |
|
| 349 | + 'type' => 'textarea_code', |
|
| 350 | + 'desc' => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: <iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen></iframe>', 'lsx-health-plan' ), |
|
| 351 | + ) |
|
| 352 | + ); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + /** |
|
| 356 | + * Registers the general settings for the exercise. |
|
| 357 | + * |
|
| 358 | + * @return void |
|
| 359 | + */ |
|
| 360 | + public function exercise_details() { |
|
| 361 | + $cmb = new_cmb2_box( |
|
| 362 | + array( |
|
| 363 | + 'id' => $this->slug . '_general_details_metabox', |
|
| 364 | + 'title' => __( 'Details', 'lsx-health-plan' ), |
|
| 365 | + 'object_types' => array( $this->slug ), |
|
| 366 | + 'context' => 'normal', |
|
| 367 | + 'priority' => 'high', |
|
| 368 | + 'show_names' => true, |
|
| 369 | + ) |
|
| 370 | + ); |
|
| 371 | + |
|
| 372 | + $cmb->add_field( |
|
| 373 | + array( |
|
| 374 | + 'name' => __( 'Side', 'lsx-health-plan' ), |
|
| 375 | + 'id' => $this->slug . '_side', |
|
| 376 | + 'type' => 'select', |
|
| 377 | + 'options' => array( |
|
| 378 | + '' => __( 'Select', 'lsx-health-plan' ), |
|
| 379 | + 'left' => __( 'Left', 'lsx-health-plan' ), |
|
| 380 | + 'right' => __( 'Right', 'lsx-health-plan' ), |
|
| 381 | + ), |
|
| 382 | + 'desc' => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ), |
|
| 383 | + ) |
|
| 384 | + ); |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * Holds the array for the single exercise breadcrumbs. |
|
| 389 | + * |
|
| 390 | + * @var array $crumbs |
|
| 391 | + * @return array |
|
| 392 | + */ |
|
| 393 | + public function exercise_breadcrumb_filter( $crumbs ) { |
|
| 394 | + $exercise = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' ); |
|
| 395 | + $exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' ); |
|
| 396 | + $url = get_post_type_archive_link( $exercise ); |
|
| 397 | + |
|
| 398 | + if ( is_singular( 'exercise' ) ) { |
|
| 399 | + $exercise_name = get_the_title(); |
|
| 400 | + $term_obj_list = get_the_terms( get_the_ID(), 'exercise-type' ); |
|
| 401 | + $exercise_type = $term_obj_list[0]->name; |
|
| 402 | + $exercise_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
| 403 | 403 | |
| 404 | - $crumbs[1] = array( |
|
| 405 | - 0 => $exercises, |
|
| 406 | - 1 => $url, |
|
| 407 | - ); |
|
| 408 | - $crumbs[2] = array( |
|
| 409 | - 0 => $exercise_type, |
|
| 410 | - 1 => $exercise_type_url, |
|
| 411 | - ); |
|
| 412 | - $crumbs[3] = array( |
|
| 413 | - 0 => $exercise_name, |
|
| 414 | - ); |
|
| 415 | - } |
|
| 416 | - if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) { |
|
| 417 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
| 418 | - |
|
| 419 | - $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
| 420 | - |
|
| 421 | - $crumbs[1] = array( |
|
| 422 | - 0 => $exercises, |
|
| 423 | - 1 => $url, |
|
| 424 | - ); |
|
| 425 | - $crumbs[2] = array( |
|
| 426 | - 0 => $single_term_title, |
|
| 427 | - ); |
|
| 428 | - } |
|
| 429 | - return $crumbs; |
|
| 430 | - } |
|
| 404 | + $crumbs[1] = array( |
|
| 405 | + 0 => $exercises, |
|
| 406 | + 1 => $url, |
|
| 407 | + ); |
|
| 408 | + $crumbs[2] = array( |
|
| 409 | + 0 => $exercise_type, |
|
| 410 | + 1 => $exercise_type_url, |
|
| 411 | + ); |
|
| 412 | + $crumbs[3] = array( |
|
| 413 | + 0 => $exercise_name, |
|
| 414 | + ); |
|
| 415 | + } |
|
| 416 | + if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) { |
|
| 417 | + $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
| 418 | + |
|
| 419 | + $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
| 420 | + |
|
| 421 | + $crumbs[1] = array( |
|
| 422 | + 0 => $exercises, |
|
| 423 | + 1 => $url, |
|
| 424 | + ); |
|
| 425 | + $crumbs[2] = array( |
|
| 426 | + 0 => $single_term_title, |
|
| 427 | + ); |
|
| 428 | + } |
|
| 429 | + return $crumbs; |
|
| 430 | + } |
|
| 431 | 431 | } |