@@ -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' ) ) |
|
97 | - || is_tax( array( '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' ) ) |
|
97 | + || is_tax( array( '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 | } |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * Constructor |
22 | 22 | */ |
23 | 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 ); |
|
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 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function get_instance() { |
38 | 38 | // If the single instance hasn't been set, set it now. |
39 | - if ( null === self::$instance ) { |
|
39 | + if (null === self::$instance) { |
|
40 | 40 | self::$instance = new self(); |
41 | 41 | } |
42 | 42 | return self::$instance; |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * Archive template. |
47 | 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 ) ) { |
|
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 | 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' ) ) { |
|
52 | + if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) { |
|
53 | 53 | $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
54 | 54 | } |
55 | 55 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Single template. |
61 | 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 ) ) { |
|
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 | 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' ) ) { |
|
66 | + if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) { |
|
67 | 67 | $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
68 | 68 | } |
69 | 69 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | * @param $template string |
77 | 77 | * @return string |
78 | 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' ) ) { |
|
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 | 84 | $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
85 | 85 | } |
86 | 86 | } |
@@ -92,21 +92,21 @@ discard block |
||
92 | 92 | * restriction functionality elsewhere. |
93 | 93 | */ |
94 | 94 | public function redirect_restrictions() { |
95 | - if ( function_exists( 'WC' ) && ! is_user_logged_in() ) { |
|
96 | - if ( is_post_type_archive( array( 'recipe', 'exercise' ) ) |
|
97 | - || is_tax( array( 'recipe-type', 'recipe-cuisine', 'exercise-type', 'equipment', 'muscle-group' ) ) |
|
98 | - || is_single( 'recipe', 'exercise' ) ) { |
|
95 | + if (function_exists('WC') && ! is_user_logged_in()) { |
|
96 | + if (is_post_type_archive(array('recipe', 'exercise')) |
|
97 | + || is_tax(array('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' ) ) { |
|
100 | + $redirect = \lsx_health_plan\functions\get_option('my_plan_slug', '/'); |
|
101 | + if (function_exists('wc_memberships')) { |
|
102 | 102 | $restriction_mode = wc_memberships()->get_restrictions_instance()->get_restriction_mode(); |
103 | - if ( 'redirect' === $restriction_mode ) { |
|
103 | + if ('redirect' === $restriction_mode) { |
|
104 | 104 | $page_id = wc_memberships()->get_restrictions_instance()->get_restricted_content_redirect_page_id(); |
105 | - $redirect = get_permalink( $page_id ); |
|
105 | + $redirect = get_permalink($page_id); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - wp_redirect( $redirect ); |
|
109 | + wp_redirect($redirect); |
|
110 | 110 | exit; |
111 | 111 | } |
112 | 112 | } |
@@ -8,146 +8,146 @@ |
||
8 | 8 | */ |
9 | 9 | class Plans { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Plans() |
|
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\integrations\woocommerce\Plans() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds the current screen var if it is active. |
|
22 | - * |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - public $screen = ''; |
|
20 | + /** |
|
21 | + * Holds the current screen var if it is active. |
|
22 | + * |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + public $screen = ''; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Holds the current array of product IDS. |
|
29 | - * |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - public $product_ids = array(); |
|
27 | + /** |
|
28 | + * Holds the current array of product IDS. |
|
29 | + * |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + public $product_ids = array(); |
|
33 | 33 | |
34 | - /** |
|
35 | - * Holds the curret parent ID. |
|
36 | - * |
|
37 | - * @var int |
|
38 | - */ |
|
39 | - public $parent_id = 0; |
|
34 | + /** |
|
35 | + * Holds the curret parent ID. |
|
36 | + * |
|
37 | + * @var int |
|
38 | + */ |
|
39 | + public $parent_id = 0; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor |
|
43 | - */ |
|
44 | - public function __construct() { |
|
45 | - // Remove the default restrictions, as we will add our own. |
|
46 | - add_action( 'wp', array( $this, 'set_screen' ), 1 ); |
|
47 | - add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 ); |
|
48 | - add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 ); |
|
41 | + /** |
|
42 | + * Constructor |
|
43 | + */ |
|
44 | + public function __construct() { |
|
45 | + // Remove the default restrictions, as we will add our own. |
|
46 | + add_action( 'wp', array( $this, 'set_screen' ), 1 ); |
|
47 | + add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 ); |
|
48 | + add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 ); |
|
49 | 49 | |
50 | - // Initiate the WP Head functions. |
|
51 | - add_action( 'wp_head', array( $this, 'set_screen' ) ); |
|
52 | - add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' ); |
|
50 | + // Initiate the WP Head functions. |
|
51 | + add_action( 'wp_head', array( $this, 'set_screen' ) ); |
|
52 | + add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' ); |
|
53 | 53 | |
54 | - // Plan Archive Actions. |
|
55 | - add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) ); |
|
56 | - } |
|
54 | + // Plan Archive Actions. |
|
55 | + add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) ); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Return an instance of this class. |
|
60 | - * |
|
61 | - * @since 1.0.0 |
|
62 | - * |
|
63 | - * @return object \lsx_health_plan\classes\integrations\woocommerce\Plans() A single instance of this class. |
|
64 | - */ |
|
65 | - public static function get_instance() { |
|
66 | - // If the single instance hasn't been set, set it now. |
|
67 | - if ( null === self::$instance ) { |
|
68 | - self::$instance = new self(); |
|
69 | - } |
|
70 | - return self::$instance; |
|
71 | - } |
|
58 | + /** |
|
59 | + * Return an instance of this class. |
|
60 | + * |
|
61 | + * @since 1.0.0 |
|
62 | + * |
|
63 | + * @return object \lsx_health_plan\classes\integrations\woocommerce\Plans() A single instance of this class. |
|
64 | + */ |
|
65 | + public static function get_instance() { |
|
66 | + // If the single instance hasn't been set, set it now. |
|
67 | + if ( null === self::$instance ) { |
|
68 | + self::$instance = new self(); |
|
69 | + } |
|
70 | + return self::$instance; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Define the product metabox on the plan post type |
|
75 | - */ |
|
76 | - public function set_screen() { |
|
77 | - if ( is_singular( array( 'plan' ) ) ) { |
|
78 | - $section = get_query_var( 'section' ); |
|
79 | - if ( ! empty( $section ) ) { |
|
80 | - $this->screen = 'child_plan'; |
|
81 | - } else { |
|
82 | - $this->screen = 'parent_plan'; |
|
83 | - } |
|
84 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
85 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
86 | - $this->product_ids = $product_ids; |
|
87 | - } |
|
88 | - } |
|
89 | - if ( is_singular( array( 'workout', 'meal' ) ) ) { |
|
90 | - $parent_id = wp_get_post_parent_id( get_the_ID() ); |
|
91 | - if ( 0 === $parent_id || false === $parent_id ) { |
|
92 | - $this->screen = 'parent_plan'; |
|
93 | - } else { |
|
94 | - $this->screen = 'child_plan'; |
|
95 | - } |
|
96 | - } |
|
97 | - if ( is_post_type_archive( array( 'plan', 'workout', 'meal' ) ) || is_tax( array( 'plan-type', 'workout-type', 'meal-type' ) ) ) { |
|
98 | - $this->screen = 'plan_archive'; |
|
99 | - } |
|
100 | - } |
|
73 | + /** |
|
74 | + * Define the product metabox on the plan post type |
|
75 | + */ |
|
76 | + public function set_screen() { |
|
77 | + if ( is_singular( array( 'plan' ) ) ) { |
|
78 | + $section = get_query_var( 'section' ); |
|
79 | + if ( ! empty( $section ) ) { |
|
80 | + $this->screen = 'child_plan'; |
|
81 | + } else { |
|
82 | + $this->screen = 'parent_plan'; |
|
83 | + } |
|
84 | + $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
85 | + if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
86 | + $this->product_ids = $product_ids; |
|
87 | + } |
|
88 | + } |
|
89 | + if ( is_singular( array( 'workout', 'meal' ) ) ) { |
|
90 | + $parent_id = wp_get_post_parent_id( get_the_ID() ); |
|
91 | + if ( 0 === $parent_id || false === $parent_id ) { |
|
92 | + $this->screen = 'parent_plan'; |
|
93 | + } else { |
|
94 | + $this->screen = 'child_plan'; |
|
95 | + } |
|
96 | + } |
|
97 | + if ( is_post_type_archive( array( 'plan', 'workout', 'meal' ) ) || is_tax( array( 'plan-type', 'workout-type', 'meal-type' ) ) ) { |
|
98 | + $this->screen = 'plan_archive'; |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Sets the post type archive product ids. |
|
104 | - * |
|
105 | - * @return void |
|
106 | - */ |
|
107 | - public function set_product_ids() { |
|
108 | - $this->product_ids = false; |
|
109 | - if ( 'plan' === get_post_type() ) { |
|
110 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
111 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
112 | - $this->product_ids = $product_ids; |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
102 | + /** |
|
103 | + * Sets the post type archive product ids. |
|
104 | + * |
|
105 | + * @return void |
|
106 | + */ |
|
107 | + public function set_product_ids() { |
|
108 | + $this->product_ids = false; |
|
109 | + if ( 'plan' === get_post_type() ) { |
|
110 | + $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
111 | + if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
112 | + $this->product_ids = $product_ids; |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
119 | - * restriction functionality elsewhere. |
|
120 | - */ |
|
121 | - public function disable_parent_plan_restrictions() { |
|
122 | - if ( '' === $this->screen || ! function_exists( 'wc_memberships' ) ) { |
|
123 | - return; |
|
124 | - } |
|
117 | + /** |
|
118 | + * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
119 | + * restriction functionality elsewhere. |
|
120 | + */ |
|
121 | + public function disable_parent_plan_restrictions() { |
|
122 | + if ( '' === $this->screen || ! function_exists( 'wc_memberships' ) ) { |
|
123 | + return; |
|
124 | + } |
|
125 | 125 | |
126 | - $restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(); |
|
127 | - remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) ); |
|
128 | - } |
|
126 | + $restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(); |
|
127 | + remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) ); |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
132 | - * restriction functionality elsewhere. |
|
133 | - */ |
|
134 | - public function child_plan_redirect_restrictions() { |
|
135 | - if ( ! function_exists( 'wc_memberships' ) || ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
136 | - return; |
|
137 | - } |
|
138 | - $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
139 | - if ( true === $restricted ) { |
|
140 | - wp_redirect( get_permalink( get_the_ID() ) ); |
|
141 | - exit; |
|
142 | - } |
|
143 | - } |
|
130 | + /** |
|
131 | + * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
132 | + * restriction functionality elsewhere. |
|
133 | + */ |
|
134 | + public function child_plan_redirect_restrictions() { |
|
135 | + if ( ! function_exists( 'wc_memberships' ) || ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
136 | + return; |
|
137 | + } |
|
138 | + $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
139 | + if ( true === $restricted ) { |
|
140 | + wp_redirect( get_permalink( get_the_ID() ) ); |
|
141 | + exit; |
|
142 | + } |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * Returns the ids of the attached products. |
|
147 | - * |
|
148 | - * @return array |
|
149 | - */ |
|
150 | - public function get_products() { |
|
151 | - return $this->product_ids; |
|
152 | - } |
|
145 | + /** |
|
146 | + * Returns the ids of the attached products. |
|
147 | + * |
|
148 | + * @return array |
|
149 | + */ |
|
150 | + public function get_products() { |
|
151 | + return $this->product_ids; |
|
152 | + } |
|
153 | 153 | } |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | // Remove the default restrictions, as we will add our own. |
46 | - add_action( 'wp', array( $this, 'set_screen' ), 1 ); |
|
47 | - add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 ); |
|
48 | - add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 ); |
|
46 | + add_action('wp', array($this, 'set_screen'), 1); |
|
47 | + add_action('wp', array($this, 'disable_parent_plan_restrictions'), 2); |
|
48 | + add_action('wp', array($this, 'child_plan_redirect_restrictions'), 2); |
|
49 | 49 | |
50 | 50 | // Initiate the WP Head functions. |
51 | - add_action( 'wp_head', array( $this, 'set_screen' ) ); |
|
52 | - add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' ); |
|
51 | + add_action('wp_head', array($this, 'set_screen')); |
|
52 | + add_action('lsx_content_top', 'lsx_hp_single_plan_products'); |
|
53 | 53 | |
54 | 54 | // Plan Archive Actions. |
55 | - add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) ); |
|
55 | + add_action('lsx_entry_before', array($this, 'set_product_ids')); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function get_instance() { |
66 | 66 | // If the single instance hasn't been set, set it now. |
67 | - if ( null === self::$instance ) { |
|
67 | + if (null === self::$instance) { |
|
68 | 68 | self::$instance = new self(); |
69 | 69 | } |
70 | 70 | return self::$instance; |
@@ -74,27 +74,27 @@ discard block |
||
74 | 74 | * Define the product metabox on the plan post type |
75 | 75 | */ |
76 | 76 | public function set_screen() { |
77 | - if ( is_singular( array( 'plan' ) ) ) { |
|
78 | - $section = get_query_var( 'section' ); |
|
79 | - if ( ! empty( $section ) ) { |
|
77 | + if (is_singular(array('plan'))) { |
|
78 | + $section = get_query_var('section'); |
|
79 | + if ( ! empty($section)) { |
|
80 | 80 | $this->screen = 'child_plan'; |
81 | 81 | } else { |
82 | 82 | $this->screen = 'parent_plan'; |
83 | 83 | } |
84 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
85 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
84 | + $product_ids = get_post_meta(get_the_ID(), 'plan_product', true); |
|
85 | + if (false !== $product_ids && ! empty($product_ids)) { |
|
86 | 86 | $this->product_ids = $product_ids; |
87 | 87 | } |
88 | 88 | } |
89 | - if ( is_singular( array( 'workout', 'meal' ) ) ) { |
|
90 | - $parent_id = wp_get_post_parent_id( get_the_ID() ); |
|
91 | - if ( 0 === $parent_id || false === $parent_id ) { |
|
89 | + if (is_singular(array('workout', 'meal'))) { |
|
90 | + $parent_id = wp_get_post_parent_id(get_the_ID()); |
|
91 | + if (0 === $parent_id || false === $parent_id) { |
|
92 | 92 | $this->screen = 'parent_plan'; |
93 | 93 | } else { |
94 | 94 | $this->screen = 'child_plan'; |
95 | 95 | } |
96 | 96 | } |
97 | - if ( is_post_type_archive( array( 'plan', 'workout', 'meal' ) ) || is_tax( array( 'plan-type', 'workout-type', 'meal-type' ) ) ) { |
|
97 | + if (is_post_type_archive(array('plan', 'workout', 'meal')) || is_tax(array('plan-type', 'workout-type', 'meal-type'))) { |
|
98 | 98 | $this->screen = 'plan_archive'; |
99 | 99 | } |
100 | 100 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function set_product_ids() { |
108 | 108 | $this->product_ids = false; |
109 | - if ( 'plan' === get_post_type() ) { |
|
110 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
111 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
109 | + if ('plan' === get_post_type()) { |
|
110 | + $product_ids = get_post_meta(get_the_ID(), 'plan_product', true); |
|
111 | + if (false !== $product_ids && ! empty($product_ids)) { |
|
112 | 112 | $this->product_ids = $product_ids; |
113 | 113 | } |
114 | 114 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | * restriction functionality elsewhere. |
120 | 120 | */ |
121 | 121 | public function disable_parent_plan_restrictions() { |
122 | - if ( '' === $this->screen || ! function_exists( 'wc_memberships' ) ) { |
|
122 | + if ('' === $this->screen || ! function_exists('wc_memberships')) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(); |
127 | - remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) ); |
|
127 | + remove_action('wp', array($restrictions, 'handle_restriction_modes')); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | * restriction functionality elsewhere. |
133 | 133 | */ |
134 | 134 | public function child_plan_redirect_restrictions() { |
135 | - if ( ! function_exists( 'wc_memberships' ) || ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
135 | + if ( ! function_exists('wc_memberships') || ! is_singular('plan') || 'child_plan' !== $this->screen || ! function_exists('wc_memberships_is_post_content_restricted')) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | - $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
139 | - if ( true === $restricted ) { |
|
140 | - wp_redirect( get_permalink( get_the_ID() ) ); |
|
138 | + $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
139 | + if (true === $restricted) { |
|
140 | + wp_redirect(get_permalink(get_the_ID())); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -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-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 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
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 ) ) { |
|
23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper workout-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -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 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
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 ) ) { |
|
23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || current_user_can('wc_memberships_view_restricted_post_content', $post_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper exercise-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -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 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
12 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
13 | 13 | |
14 | 14 | <?php lsx_content_before(); ?> |
15 | 15 | |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | <div class="post-wrapper archive-plan"> |
21 | 21 | <div class="row"> |
22 | - <?php if ( have_posts() ) : ?> |
|
22 | + <?php if (have_posts()) : ?> |
|
23 | 23 | <?php |
24 | - while ( have_posts() ) : |
|
24 | + while (have_posts()) : |
|
25 | 25 | the_post(); |
26 | 26 | ?> |
27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | <?php else : ?> |
33 | 33 | |
34 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
34 | + <?php get_template_part('partials/content', 'none'); ?> |
|
35 | 35 | |
36 | 36 | <?php endif; ?> |
37 | 37 | </div> |
@@ -33,9 +33,12 @@ |
||
33 | 33 | |
34 | 34 | <?php endwhile; ?> |
35 | 35 | |
36 | - <?php else : ?> |
|
36 | + <?php else { |
|
37 | + : ?> |
|
37 | 38 | |
38 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
39 | + <?php get_template_part( 'partials/content', 'none' ); |
|
40 | +} |
|
41 | +?> |
|
39 | 42 | |
40 | 43 | <?php endif; ?> |
41 | 44 | </div> |
@@ -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 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
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 ) ) { |
|
23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper workout-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -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 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
12 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
13 | 13 | |
14 | 14 | <?php lsx_content_before(); ?> |
15 | 15 | |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | <div class="post-wrapper archive-plan"> |
21 | 21 | <div class="row"> |
22 | - <?php if ( have_posts() ) : ?> |
|
22 | + <?php if (have_posts()) : ?> |
|
23 | 23 | <?php |
24 | - while ( have_posts() ) : |
|
24 | + while (have_posts()) : |
|
25 | 25 | the_post(); |
26 | 26 | ?> |
27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | <?php else : ?> |
33 | 33 | |
34 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
34 | + <?php get_template_part('partials/content', 'none'); ?> |
|
35 | 35 | |
36 | 36 | <?php endif; ?> |
37 | 37 | </div> |
@@ -33,9 +33,12 @@ |
||
33 | 33 | |
34 | 34 | <?php endwhile; ?> |
35 | 35 | |
36 | - <?php else : ?> |
|
36 | + <?php else { |
|
37 | + : ?> |
|
37 | 38 | |
38 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
39 | + <?php get_template_part( 'partials/content', 'none' ); |
|
40 | +} |
|
41 | +?> |
|
39 | 42 | |
40 | 43 | <?php endif; ?> |
41 | 44 | </div> |
@@ -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 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
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 ) ) { |
|
23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || current_user_can('wc_memberships_view_restricted_post_content', $post_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper exercise-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -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 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
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 ) ) { |
|
23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper exercise-archive-plan archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |