@@ -18,51 +18,51 @@ discard block |
||
| 18 | 18 | $linked_product = false; |
| 19 | 19 | $restricted = ''; |
| 20 | 20 | if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
| 21 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 22 | - $linked_product = wc_get_product( $products[0] ); |
|
| 23 | - $product = $linked_product; |
|
| 21 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 22 | + $linked_product = wc_get_product( $products[0] ); |
|
| 23 | + $product = $linked_product; |
|
| 24 | 24 | |
| 25 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
| 26 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 27 | - } |
|
| 25 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
| 26 | + $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 27 | + } |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Check for shortcode overrides. |
| 31 | 31 | if ( null !== $shortcode_args ) { |
| 32 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
| 33 | - $column_class = $shortcode_args['columns']; |
|
| 34 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 35 | - } |
|
| 36 | - if ( isset( $shortcode_args['link'] ) ) { |
|
| 37 | - $link_setting = $shortcode_args['link']; |
|
| 38 | - // Setup our link and content. |
|
| 39 | - switch ( $link_setting ) { |
|
| 40 | - case 'single': |
|
| 41 | - $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
| 42 | - $link_close = '</a>'; |
|
| 43 | - break; |
|
| 32 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
| 33 | + $column_class = $shortcode_args['columns']; |
|
| 34 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 35 | + } |
|
| 36 | + if ( isset( $shortcode_args['link'] ) ) { |
|
| 37 | + $link_setting = $shortcode_args['link']; |
|
| 38 | + // Setup our link and content. |
|
| 39 | + switch ( $link_setting ) { |
|
| 40 | + case 'single': |
|
| 41 | + $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
| 42 | + $link_close = '</a>'; |
|
| 43 | + break; |
|
| 44 | 44 | |
| 45 | - case 'modal': |
|
| 46 | - $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
|
| 47 | - $link_close = '</a>'; |
|
| 48 | - $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
| 49 | - $modal_args = array( |
|
| 50 | - 'modal_content' => $modal_content_setting, |
|
| 51 | - ); |
|
| 52 | - // We call the button to register the modal, but we do not output it. |
|
| 53 | - lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
| 54 | - break; |
|
| 45 | + case 'modal': |
|
| 46 | + $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
|
| 47 | + $link_close = '</a>'; |
|
| 48 | + $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
| 49 | + $modal_args = array( |
|
| 50 | + 'modal_content' => $modal_content_setting, |
|
| 51 | + ); |
|
| 52 | + // We call the button to register the modal, but we do not output it. |
|
| 53 | + lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
| 54 | + break; |
|
| 55 | 55 | |
| 56 | - case 'none': |
|
| 57 | - default: |
|
| 58 | - $link_html = ''; |
|
| 59 | - $link_close = ''; |
|
| 60 | - break; |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - if ( isset( $shortcode_args['description'] ) ) { |
|
| 64 | - $content_setting = $shortcode_args['description']; |
|
| 65 | - } |
|
| 56 | + case 'none': |
|
| 57 | + default: |
|
| 58 | + $link_html = ''; |
|
| 59 | + $link_close = ''; |
|
| 60 | + break; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + if ( isset( $shortcode_args['description'] ) ) { |
|
| 64 | + $content_setting = $shortcode_args['description']; |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
@@ -78,60 +78,60 @@ discard block |
||
| 78 | 78 | <?php } ?> |
| 79 | 79 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 80 | 80 | <?php |
| 81 | - $featured_image = get_the_post_thumbnail(); |
|
| 82 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 83 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 84 | - 'class' => 'aligncenter', |
|
| 85 | - ) ); |
|
| 86 | - } else { |
|
| 87 | - ?> |
|
| 81 | + $featured_image = get_the_post_thumbnail(); |
|
| 82 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 83 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 84 | + 'class' => 'aligncenter', |
|
| 85 | + ) ); |
|
| 86 | + } else { |
|
| 87 | + ?> |
|
| 88 | 88 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 89 | 89 | <?php |
| 90 | - } |
|
| 91 | - ?> |
|
| 90 | + } |
|
| 91 | + ?> |
|
| 92 | 92 | </a> |
| 93 | 93 | </div> |
| 94 | 94 | <div class="content-box plan-content-box white-bg"> |
| 95 | 95 | <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> |
| 96 | 96 | <?php |
| 97 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 98 | - ?> |
|
| 97 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 98 | + ?> |
|
| 99 | 99 | <?php |
| 100 | - if ( false !== $linked_product ) { |
|
| 101 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 102 | - } |
|
| 103 | - ?> |
|
| 100 | + if ( false !== $linked_product ) { |
|
| 101 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 102 | + } |
|
| 103 | + ?> |
|
| 104 | 104 | <div class="excerpt"> |
| 105 | 105 | <?php |
| 106 | - if ( ! has_excerpt() ) { |
|
| 107 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 108 | - $content = '<p>' . $content . '</p>'; |
|
| 109 | - } else { |
|
| 110 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 111 | - } |
|
| 112 | - echo wp_kses_post( $content ); |
|
| 113 | - ?> |
|
| 106 | + if ( ! has_excerpt() ) { |
|
| 107 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 108 | + $content = '<p>' . $content . '</p>'; |
|
| 109 | + } else { |
|
| 110 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 111 | + } |
|
| 112 | + echo wp_kses_post( $content ); |
|
| 113 | + ?> |
|
| 114 | 114 | </div> |
| 115 | 115 | |
| 116 | 116 | <?php |
| 117 | - $button_link = get_permalink(); |
|
| 118 | - $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
| 119 | - $button_class = ''; |
|
| 117 | + $button_link = get_permalink(); |
|
| 118 | + $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
| 119 | + $button_class = ''; |
|
| 120 | 120 | |
| 121 | - if ( true === $restricted ) { |
|
| 122 | - if ( 1 < count( $products ) ) { |
|
| 123 | - $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
| 124 | - } else { |
|
| 125 | - $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
|
| 126 | - $button_text = $linked_product->add_to_cart_text(); |
|
| 127 | - } |
|
| 128 | - ?> |
|
| 121 | + if ( true === $restricted ) { |
|
| 122 | + if ( 1 < count( $products ) ) { |
|
| 123 | + $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
| 124 | + } else { |
|
| 125 | + $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
|
| 126 | + $button_text = $linked_product->add_to_cart_text(); |
|
| 127 | + } |
|
| 128 | + ?> |
|
| 129 | 129 | <?php |
| 130 | - } elseif ( false === $restricted ) { |
|
| 131 | - $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
| 132 | - $button_class = 'btn-disabled'; |
|
| 133 | - } |
|
| 134 | - ?> |
|
| 130 | + } elseif ( false === $restricted ) { |
|
| 131 | + $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
| 132 | + $button_class = 'btn-disabled'; |
|
| 133 | + } |
|
| 134 | + ?> |
|
| 135 | 135 | <a class="btn <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_attr( $button_link ); ?>"><?php echo esc_attr( $button_text ); ?></a> |
| 136 | 136 | </div> |
| 137 | 137 | <?php lsx_entry_bottom(); ?> |