@@ -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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || 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-exercise.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 | |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | <div class="row"> |
| 22 | 22 | <?php if ( have_posts() ) : ?> |
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 25 | - the_post(); |
|
| 26 | - ?> |
|
| 24 | + while ( have_posts() ) : |
|
| 25 | + the_post(); |
|
| 26 | + ?> |
|
| 27 | 27 | |
| 28 | 28 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-recipe.php'; ?> |
| 29 | 29 | |
@@ -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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || 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-workout.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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || 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-exercise.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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || 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-exercise.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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 24 | - ?> |
|
| 23 | + if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || 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-exercise.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 | |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | <div class="row"> |
| 22 | 22 | <?php if ( have_posts() ) : ?> |
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 25 | - the_post(); |
|
| 26 | - ?> |
|
| 24 | + while ( have_posts() ) : |
|
| 25 | + the_post(); |
|
| 26 | + ?> |
|
| 27 | 27 | |
| 28 | 28 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-recipe.php'; ?> |
| 29 | 29 | |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | <div class="row"> |
| 22 | 22 | <?php if ( have_posts() ) : ?> |
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 25 | - the_post(); |
|
| 26 | - ?> |
|
| 24 | + while ( have_posts() ) : |
|
| 25 | + the_post(); |
|
| 26 | + ?> |
|
| 27 | 27 | |
| 28 | 28 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-recipe.php'; ?> |
| 29 | 29 | |
@@ -8,107 +8,107 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Template_Redirects { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Constructor |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 24 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 25 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 26 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
| 27 | - add_action( 'wp', array( $this, 'redirect_restrictions' ), 99 ); |
|
| 28 | - } |
|
| 20 | + /** |
|
| 21 | + * Constructor |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | + add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 25 | + add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 26 | + add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
| 27 | + add_action( 'wp', array( $this, 'redirect_restrictions' ), 99 ); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Return an instance of this class. |
|
| 32 | - * |
|
| 33 | - * @since 1.0.0 |
|
| 34 | - * |
|
| 35 | - * @return object \lsx_health_plan\classes\frontend\Template_Redirects() A single instance of this class. |
|
| 36 | - */ |
|
| 37 | - public static function get_instance() { |
|
| 38 | - // If the single instance hasn't been set, set it now. |
|
| 39 | - if ( null === self::$instance ) { |
|
| 40 | - self::$instance = new self(); |
|
| 41 | - } |
|
| 42 | - return self::$instance; |
|
| 43 | - } |
|
| 30 | + /** |
|
| 31 | + * Return an instance of this class. |
|
| 32 | + * |
|
| 33 | + * @since 1.0.0 |
|
| 34 | + * |
|
| 35 | + * @return object \lsx_health_plan\classes\frontend\Template_Redirects() A single instance of this class. |
|
| 36 | + */ |
|
| 37 | + public static function get_instance() { |
|
| 38 | + // If the single instance hasn't been set, set it now. |
|
| 39 | + if ( null === self::$instance ) { |
|
| 40 | + self::$instance = new self(); |
|
| 41 | + } |
|
| 42 | + return self::$instance; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Archive template. |
|
| 47 | - */ |
|
| 48 | - public function archive_template_include( $template ) { |
|
| 49 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
| 50 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
| 51 | - $post_type = get_post_type(); |
|
| 52 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
| 53 | - $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - return $template; |
|
| 57 | - } |
|
| 45 | + /** |
|
| 46 | + * Archive template. |
|
| 47 | + */ |
|
| 48 | + public function archive_template_include( $template ) { |
|
| 49 | + $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
| 50 | + if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
| 51 | + $post_type = get_post_type(); |
|
| 52 | + if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
| 53 | + $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + return $template; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Single template. |
|
| 61 | - */ |
|
| 62 | - public function single_template_include( $template ) { |
|
| 63 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
| 64 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
| 65 | - $post_type = get_post_type(); |
|
| 66 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
| 67 | - $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - return $template; |
|
| 71 | - } |
|
| 59 | + /** |
|
| 60 | + * Single template. |
|
| 61 | + */ |
|
| 62 | + public function single_template_include( $template ) { |
|
| 63 | + $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
| 64 | + if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
| 65 | + $post_type = get_post_type(); |
|
| 66 | + if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
| 67 | + $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + return $template; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Redirect WordPress to the taxonomy located in the plugin |
|
| 75 | - * |
|
| 76 | - * @param $template string |
|
| 77 | - * @return string |
|
| 78 | - */ |
|
| 79 | - public function taxonomy_template_include( $template ) { |
|
| 80 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
| 81 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
| 82 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
| 83 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
| 84 | - $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - return $template; |
|
| 88 | - } |
|
| 73 | + /** |
|
| 74 | + * Redirect WordPress to the taxonomy located in the plugin |
|
| 75 | + * |
|
| 76 | + * @param $template string |
|
| 77 | + * @return string |
|
| 78 | + */ |
|
| 79 | + public function taxonomy_template_include( $template ) { |
|
| 80 | + $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
| 81 | + if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
| 82 | + $current_taxonomy = get_query_var( 'taxonomy' ); |
|
| 83 | + if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
| 84 | + $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + return $template; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
| 92 | - * restriction functionality elsewhere. |
|
| 93 | - */ |
|
| 94 | - public function redirect_restrictions() { |
|
| 95 | - if ( function_exists( 'WC' ) && ! is_user_logged_in() ) { |
|
| 96 | - if ( is_post_type_archive( array( 'recipe', 'exercise', 'meal', 'workout' ) ) |
|
| 97 | - || is_tax( array( 'meal-type', 'workout-type', 'recipe-type', 'recipe-cuisine', 'exercise-type', 'equipment', 'muscle-group' ) ) |
|
| 98 | - || is_single( 'recipe', 'exercise' ) ) { |
|
| 90 | + /** |
|
| 91 | + * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
| 92 | + * restriction functionality elsewhere. |
|
| 93 | + */ |
|
| 94 | + public function redirect_restrictions() { |
|
| 95 | + if ( function_exists( 'WC' ) && ! is_user_logged_in() ) { |
|
| 96 | + if ( is_post_type_archive( array( 'recipe', 'exercise', 'meal', 'workout' ) ) |
|
| 97 | + || is_tax( array( 'meal-type', 'workout-type', 'recipe-type', 'recipe-cuisine', 'exercise-type', 'equipment', 'muscle-group' ) ) |
|
| 98 | + || is_single( 'recipe', 'exercise' ) ) { |
|
| 99 | 99 | |
| 100 | - $redirect = \lsx_health_plan\functions\get_option( 'my_plan_slug', '/' ); |
|
| 101 | - if ( function_exists( 'wc_memberships' ) ) { |
|
| 102 | - $restriction_mode = wc_memberships()->get_restrictions_instance()->get_restriction_mode(); |
|
| 103 | - if ( 'redirect' === $restriction_mode ) { |
|
| 104 | - $page_id = wc_memberships()->get_restrictions_instance()->get_restricted_content_redirect_page_id(); |
|
| 105 | - $redirect = get_permalink( $page_id ); |
|
| 106 | - } |
|
| 107 | - } |
|
| 100 | + $redirect = \lsx_health_plan\functions\get_option( 'my_plan_slug', '/' ); |
|
| 101 | + if ( function_exists( 'wc_memberships' ) ) { |
|
| 102 | + $restriction_mode = wc_memberships()->get_restrictions_instance()->get_restriction_mode(); |
|
| 103 | + if ( 'redirect' === $restriction_mode ) { |
|
| 104 | + $page_id = wc_memberships()->get_restrictions_instance()->get_restricted_content_redirect_page_id(); |
|
| 105 | + $redirect = get_permalink( $page_id ); |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - wp_redirect( $redirect ); |
|
| 110 | - exit; |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - } |
|
| 109 | + wp_redirect( $redirect ); |
|
| 110 | + exit; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | 114 | } |