@@ -17,15 +17,15 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <div class="entry-content"> |
| 19 | 19 | <?php |
| 20 | - //the_content(); |
|
| 20 | + //the_content(); |
|
| 21 | 21 | |
| 22 | - wp_link_pages( array( |
|
| 23 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
| 24 | - 'after' => '</div></div>', |
|
| 25 | - 'link_before' => '<span>', |
|
| 26 | - 'link_after' => '</span>', |
|
| 27 | - ) ); |
|
| 28 | - ?> |
|
| 22 | + wp_link_pages( array( |
|
| 23 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
| 24 | + 'after' => '</div></div>', |
|
| 25 | + 'link_before' => '<span>', |
|
| 26 | + 'link_after' => '</span>', |
|
| 27 | + ) ); |
|
| 28 | + ?> |
|
| 29 | 29 | <div class="single-plan-inner recipes-content"> |
| 30 | 30 | <div class="single-plan-section-title recipes-plan title-lined"> |
| 31 | 31 | <?php lsx_get_svg_icon( 'recipes.svg' ); ?> |
@@ -34,30 +34,30 @@ discard block |
||
| 34 | 34 | <div class="recipes"> |
| 35 | 35 | <div class="row eating-row"> |
| 36 | 36 | <?php |
| 37 | - $connected_recipes = get_post_meta( get_the_ID(), 'connected_recipes', true ); |
|
| 38 | - if ( empty( $connected_recipes ) ) { |
|
| 39 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
| 40 | - if ( isset( $options['connected_recipes'] ) && '' !== $options['connected_recipes'] && ! empty( $options['connected_recipes'] ) ) { |
|
| 41 | - $connected_recipes = $options['connected_recipes']; |
|
| 42 | - if ( ! array( $connected_recipes ) ) { |
|
| 43 | - $connected_recipes = array( $connected_recipes ); |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - $args = array( |
|
| 48 | - 'orderby' => 'date', |
|
| 49 | - 'order' => 'DESC', |
|
| 50 | - 'post_type' => 'recipe', |
|
| 51 | - 'post__in' => $connected_recipes, |
|
| 52 | - ); |
|
| 53 | - $recipes = new WP_Query( $args ); |
|
| 37 | + $connected_recipes = get_post_meta( get_the_ID(), 'connected_recipes', true ); |
|
| 38 | + if ( empty( $connected_recipes ) ) { |
|
| 39 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
| 40 | + if ( isset( $options['connected_recipes'] ) && '' !== $options['connected_recipes'] && ! empty( $options['connected_recipes'] ) ) { |
|
| 41 | + $connected_recipes = $options['connected_recipes']; |
|
| 42 | + if ( ! array( $connected_recipes ) ) { |
|
| 43 | + $connected_recipes = array( $connected_recipes ); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + $args = array( |
|
| 48 | + 'orderby' => 'date', |
|
| 49 | + 'order' => 'DESC', |
|
| 50 | + 'post_type' => 'recipe', |
|
| 51 | + 'post__in' => $connected_recipes, |
|
| 52 | + ); |
|
| 53 | + $recipes = new WP_Query( $args ); |
|
| 54 | 54 | |
| 55 | - if ( $recipes->have_posts() ) { |
|
| 56 | - while ( $recipes->have_posts() ) { |
|
| 57 | - $recipes->the_post(); |
|
| 58 | - $post_id = get_the_id(); |
|
| 55 | + if ( $recipes->have_posts() ) { |
|
| 56 | + while ( $recipes->have_posts() ) { |
|
| 57 | + $recipes->the_post(); |
|
| 58 | + $post_id = get_the_id(); |
|
| 59 | 59 | |
| 60 | - ?> |
|
| 60 | + ?> |
|
| 61 | 61 | <div class="col-md-4 recipe-column"> |
| 62 | 62 | <div class="content-box box-shadow"> |
| 63 | 63 | <h3 class="recipe-title title-lined"><?php the_title(); ?></h3> |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | </div> |
| 67 | 67 | </div> |
| 68 | 68 | <?php |
| 69 | - } |
|
| 70 | - } |
|
| 71 | - ?> |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + ?> |
|
| 72 | 72 | <?php wp_reset_postdata(); ?> |
| 73 | 73 | </div> |
| 74 | 74 | </div> |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | <?php if ( have_posts() ) : ?> |
| 24 | 24 | <?php |
| 25 | 25 | |
| 26 | - $count = 0; |
|
| 26 | + $count = 0; |
|
| 27 | 27 | |
| 28 | - while ( have_posts() ) : |
|
| 29 | - the_post(); |
|
| 30 | - ?> |
|
| 28 | + while ( have_posts() ) : |
|
| 29 | + the_post(); |
|
| 30 | + ?> |
|
| 31 | 31 | |
| 32 | 32 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; ?> |
| 33 | 33 | |
@@ -41,36 +41,36 @@ discard block |
||
| 41 | 41 | <div class="post-sharing-wrapper"> |
| 42 | 42 | |
| 43 | 43 | <?php |
| 44 | - if ( class_exists( 'LSX_Sharing' ) ) { |
|
| 45 | - lsx_content_sharing(); |
|
| 46 | - } else { |
|
| 47 | - if ( function_exists( 'sharing_display' ) ) { |
|
| 48 | - sharing_display( '', true ); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
| 52 | - $custom_likes = new Jetpack_Likes(); |
|
| 53 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - ?> |
|
| 44 | + if ( class_exists( 'LSX_Sharing' ) ) { |
|
| 45 | + lsx_content_sharing(); |
|
| 46 | + } else { |
|
| 47 | + if ( function_exists( 'sharing_display' ) ) { |
|
| 48 | + sharing_display( '', true ); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + if ( class_exists( 'Jetpack_Likes' ) ) { |
|
| 52 | + $custom_likes = new Jetpack_Likes(); |
|
| 53 | + echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + ?> |
|
| 57 | 57 | <?php endif ?> |
| 58 | 58 | </h2> |
| 59 | 59 | <?php echo wp_kses_post( lsx_hp_member_connected( $connected_members, 'recipe' ) ); ?> |
| 60 | 60 | <div class="row"> |
| 61 | 61 | <div class="col-md-6 recipe-image lsx-hp-shadow"> |
| 62 | 62 | <?php |
| 63 | - $featured_image = get_the_post_thumbnail(); |
|
| 64 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 65 | - the_post_thumbnail( 'large', array( |
|
| 66 | - 'class' => 'aligncenter', |
|
| 67 | - ) ); |
|
| 68 | - } else { |
|
| 69 | - ?> |
|
| 63 | + $featured_image = get_the_post_thumbnail(); |
|
| 64 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 65 | + the_post_thumbnail( 'large', array( |
|
| 66 | + 'class' => 'aligncenter', |
|
| 67 | + ) ); |
|
| 68 | + } else { |
|
| 69 | + ?> |
|
| 70 | 70 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 71 | 71 | <?php |
| 72 | - } |
|
| 73 | - ?> |
|
| 72 | + } |
|
| 73 | + ?> |
|
| 74 | 74 | <?php if ( ( ! empty( $prep_time ) ) || ( ! empty( $cooking_time ) ) || ( ! empty( $serves ) ) || ( ! empty( $portion ) ) || ( ! empty( $energy ) ) || ( ! empty( $protein ) ) || ( ! empty( $carbohydrates ) ) || ( ! empty( $fibre ) ) || ( ! empty( $fat ) ) ) { ?> |
| 75 | 75 | <div class="recipe-data"> |
| 76 | 76 | <?php lsx_health_plan_recipe_data(); ?> |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | <?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?> |
| 83 | 83 | <div class="back-plan-btn"> |
| 84 | 84 | <?php |
| 85 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 86 | - ?> |
|
| 85 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 86 | + ?> |
|
| 87 | 87 | <a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back To My Plan', 'lsx-health-plan' ); ?></a> |
| 88 | 88 | <?php |
| 89 | - } |
|
| 90 | - ?> |
|
| 89 | + } |
|
| 90 | + ?> |
|
| 91 | 91 | </div> |
| 92 | 92 | </div> |
| 93 | 93 | </div> |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | <?php |
| 102 | 102 | if ( ! empty( $connected_articles ) ) { |
| 103 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 103 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 104 | 104 | } |
| 105 | 105 | ?> |
| 106 | 106 | |
@@ -27,18 +27,18 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | <div class="entry-content"> |
| 29 | 29 | <?php |
| 30 | - wp_link_pages( |
|
| 31 | - array( |
|
| 32 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
| 33 | - 'after' => '</div></div>', |
|
| 34 | - 'link_before' => '<span>', |
|
| 35 | - 'link_after' => '</span>', |
|
| 36 | - ) |
|
| 37 | - ); |
|
| 38 | - ?> |
|
| 30 | + wp_link_pages( |
|
| 31 | + array( |
|
| 32 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
| 33 | + 'after' => '</div></div>', |
|
| 34 | + 'link_before' => '<span>', |
|
| 35 | + 'link_after' => '</span>', |
|
| 36 | + ) |
|
| 37 | + ); |
|
| 38 | + ?> |
|
| 39 | 39 | <div class="single-plan-inner workout-content"> |
| 40 | 40 | <?php |
| 41 | - if ( is_singular( 'workout' ) ) { ?> |
|
| 41 | + if ( is_singular( 'workout' ) ) { ?> |
|
| 42 | 42 | <div class="single-plan-section-title workout title-lined"> |
| 43 | 43 | <?php lsx_get_svg_icon( 'work.svg' ); ?> |
| 44 | 44 | <h2><?php the_title(); ?></h2> |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | </div> |
| 51 | 51 | <?php } ?> |
| 52 | 52 | <?php |
| 53 | - if ( lsx_health_plan_has_warmup() && ( ! is_singular( 'workout' ) ) ) { |
|
| 54 | - ?> |
|
| 53 | + if ( lsx_health_plan_has_warmup() && ( ! is_singular( 'workout' ) ) ) { |
|
| 54 | + ?> |
|
| 55 | 55 | <div class="workout-instructions"> |
| 56 | 56 | <div class="row"> |
| 57 | 57 | <div class="col-md-12"> |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | </div> |
| 64 | 64 | </div> |
| 65 | 65 | <?php |
| 66 | - } |
|
| 67 | - ?> |
|
| 66 | + } |
|
| 67 | + ?> |
|
| 68 | 68 | |
| 69 | 69 | <?php lsx_health_plan_workout_sets(); ?> |
| 70 | 70 | </div> |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | <?php |
| 78 | 78 | if ( ! empty( $connected_articles ) ) { |
| 79 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 79 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 80 | 80 | } |
| 81 | 81 | ?> |
| 82 | 82 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | <div class="entry-content"> |
| 25 | 25 | <div class="single-plan-inner meal-content"> |
| 26 | 26 | <?php |
| 27 | - if ( is_singular( 'meal' ) ) { ?> |
|
| 27 | + if ( is_singular( 'meal' ) ) { ?> |
|
| 28 | 28 | <div class="single-plan-section-title meal-plan title-lined"> |
| 29 | 29 | <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
| 30 | 30 | <h2><?php the_title(); ?></h2> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | <?php |
| 49 | 49 | if ( ! empty( $connected_articles ) ) { |
| 50 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 50 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 51 | 51 | } |
| 52 | 52 | ?> |
| 53 | 53 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | $plan_link = get_permalink(); |
| 9 | 9 | $current_section = get_query_var( 'section' ); |
| 10 | 10 | if ( '' !== $current_section ) { |
| 11 | - $plan_link = \lsx_health_plan\functions\plan\get_permalink( get_the_ID(), $current_section ); |
|
| 11 | + $plan_link = \lsx_health_plan\functions\plan\get_permalink( get_the_ID(), $current_section ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | ?> |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | <ul class="nav nav-pills"> |
| 17 | 17 | <li class="<?php lsx_health_plan_nav_class( '' ); ?>"><a class="overview-tab" href="<?php echo esc_attr( $plan_link ); ?>"><?php lsx_get_svg_icon( 'eye.svg' ); ?> <?php esc_html_e( 'Overview', 'lsx-health-plan' ); ?></a></li> |
| 18 | 18 | <?php |
| 19 | - if ( lsx_health_plan_has_warmup() ) { |
|
| 20 | - $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 21 | - if ( false === $warm_up ) { |
|
| 22 | - $warm_up = 'warm-up'; |
|
| 23 | - } |
|
| 24 | - ?> |
|
| 19 | + if ( lsx_health_plan_has_warmup() ) { |
|
| 20 | + $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 21 | + if ( false === $warm_up ) { |
|
| 22 | + $warm_up = 'warm-up'; |
|
| 23 | + } |
|
| 24 | + ?> |
|
| 25 | 25 | <li class="<?php lsx_health_plan_nav_class( 'warm-up' ); ?>"><a class="warm-up-tab" href="<?php echo esc_attr( $plan_link ); ?><?php echo esc_attr( $warm_up ); ?>/"><?php lsx_get_svg_icon( 'warm.svg' ); ?> <?php esc_html_e( 'Warm-up', 'lsx-health-plan' ); ?></a></li> |
| 26 | 26 | <?php |
| 27 | - } |
|
| 28 | - if ( lsx_health_plan_has_workout() ) { |
|
| 29 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 30 | - if ( false === $workout ) { |
|
| 31 | - $workout = 'workout'; |
|
| 32 | - } |
|
| 33 | - ?> |
|
| 27 | + } |
|
| 28 | + if ( lsx_health_plan_has_workout() ) { |
|
| 29 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 30 | + if ( false === $workout ) { |
|
| 31 | + $workout = 'workout'; |
|
| 32 | + } |
|
| 33 | + ?> |
|
| 34 | 34 | <li class="<?php lsx_health_plan_nav_class( 'workout' ); ?>"><a class="workout-tab" href="<?php echo esc_attr( $plan_link ); ?><?php echo esc_attr( $workout ); ?>/"><?php lsx_get_svg_icon( 'work.svg' ); ?> <?php esc_html_e( 'Workout', 'lsx-health-plan' ); ?></a></li> |
| 35 | 35 | <?php |
| 36 | - } |
|
| 37 | - if ( lsx_health_plan_has_meal() ) { |
|
| 38 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 39 | - if ( false === $meal ) { |
|
| 40 | - $meal = 'meal'; |
|
| 41 | - } |
|
| 42 | - ?> |
|
| 36 | + } |
|
| 37 | + if ( lsx_health_plan_has_meal() ) { |
|
| 38 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 39 | + if ( false === $meal ) { |
|
| 40 | + $meal = 'meal'; |
|
| 41 | + } |
|
| 42 | + ?> |
|
| 43 | 43 | <li class="<?php lsx_health_plan_nav_class( 'meal' ); ?>"><a class="meal-plan-tab" href="<?php echo esc_attr( $plan_link ); ?><?php echo esc_attr( $meal ); ?>/"><?php lsx_get_svg_icon( 'meal.svg' ); ?> <?php esc_html_e( 'Meal Plan', 'lsx-health-plan' ); ?></a></li> |
| 44 | 44 | <?php |
| 45 | - } |
|
| 46 | - ?> |
|
| 45 | + } |
|
| 46 | + ?> |
|
| 47 | 47 | </ul> |
| 48 | 48 | </div> |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | * @return boolean |
| 14 | 14 | */ |
| 15 | 15 | function plan_has_products() { |
| 16 | - $lsx_hp = lsx_health_plan(); |
|
| 17 | - $has_products = false; |
|
| 18 | - if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) { |
|
| 19 | - $has_products = true; |
|
| 20 | - } |
|
| 21 | - return $has_products; |
|
| 16 | + $lsx_hp = lsx_health_plan(); |
|
| 17 | + $has_products = false; |
|
| 18 | + if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) { |
|
| 19 | + $has_products = true; |
|
| 20 | + } |
|
| 21 | + return $has_products; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | * @return array |
| 28 | 28 | */ |
| 29 | 29 | function get_plan_products() { |
| 30 | - $lsx_hp = lsx_health_plan(); |
|
| 31 | - $has_products = array(); |
|
| 32 | - if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) { |
|
| 33 | - $has_products = $lsx_hp->integrations->woocommerce->plans->product_ids; |
|
| 34 | - } |
|
| 35 | - return $has_products; |
|
| 30 | + $lsx_hp = lsx_health_plan(); |
|
| 31 | + $has_products = array(); |
|
| 32 | + if ( ! empty( $lsx_hp->integrations->woocommerce->plans->product_ids ) ) { |
|
| 33 | + $has_products = $lsx_hp->integrations->woocommerce->plans->product_ids; |
|
| 34 | + } |
|
| 35 | + return $has_products; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -41,21 +41,21 @@ discard block |
||
| 41 | 41 | * @return array |
| 42 | 42 | */ |
| 43 | 43 | function get_membership_products() { |
| 44 | - $product_ids = array(); |
|
| 45 | - if ( function_exists( 'wc_memberships_get_user_memberships' ) ) { |
|
| 46 | - $user_memberships = wc_memberships_get_user_memberships(); |
|
| 44 | + $product_ids = array(); |
|
| 45 | + if ( function_exists( 'wc_memberships_get_user_memberships' ) ) { |
|
| 46 | + $user_memberships = wc_memberships_get_user_memberships(); |
|
| 47 | 47 | |
| 48 | - if ( ! empty( $user_memberships ) ) { |
|
| 49 | - foreach ( $user_memberships as $membership ) { |
|
| 50 | - $current_products = $membership->plan->get_product_ids(); |
|
| 51 | - if ( ! empty( $current_products ) ) { |
|
| 52 | - $product_ids = array_merge( $product_ids, $current_products ); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - if ( ! empty( $product_ids ) ) { |
|
| 58 | - $product_ids = array_unique( $product_ids ); |
|
| 59 | - } |
|
| 60 | - return $product_ids; |
|
| 48 | + if ( ! empty( $user_memberships ) ) { |
|
| 49 | + foreach ( $user_memberships as $membership ) { |
|
| 50 | + $current_products = $membership->plan->get_product_ids(); |
|
| 51 | + if ( ! empty( $current_products ) ) { |
|
| 52 | + $product_ids = array_merge( $product_ids, $current_products ); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + if ( ! empty( $product_ids ) ) { |
|
| 58 | + $product_ids = array_unique( $product_ids ); |
|
| 59 | + } |
|
| 60 | + return $product_ids; |
|
| 61 | 61 | } |
@@ -14,10 +14,10 @@ |
||
| 14 | 14 | * @return boolean |
| 15 | 15 | */ |
| 16 | 16 | function register_recipe_modal() { |
| 17 | - remove_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 ); |
|
| 18 | - ob_start(); |
|
| 19 | - include LSX_HEALTH_PLAN_PATH . '/templates/content-recipe.php'; |
|
| 20 | - $modal_body = ob_get_clean(); |
|
| 21 | - add_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 ); |
|
| 22 | - \lsx_health_plan\functions\register_modal( 'recipe-modal-' . get_the_ID(), '', $modal_body ); |
|
| 17 | + remove_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 ); |
|
| 18 | + ob_start(); |
|
| 19 | + include LSX_HEALTH_PLAN_PATH . '/templates/content-recipe.php'; |
|
| 20 | + $modal_body = ob_get_clean(); |
|
| 21 | + add_action( 'lsx_content_sharing', 'lsx_sharing_output', 20 ); |
|
| 22 | + \lsx_health_plan\functions\register_modal( 'recipe-modal-' . get_the_ID(), '', $modal_body ); |
|
| 23 | 23 | } |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * @return boolean |
| 15 | 15 | */ |
| 16 | 16 | function is_search_enabled() { |
| 17 | - $enabled = false; |
|
| 18 | - if ( function_exists( 'lsx_search' ) ) { |
|
| 19 | - $search_instance = \LSX_Search::get_instance(); |
|
| 20 | - if ( null !== $search_instance ) { |
|
| 21 | - $enabled = $search_instance->frontend->is_search_enabled(); |
|
| 22 | - } |
|
| 23 | - } |
|
| 24 | - return $enabled; |
|
| 17 | + $enabled = false; |
|
| 18 | + if ( function_exists( 'lsx_search' ) ) { |
|
| 19 | + $search_instance = \LSX_Search::get_instance(); |
|
| 20 | + if ( null !== $search_instance ) { |
|
| 21 | + $enabled = $search_instance->frontend->is_search_enabled(); |
|
| 22 | + } |
|
| 23 | + } |
|
| 24 | + return $enabled; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | * @return boolean |
| 32 | 32 | */ |
| 33 | 33 | function has_sections( $plan_id = 0 ) { |
| 34 | - $sections = false; |
|
| 35 | - if ( 0 === $plan_id ) { |
|
| 36 | - $plan_id = get_the_ID(); |
|
| 37 | - } |
|
| 34 | + $sections = false; |
|
| 35 | + if ( 0 === $plan_id ) { |
|
| 36 | + $plan_id = get_the_ID(); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - $section_array = get_post_meta( $plan_id, 'plan_sections', true ); |
|
| 39 | + $section_array = get_post_meta( $plan_id, 'plan_sections', true ); |
|
| 40 | 40 | |
| 41 | - if ( ! empty( $section_array ) ) { |
|
| 42 | - $sections = true; |
|
| 43 | - } |
|
| 44 | - return $sections; |
|
| 41 | + if ( ! empty( $section_array ) ) { |
|
| 42 | + $sections = true; |
|
| 43 | + } |
|
| 44 | + return $sections; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | * @return array |
| 53 | 53 | */ |
| 54 | 54 | function get_sections( $plan_id = 0, $group_sections = false ) { |
| 55 | - $sections = array(); |
|
| 56 | - if ( 0 === $plan_id ) { |
|
| 57 | - $plan_id = get_the_ID(); |
|
| 58 | - } |
|
| 59 | - $section_array = get_post_meta( $plan_id, 'plan_sections', true ); |
|
| 60 | - if ( ! empty( $section_array ) ) { |
|
| 61 | - $sections = $section_array; |
|
| 62 | - if ( false !== $group_sections ) { |
|
| 63 | - $sections = group_sections( $sections ); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - return $sections; |
|
| 55 | + $sections = array(); |
|
| 56 | + if ( 0 === $plan_id ) { |
|
| 57 | + $plan_id = get_the_ID(); |
|
| 58 | + } |
|
| 59 | + $section_array = get_post_meta( $plan_id, 'plan_sections', true ); |
|
| 60 | + if ( ! empty( $section_array ) ) { |
|
| 61 | + $sections = $section_array; |
|
| 62 | + if ( false !== $group_sections ) { |
|
| 63 | + $sections = group_sections( $sections ); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + return $sections; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -73,18 +73,18 @@ discard block |
||
| 73 | 73 | * @return array |
| 74 | 74 | */ |
| 75 | 75 | function get_section_info( $section_key = '' ) { |
| 76 | - $section_info = array(); |
|
| 76 | + $section_info = array(); |
|
| 77 | 77 | |
| 78 | - $sections = get_sections(); |
|
| 79 | - if ( ! empty( $sections ) ) { |
|
| 80 | - foreach ( $sections as $key => $values ) { |
|
| 81 | - $current_key = sanitize_title( $values['title'] ); |
|
| 82 | - if ( $current_key === $section_key ) { |
|
| 83 | - return $values; |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - return $section_info; |
|
| 78 | + $sections = get_sections(); |
|
| 79 | + if ( ! empty( $sections ) ) { |
|
| 80 | + foreach ( $sections as $key => $values ) { |
|
| 81 | + $current_key = sanitize_title( $values['title'] ); |
|
| 82 | + if ( $current_key === $section_key ) { |
|
| 83 | + return $values; |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + return $section_info; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -94,18 +94,18 @@ discard block |
||
| 94 | 94 | * @return array |
| 95 | 95 | */ |
| 96 | 96 | function group_sections( $sections = array() ) { |
| 97 | - $groups = array(); |
|
| 98 | - if ( ! empty( $sections ) ) { |
|
| 99 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 100 | - $group_key = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 101 | - if ( isset( $section_values['group'] ) && '' !== $section_values['group'] ) { |
|
| 102 | - $group_key = $section_values['group']; |
|
| 103 | - } |
|
| 104 | - $group_key = sanitize_title( $group_key ); |
|
| 105 | - $groups[ $group_key ][ $section_key ] = $section_values; |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - return $groups; |
|
| 97 | + $groups = array(); |
|
| 98 | + if ( ! empty( $sections ) ) { |
|
| 99 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 100 | + $group_key = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 101 | + if ( isset( $section_values['group'] ) && '' !== $section_values['group'] ) { |
|
| 102 | + $group_key = $section_values['group']; |
|
| 103 | + } |
|
| 104 | + $group_key = sanitize_title( $group_key ); |
|
| 105 | + $groups[ $group_key ][ $section_key ] = $section_values; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + return $groups; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | * @return array |
| 116 | 116 | */ |
| 117 | 117 | function get_group_title( $sections = array() ) { |
| 118 | - $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 119 | - if ( ! empty( $sections ) ) { |
|
| 120 | - $first_section = reset( $sections ); |
|
| 121 | - if ( isset( $first_section['group'] ) && '' !== $first_section['group'] ) { |
|
| 122 | - $group_title = $first_section['group']; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - return $group_title; |
|
| 118 | + $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 119 | + if ( ! empty( $sections ) ) { |
|
| 120 | + $first_section = reset( $sections ); |
|
| 121 | + if ( isset( $first_section['group'] ) && '' !== $first_section['group'] ) { |
|
| 122 | + $group_title = $first_section['group']; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + return $group_title; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * @return array |
| 134 | 134 | */ |
| 135 | 135 | function get_permalink( $plan_id = 0, $title = '' ) { |
| 136 | - if ( 0 === $plan_id ) { |
|
| 137 | - $plan_id = get_the_ID(); |
|
| 138 | - } |
|
| 139 | - $url = \get_permalink( $plan_id ); |
|
| 140 | - if ( '' !== $title ) { |
|
| 141 | - $url .= sanitize_title( $title ) . '/'; |
|
| 142 | - } |
|
| 143 | - return $url; |
|
| 136 | + if ( 0 === $plan_id ) { |
|
| 137 | + $plan_id = get_the_ID(); |
|
| 138 | + } |
|
| 139 | + $url = \get_permalink( $plan_id ); |
|
| 140 | + if ( '' !== $title ) { |
|
| 141 | + $url .= sanitize_title( $title ) . '/'; |
|
| 142 | + } |
|
| 143 | + return $url; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | * @return boolean |
| 150 | 150 | */ |
| 151 | 151 | function is_filters_disabled( $disabled = false ) { |
| 152 | - $is_disabled = \lsx_health_plan\functions\get_option( 'plan_filters_disabled', false ); |
|
| 153 | - if ( false !== $is_disabled ) { |
|
| 154 | - $disabled = true; |
|
| 155 | - } |
|
| 156 | - return $disabled; |
|
| 152 | + $is_disabled = \lsx_health_plan\functions\get_option( 'plan_filters_disabled', false ); |
|
| 153 | + if ( false !== $is_disabled ) { |
|
| 154 | + $disabled = true; |
|
| 155 | + } |
|
| 156 | + return $disabled; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -164,17 +164,17 @@ discard block |
||
| 164 | 164 | * @return string |
| 165 | 165 | */ |
| 166 | 166 | function generate_section_id( $section_key = '' ) { |
| 167 | - $key = get_the_ID(); |
|
| 168 | - if ( '' === $section_key ) { |
|
| 169 | - $section_key = get_query_var( 'section' ); |
|
| 170 | - } |
|
| 167 | + $key = get_the_ID(); |
|
| 168 | + if ( '' === $section_key ) { |
|
| 169 | + $section_key = get_query_var( 'section' ); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $section_key = sanitize_title( $section_key ); |
|
| 172 | + $section_key = sanitize_title( $section_key ); |
|
| 173 | 173 | |
| 174 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 175 | - $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 176 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 177 | - $key .= '_' . sanitize_key( $group_title ) . '_' . sanitize_key( $section_info['title'] ); |
|
| 178 | - } |
|
| 179 | - return $key; |
|
| 174 | + if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 175 | + $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 176 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 177 | + $key .= '_' . sanitize_key( $group_title ) . '_' . sanitize_key( $section_info['title'] ); |
|
| 178 | + } |
|
| 179 | + return $key; |
|
| 180 | 180 | } |