@@ -114,13 +114,19 @@ |
||
114 | 114 | <div class="entry-tabs hp-entry-tabs"> |
115 | 115 | <ul class="nav nav-tabs"> |
116 | 116 | <?php foreach ( $tabs as $i => $tab ) : ?> |
117 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
117 | + <li<?php if ( 0 === $i ) { |
|
118 | + echo ' class="active"'; |
|
119 | +} |
|
120 | +?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
118 | 121 | <?php endforeach; ?> |
119 | 122 | </ul> |
120 | 123 | |
121 | 124 | <div class="tab-content"> |
122 | 125 | <?php foreach ( $tabs as $i => $tab ) : ?> |
123 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
126 | + <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) { |
|
127 | + echo ' in active'; |
|
128 | +} |
|
129 | +?>"> |
|
124 | 130 | <?php echo do_shortcode( $tab['shortcode'] ); ?> |
125 | 131 | <?php echo wp_kses_post( $tab['content'] ); ?> |
126 | 132 | </div> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $tab_experience['content'] = get_post_meta( get_the_ID(), 'team_member_experience', true ); |
9 | 9 | $tab_experience['shortcode'] = ''; |
10 | 10 | if ( ! empty( $tab_experience['content'] ) ) { |
11 | - $tabs[] = $tab_experience; |
|
11 | + $tabs[] = $tab_experience; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Tab Featured plan |
@@ -19,36 +19,36 @@ discard block |
||
19 | 19 | |
20 | 20 | if ( ! empty( $tab_plans['posts'] ) ) { |
21 | 21 | |
22 | - $plan_content = ''; |
|
22 | + $plan_content = ''; |
|
23 | 23 | |
24 | - $include = implode( ',', $tab_plans['posts'] ); |
|
25 | - $args = array( |
|
26 | - 'orderby' => 'menu_order', |
|
27 | - 'order' => 'ASC', |
|
28 | - 'post_type' => 'plan', |
|
29 | - 'post__in' => $tab_plans['posts'], |
|
30 | - ); |
|
31 | - $plan_query = new WP_Query( $args ); |
|
24 | + $include = implode( ',', $tab_plans['posts'] ); |
|
25 | + $args = array( |
|
26 | + 'orderby' => 'menu_order', |
|
27 | + 'order' => 'ASC', |
|
28 | + 'post_type' => 'plan', |
|
29 | + 'post__in' => $tab_plans['posts'], |
|
30 | + ); |
|
31 | + $plan_query = new WP_Query( $args ); |
|
32 | 32 | |
33 | - $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"><div class="row">'; |
|
33 | + $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"><div class="row">'; |
|
34 | 34 | |
35 | - if ( $plan_query->have_posts() ) { |
|
36 | - add_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
37 | - while ( $plan_query->have_posts() ) { |
|
38 | - $plan_query->the_post(); |
|
39 | - ob_start(); |
|
40 | - include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; |
|
41 | - $plan_content .= ob_get_clean(); |
|
42 | - } |
|
43 | - wp_reset_postdata(); |
|
44 | - remove_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
45 | - } |
|
46 | - $plan_content .= '</div></div>'; |
|
35 | + if ( $plan_query->have_posts() ) { |
|
36 | + add_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
37 | + while ( $plan_query->have_posts() ) { |
|
38 | + $plan_query->the_post(); |
|
39 | + ob_start(); |
|
40 | + include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; |
|
41 | + $plan_content .= ob_get_clean(); |
|
42 | + } |
|
43 | + wp_reset_postdata(); |
|
44 | + remove_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
45 | + } |
|
46 | + $plan_content .= '</div></div>'; |
|
47 | 47 | |
48 | - $tab_plans['content'] = $plan_content; |
|
48 | + $tab_plans['content'] = $plan_content; |
|
49 | 49 | } |
50 | 50 | if ( ! empty( $tab_plans['content'] ) ) { |
51 | - $tabs[] = $tab_plans; |
|
51 | + $tabs[] = $tab_plans; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | $tab_testimonial['content'] = ''; |
60 | 60 | |
61 | 61 | if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
62 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
63 | - $columns = count( $tab_testimonial['posts'] ); |
|
64 | - } else { |
|
65 | - $columns = 3; |
|
66 | - } |
|
62 | + if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
63 | + $columns = count( $tab_testimonial['posts'] ); |
|
64 | + } else { |
|
65 | + $columns = 3; |
|
66 | + } |
|
67 | 67 | |
68 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
69 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
70 | - $tabs[] = $tab_testimonial; |
|
68 | + $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
69 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
70 | + $tabs[] = $tab_testimonial; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if ( count( $tabs ) > 0 ) : ?> |
@@ -4,85 +4,85 @@ |
||
4 | 4 | $tabs = array(); |
5 | 5 | |
6 | 6 | // Tab Experience |
7 | -$tab_experience['title'] = esc_html__( 'Experience', 'lsx-team' ); |
|
8 | -$tab_experience['content'] = get_post_meta( get_the_ID(), 'team_member_experience', true ); |
|
7 | +$tab_experience['title'] = esc_html__('Experience', 'lsx-team'); |
|
8 | +$tab_experience['content'] = get_post_meta(get_the_ID(), 'team_member_experience', true); |
|
9 | 9 | $tab_experience['shortcode'] = ''; |
10 | -if ( ! empty( $tab_experience['content'] ) ) { |
|
10 | +if ( ! empty($tab_experience['content'])) { |
|
11 | 11 | $tabs[] = $tab_experience; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Tab Featured plan |
15 | -$tab_plans['title'] = esc_html__( 'Featured Plans', 'lsx-team' ); |
|
16 | -$tab_plans['posts'] = get_post_meta( get_the_ID(), 'connected_team_member_plan', true ); |
|
15 | +$tab_plans['title'] = esc_html__('Featured Plans', 'lsx-team'); |
|
16 | +$tab_plans['posts'] = get_post_meta(get_the_ID(), 'connected_team_member_plan', true); |
|
17 | 17 | $tab_plans['content'] = ''; |
18 | 18 | $tab_plans['shortcode'] = ''; |
19 | 19 | |
20 | -if ( ! empty( $tab_plans['posts'] ) ) { |
|
20 | +if ( ! empty($tab_plans['posts'])) { |
|
21 | 21 | |
22 | 22 | $plan_content = ''; |
23 | 23 | |
24 | - $include = implode( ',', $tab_plans['posts'] ); |
|
24 | + $include = implode(',', $tab_plans['posts']); |
|
25 | 25 | $args = array( |
26 | 26 | 'orderby' => 'menu_order', |
27 | 27 | 'order' => 'ASC', |
28 | 28 | 'post_type' => 'plan', |
29 | 29 | 'post__in' => $tab_plans['posts'], |
30 | 30 | ); |
31 | - $plan_query = new WP_Query( $args ); |
|
31 | + $plan_query = new WP_Query($args); |
|
32 | 32 | |
33 | 33 | $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"><div class="row">'; |
34 | 34 | |
35 | - if ( $plan_query->have_posts() ) { |
|
36 | - add_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
37 | - while ( $plan_query->have_posts() ) { |
|
35 | + if ($plan_query->have_posts()) { |
|
36 | + add_action('lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10); |
|
37 | + while ($plan_query->have_posts()) { |
|
38 | 38 | $plan_query->the_post(); |
39 | 39 | ob_start(); |
40 | 40 | include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; |
41 | 41 | $plan_content .= ob_get_clean(); |
42 | 42 | } |
43 | 43 | wp_reset_postdata(); |
44 | - remove_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
44 | + remove_action('lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10); |
|
45 | 45 | } |
46 | 46 | $plan_content .= '</div></div>'; |
47 | 47 | |
48 | 48 | $tab_plans['content'] = $plan_content; |
49 | 49 | } |
50 | -if ( ! empty( $tab_plans['content'] ) ) { |
|
50 | +if ( ! empty($tab_plans['content'])) { |
|
51 | 51 | $tabs[] = $tab_plans; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | // Tab Testimonials |
56 | 56 | $tab_testimonial['post_type'] = 'testimonial'; |
57 | -$tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
58 | -$tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
57 | +$tab_testimonial['title'] = esc_html__('Testimonials', 'lsx-team'); |
|
58 | +$tab_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_team', true); |
|
59 | 59 | $tab_testimonial['content'] = ''; |
60 | 60 | |
61 | -if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
62 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
63 | - $columns = count( $tab_testimonial['posts'] ); |
|
61 | +if (is_plugin_active('lsx-testimonials/lsx-testimonials.php') && ( ! empty($tab_testimonial['posts']))) { |
|
62 | + if (count($tab_testimonial['posts']) <= 2) { |
|
63 | + $columns = count($tab_testimonial['posts']); |
|
64 | 64 | } else { |
65 | 65 | $columns = 3; |
66 | 66 | } |
67 | 67 | |
68 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
68 | + $post_ids = join(',', $tab_testimonial['posts']); |
|
69 | 69 | $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
70 | 70 | $tabs[] = $tab_testimonial; |
71 | 71 | } |
72 | 72 | |
73 | -if ( count( $tabs ) > 0 ) : ?> |
|
73 | +if (count($tabs) > 0) : ?> |
|
74 | 74 | <div class="entry-tabs hp-entry-tabs"> |
75 | 75 | <ul class="nav nav-tabs"> |
76 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
77 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
76 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
77 | + <li<?php if (0 === $i) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr(sanitize_title($tab['title'])); ?>"><?php echo esc_html($tab['title']); ?></a></li> |
|
78 | 78 | <?php endforeach; ?> |
79 | 79 | </ul> |
80 | 80 | |
81 | 81 | <div class="tab-content"> |
82 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
83 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
84 | - <?php echo do_shortcode( $tab['shortcode'] ); ?> |
|
85 | - <?php echo wp_kses_post( $tab['content'] ); ?> |
|
82 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
83 | + <div id="<?php echo esc_attr(sanitize_title($tab['title'])); ?>" class="tab-pane fade<?php if (0 === $i) echo ' in active'; ?>"> |
|
84 | + <?php echo do_shortcode($tab['shortcode']); ?> |
|
85 | + <?php echo wp_kses_post($tab['content']); ?> |
|
86 | 86 | </div> |
87 | 87 | <?php endforeach; ?> |
88 | 88 | </div> |
@@ -8,169 +8,169 @@ |
||
8 | 8 | */ |
9 | 9 | class Integrations { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Integrations() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * Holds class instance |
|
22 | - * |
|
23 | - * @since 1.0.0 |
|
24 | - * |
|
25 | - * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
26 | - */ |
|
27 | - public $cmb2_post_search_ajax = false; |
|
28 | - |
|
29 | - /** |
|
30 | - * Holds class instance |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - * |
|
34 | - * @var object \lsx_health_plan\classes\Download_Monitor() |
|
35 | - */ |
|
36 | - public $download_monitor = false; |
|
37 | - |
|
38 | - /** |
|
39 | - * Holds class instance |
|
40 | - * |
|
41 | - * @since 1.0.0 |
|
42 | - * |
|
43 | - * @var object \lsx_health_plan\classes\Woocommerce() |
|
44 | - */ |
|
45 | - public $woocommerce = false; |
|
46 | - |
|
47 | - /** |
|
48 | - * Holds class instance |
|
49 | - * |
|
50 | - * @since 1.0.0 |
|
51 | - * |
|
52 | - * @var object \lsx_health_plan\classes\WP_User_Avatar() |
|
53 | - */ |
|
54 | - public $wp_user_avatar = false; |
|
55 | - |
|
56 | - /** |
|
57 | - * Holds class instance |
|
58 | - * |
|
59 | - * @since 1.0.0 |
|
60 | - * |
|
61 | - * @var object \lsx_health_plan\classes\FacetWP() |
|
62 | - */ |
|
63 | - public $facetwp = false; |
|
64 | - |
|
65 | - /** |
|
66 | - * Constructor |
|
67 | - */ |
|
68 | - public function __construct() { |
|
69 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
70 | - add_action( 'init', array( $this, 'download_monitor_init' ) ); |
|
71 | - add_action( 'init', array( $this, 'woocommerce_init' ) ); |
|
72 | - add_action( 'init', array( $this, 'wp_user_avatar_init' ) ); |
|
73 | - add_action( 'init', array( $this, 'facetwp_init' ) ); |
|
74 | - add_action( 'init', array( $this, 'lsx_team_init' ) ); |
|
75 | - add_action( 'init', array( $this, 'lsx_article_init' ) ); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Return an instance of this class. |
|
80 | - * |
|
81 | - * @since 1.0.0 |
|
82 | - * |
|
83 | - * @return object \lsx_health_plan\classes\Integrations() A single instance of this class. |
|
84 | - */ |
|
85 | - public static function get_instance() { |
|
86 | - // If the single instance hasn't been set, set it now. |
|
87 | - if ( null === self::$instance ) { |
|
88 | - self::$instance = new self(); |
|
89 | - } |
|
90 | - return self::$instance; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Includes the Post Search Ajax if it is there. |
|
95 | - * |
|
96 | - * @return void |
|
97 | - */ |
|
98 | - public function cmb2_post_search_ajax() { |
|
99 | - require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
100 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
101 | - $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Includes the Post Search Ajax if it is there. |
|
107 | - * |
|
108 | - * @return void |
|
109 | - */ |
|
110 | - public function download_monitor_init() { |
|
111 | - if ( function_exists( 'download_monitor' ) ) { |
|
112 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
|
113 | - $this->download_monitor = Download_Monitor::get_instance(); |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Includes the Woocommerce functions. |
|
119 | - * |
|
120 | - * @return void |
|
121 | - */ |
|
122 | - public function woocommerce_init() { |
|
123 | - if ( function_exists( 'WC' ) ) { |
|
124 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
|
125 | - $this->woocommerce = Woocommerce::get_instance(); |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * Includes the Woocommerce functions. |
|
131 | - * |
|
132 | - * @return void |
|
133 | - */ |
|
134 | - public function wp_user_avatar_init() { |
|
135 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
136 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
|
137 | - $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
|
138 | - } |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * Includes the FacetWP Indexer Filters. |
|
143 | - * |
|
144 | - * @return void |
|
145 | - */ |
|
146 | - public function facetwp_init() { |
|
147 | - if ( class_exists( 'FacetWP' ) ) { |
|
148 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
|
149 | - $this->facetwp = FacetWP::get_instance(); |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Includes the LSX Team Integration. |
|
155 | - * |
|
156 | - * @return void |
|
157 | - */ |
|
158 | - public function lsx_team_init() { |
|
159 | - if ( class_exists( 'LSX_Team' ) ) { |
|
160 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
|
161 | - $this->team = LSX_Team::get_instance(); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Includes the Blog Integration. |
|
167 | - * |
|
168 | - * @return void |
|
169 | - */ |
|
170 | - public function lsx_article_init() { |
|
171 | - if ( wp_count_posts()->publish > 0 ) { |
|
172 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
|
173 | - $this->article = Articles::get_instance(); |
|
174 | - } |
|
175 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Integrations() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * Holds class instance |
|
22 | + * |
|
23 | + * @since 1.0.0 |
|
24 | + * |
|
25 | + * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
26 | + */ |
|
27 | + public $cmb2_post_search_ajax = false; |
|
28 | + |
|
29 | + /** |
|
30 | + * Holds class instance |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + * |
|
34 | + * @var object \lsx_health_plan\classes\Download_Monitor() |
|
35 | + */ |
|
36 | + public $download_monitor = false; |
|
37 | + |
|
38 | + /** |
|
39 | + * Holds class instance |
|
40 | + * |
|
41 | + * @since 1.0.0 |
|
42 | + * |
|
43 | + * @var object \lsx_health_plan\classes\Woocommerce() |
|
44 | + */ |
|
45 | + public $woocommerce = false; |
|
46 | + |
|
47 | + /** |
|
48 | + * Holds class instance |
|
49 | + * |
|
50 | + * @since 1.0.0 |
|
51 | + * |
|
52 | + * @var object \lsx_health_plan\classes\WP_User_Avatar() |
|
53 | + */ |
|
54 | + public $wp_user_avatar = false; |
|
55 | + |
|
56 | + /** |
|
57 | + * Holds class instance |
|
58 | + * |
|
59 | + * @since 1.0.0 |
|
60 | + * |
|
61 | + * @var object \lsx_health_plan\classes\FacetWP() |
|
62 | + */ |
|
63 | + public $facetwp = false; |
|
64 | + |
|
65 | + /** |
|
66 | + * Constructor |
|
67 | + */ |
|
68 | + public function __construct() { |
|
69 | + add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
70 | + add_action( 'init', array( $this, 'download_monitor_init' ) ); |
|
71 | + add_action( 'init', array( $this, 'woocommerce_init' ) ); |
|
72 | + add_action( 'init', array( $this, 'wp_user_avatar_init' ) ); |
|
73 | + add_action( 'init', array( $this, 'facetwp_init' ) ); |
|
74 | + add_action( 'init', array( $this, 'lsx_team_init' ) ); |
|
75 | + add_action( 'init', array( $this, 'lsx_article_init' ) ); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Return an instance of this class. |
|
80 | + * |
|
81 | + * @since 1.0.0 |
|
82 | + * |
|
83 | + * @return object \lsx_health_plan\classes\Integrations() A single instance of this class. |
|
84 | + */ |
|
85 | + public static function get_instance() { |
|
86 | + // If the single instance hasn't been set, set it now. |
|
87 | + if ( null === self::$instance ) { |
|
88 | + self::$instance = new self(); |
|
89 | + } |
|
90 | + return self::$instance; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Includes the Post Search Ajax if it is there. |
|
95 | + * |
|
96 | + * @return void |
|
97 | + */ |
|
98 | + public function cmb2_post_search_ajax() { |
|
99 | + require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
100 | + if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
101 | + $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
102 | + } |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Includes the Post Search Ajax if it is there. |
|
107 | + * |
|
108 | + * @return void |
|
109 | + */ |
|
110 | + public function download_monitor_init() { |
|
111 | + if ( function_exists( 'download_monitor' ) ) { |
|
112 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
|
113 | + $this->download_monitor = Download_Monitor::get_instance(); |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Includes the Woocommerce functions. |
|
119 | + * |
|
120 | + * @return void |
|
121 | + */ |
|
122 | + public function woocommerce_init() { |
|
123 | + if ( function_exists( 'WC' ) ) { |
|
124 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
|
125 | + $this->woocommerce = Woocommerce::get_instance(); |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * Includes the Woocommerce functions. |
|
131 | + * |
|
132 | + * @return void |
|
133 | + */ |
|
134 | + public function wp_user_avatar_init() { |
|
135 | + if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
136 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
|
137 | + $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
|
138 | + } |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Includes the FacetWP Indexer Filters. |
|
143 | + * |
|
144 | + * @return void |
|
145 | + */ |
|
146 | + public function facetwp_init() { |
|
147 | + if ( class_exists( 'FacetWP' ) ) { |
|
148 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
|
149 | + $this->facetwp = FacetWP::get_instance(); |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Includes the LSX Team Integration. |
|
155 | + * |
|
156 | + * @return void |
|
157 | + */ |
|
158 | + public function lsx_team_init() { |
|
159 | + if ( class_exists( 'LSX_Team' ) ) { |
|
160 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
|
161 | + $this->team = LSX_Team::get_instance(); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Includes the Blog Integration. |
|
167 | + * |
|
168 | + * @return void |
|
169 | + */ |
|
170 | + public function lsx_article_init() { |
|
171 | + if ( wp_count_posts()->publish > 0 ) { |
|
172 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
|
173 | + $this->article = Articles::get_instance(); |
|
174 | + } |
|
175 | + } |
|
176 | 176 | } |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | * Constructor |
67 | 67 | */ |
68 | 68 | public function __construct() { |
69 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
70 | - add_action( 'init', array( $this, 'download_monitor_init' ) ); |
|
71 | - add_action( 'init', array( $this, 'woocommerce_init' ) ); |
|
72 | - add_action( 'init', array( $this, 'wp_user_avatar_init' ) ); |
|
73 | - add_action( 'init', array( $this, 'facetwp_init' ) ); |
|
74 | - add_action( 'init', array( $this, 'lsx_team_init' ) ); |
|
75 | - add_action( 'init', array( $this, 'lsx_article_init' ) ); |
|
69 | + add_action('init', array($this, 'cmb2_post_search_ajax')); |
|
70 | + add_action('init', array($this, 'download_monitor_init')); |
|
71 | + add_action('init', array($this, 'woocommerce_init')); |
|
72 | + add_action('init', array($this, 'wp_user_avatar_init')); |
|
73 | + add_action('init', array($this, 'facetwp_init')); |
|
74 | + add_action('init', array($this, 'lsx_team_init')); |
|
75 | + add_action('init', array($this, 'lsx_article_init')); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function get_instance() { |
86 | 86 | // If the single instance hasn't been set, set it now. |
87 | - if ( null === self::$instance ) { |
|
87 | + if (null === self::$instance) { |
|
88 | 88 | self::$instance = new self(); |
89 | 89 | } |
90 | 90 | return self::$instance; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function cmb2_post_search_ajax() { |
99 | 99 | require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
100 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
100 | + if (method_exists('MAG_CMB2_Field_Post_Search_Ajax', 'get_instance')) { |
|
101 | 101 | $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
102 | 102 | } |
103 | 103 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return void |
109 | 109 | */ |
110 | 110 | public function download_monitor_init() { |
111 | - if ( function_exists( 'download_monitor' ) ) { |
|
111 | + if (function_exists('download_monitor')) { |
|
112 | 112 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
113 | 113 | $this->download_monitor = Download_Monitor::get_instance(); |
114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @return void |
121 | 121 | */ |
122 | 122 | public function woocommerce_init() { |
123 | - if ( function_exists( 'WC' ) ) { |
|
123 | + if (function_exists('WC')) { |
|
124 | 124 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
125 | 125 | $this->woocommerce = Woocommerce::get_instance(); |
126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return void |
133 | 133 | */ |
134 | 134 | public function wp_user_avatar_init() { |
135 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
135 | + if (class_exists('WP_User_Avatar_Setup')) { |
|
136 | 136 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
137 | 137 | $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
138 | 138 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function facetwp_init() { |
147 | - if ( class_exists( 'FacetWP' ) ) { |
|
147 | + if (class_exists('FacetWP')) { |
|
148 | 148 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
149 | 149 | $this->facetwp = FacetWP::get_instance(); |
150 | 150 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @return void |
157 | 157 | */ |
158 | 158 | public function lsx_team_init() { |
159 | - if ( class_exists( 'LSX_Team' ) ) { |
|
159 | + if (class_exists('LSX_Team')) { |
|
160 | 160 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
161 | 161 | $this->team = LSX_Team::get_instance(); |
162 | 162 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @return void |
169 | 169 | */ |
170 | 170 | public function lsx_article_init() { |
171 | - if ( wp_count_posts()->publish > 0 ) { |
|
171 | + if (wp_count_posts()->publish > 0) { |
|
172 | 172 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
173 | 173 | $this->article = Articles::get_instance(); |
174 | 174 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // If this file is called directly, abort. |
15 | 15 | if ( ! defined( 'WPINC' ) ) { |
16 | - die; |
|
16 | + die; |
|
17 | 17 | } |
18 | 18 | define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) ); |
19 | 19 | define( 'LSX_HEALTH_PLAN_CORE', __FILE__ ); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * @return void |
31 | 31 | */ |
32 | 32 | function lsx_remove_extra_meta_box() { |
33 | - global $wp_meta_boxes; |
|
34 | - $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ]; |
|
35 | - //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' ); |
|
36 | - remove_meta_box( 'commentsdiv', $all_post_types, 'normal' ); |
|
37 | - remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' ); |
|
38 | - remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' ); |
|
33 | + global $wp_meta_boxes; |
|
34 | + $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ]; |
|
35 | + //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' ); |
|
36 | + remove_meta_box( 'commentsdiv', $all_post_types, 'normal' ); |
|
37 | + remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' ); |
|
38 | + remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' ); |
|
39 | 39 | } |
40 | 40 | add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 ); |
41 | 41 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | function lsx_login_redirect() { |
48 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
49 | - if ( false === $plan_slug ) { |
|
50 | - $plan_slug = 'my-plan'; |
|
51 | - } |
|
52 | - return home_url( $plan_slug ); |
|
48 | + $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
49 | + if ( false === $plan_slug ) { |
|
50 | + $plan_slug = 'my-plan'; |
|
51 | + } |
|
52 | + return home_url( $plan_slug ); |
|
53 | 53 | } |
54 | 54 | add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return object lsx_health_plan\classes\Core::get_instance(); |
60 | 60 | */ |
61 | 61 | function lsx_health_plan() { |
62 | - return \lsx_health_plan\classes\Core::get_instance(); |
|
62 | + return \lsx_health_plan\classes\Core::get_instance(); |
|
63 | 63 | } |
64 | 64 | lsx_health_plan(); |
65 | 65 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | * @return void |
70 | 70 | */ |
71 | 71 | function lsx_get_svg_icon( $icon ) { |
72 | - $path = '/assets/images/'; |
|
72 | + $path = '/assets/images/'; |
|
73 | 73 | |
74 | - if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
|
75 | - // Load and return the contents of the file. |
|
76 | - return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
|
77 | - } |
|
74 | + if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
|
75 | + // Load and return the contents of the file. |
|
76 | + return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
|
77 | + } |
|
78 | 78 | |
79 | - // Return a blank string if we can't find the file. |
|
80 | - return ''; |
|
79 | + // Return a blank string if we can't find the file. |
|
80 | + return ''; |
|
81 | 81 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // If this file is called directly, abort. |
15 | -if ( ! defined( 'WPINC' ) ) { |
|
15 | +if ( ! defined('WPINC')) { |
|
16 | 16 | die; |
17 | 17 | } |
18 | -define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) ); |
|
19 | -define( 'LSX_HEALTH_PLAN_CORE', __FILE__ ); |
|
20 | -define( 'LSX_HEALTH_PLAN_URL', plugin_dir_url( __FILE__ ) ); |
|
21 | -define( 'LSX_HEALTH_PLAN_VER', '1.4.0' ); |
|
18 | +define('LSX_HEALTH_PLAN_PATH', plugin_dir_path(__FILE__)); |
|
19 | +define('LSX_HEALTH_PLAN_CORE', __FILE__); |
|
20 | +define('LSX_HEALTH_PLAN_URL', plugin_dir_url(__FILE__)); |
|
21 | +define('LSX_HEALTH_PLAN_VER', '1.4.0'); |
|
22 | 22 | |
23 | 23 | /* ======================= Below is the Plugin Class init ========================= */ |
24 | 24 | |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function lsx_remove_extra_meta_box() { |
33 | 33 | global $wp_meta_boxes; |
34 | - $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ]; |
|
34 | + $all_post_types = ['plan', 'video', 'workout', 'tip', 'recipe', 'meal']; |
|
35 | 35 | //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' ); |
36 | - remove_meta_box( 'commentsdiv', $all_post_types, 'normal' ); |
|
37 | - remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' ); |
|
38 | - remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' ); |
|
36 | + remove_meta_box('commentsdiv', $all_post_types, 'normal'); |
|
37 | + remove_meta_box('commentstatusdiv', $all_post_types, 'normal'); |
|
38 | + remove_meta_box('lsx_blocks_title_meta', $all_post_types, 'side'); |
|
39 | 39 | } |
40 | -add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 ); |
|
40 | +add_action('add_meta_boxes', 'lsx_remove_extra_meta_box', 100); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Redirect user after login or redirect |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | function lsx_login_redirect() { |
48 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
49 | - if ( false === $plan_slug ) { |
|
48 | + $plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false); |
|
49 | + if (false === $plan_slug) { |
|
50 | 50 | $plan_slug = 'my-plan'; |
51 | 51 | } |
52 | - return home_url( $plan_slug ); |
|
52 | + return home_url($plan_slug); |
|
53 | 53 | } |
54 | -add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
|
54 | +add_filter('woocommerce_login_redirect', 'lsx_login_redirect'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Undocumented function |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return void |
70 | 70 | */ |
71 | -function lsx_get_svg_icon( $icon ) { |
|
71 | +function lsx_get_svg_icon($icon) { |
|
72 | 72 | $path = '/assets/images/'; |
73 | 73 | |
74 | - if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
|
74 | + if (file_exists(LSX_HEALTH_PLAN_PATH . $path . $icon)) { |
|
75 | 75 | // Load and return the contents of the file. |
76 | 76 | return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
77 | 77 | } |
@@ -13,5 +13,5 @@ |
||
13 | 13 | * @return boolean |
14 | 14 | */ |
15 | 15 | function disable_sharing( $disabled ) { |
16 | - return true; |
|
16 | + return true; |
|
17 | 17 | } |
@@ -12,6 +12,6 @@ |
||
12 | 12 | * |
13 | 13 | * @return boolean |
14 | 14 | */ |
15 | -function disable_sharing( $disabled ) { |
|
15 | +function disable_sharing($disabled) { |
|
16 | 16 | return true; |
17 | 17 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | * @return boolean |
13 | 13 | */ |
14 | 14 | function lsx_health_plan_has_warmup( $post_id = '' ) { |
15 | - if ( '' === $post_id ) { |
|
16 | - $post_id = get_the_ID(); |
|
17 | - } |
|
18 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' ); |
|
15 | + if ( '' === $post_id ) { |
|
16 | + $post_id = get_the_ID(); |
|
17 | + } |
|
18 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' ); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | * @return boolean |
26 | 26 | */ |
27 | 27 | function lsx_health_plan_has_workout( $post_id = '' ) { |
28 | - if ( ! post_type_exists( 'workout' ) ) { |
|
29 | - return false; |
|
30 | - } |
|
31 | - if ( '' === $post_id ) { |
|
32 | - $post_id = get_the_ID(); |
|
33 | - } |
|
34 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' ); |
|
28 | + if ( ! post_type_exists( 'workout' ) ) { |
|
29 | + return false; |
|
30 | + } |
|
31 | + if ( '' === $post_id ) { |
|
32 | + $post_id = get_the_ID(); |
|
33 | + } |
|
34 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | * @return boolean |
42 | 42 | */ |
43 | 43 | function lsx_health_plan_has_meal( $post_id = '' ) { |
44 | - if ( ! post_type_exists( 'meal' ) ) { |
|
45 | - return false; |
|
46 | - } |
|
47 | - if ( '' === $post_id ) { |
|
48 | - $post_id = get_the_ID(); |
|
49 | - } |
|
50 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' ); |
|
44 | + if ( ! post_type_exists( 'meal' ) ) { |
|
45 | + return false; |
|
46 | + } |
|
47 | + if ( '' === $post_id ) { |
|
48 | + $post_id = get_the_ID(); |
|
49 | + } |
|
50 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @return boolean |
58 | 58 | */ |
59 | 59 | function lsx_health_plan_has_recipe( $post_id = '' ) { |
60 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
61 | - return false; |
|
62 | - } |
|
63 | - if ( '' === $post_id ) { |
|
64 | - $post_id = get_the_ID(); |
|
65 | - } |
|
66 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' ); |
|
60 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
61 | + return false; |
|
62 | + } |
|
63 | + if ( '' === $post_id ) { |
|
64 | + $post_id = get_the_ID(); |
|
65 | + } |
|
66 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @return boolean |
74 | 74 | */ |
75 | 75 | function lsx_health_plan_has_downloads( $post_id = '' ) { |
76 | - $has_downloads = false; |
|
77 | - if ( '' === $post_id ) { |
|
78 | - $post_id = get_the_ID(); |
|
79 | - } |
|
80 | - $downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id ); |
|
81 | - if ( ! empty( $downloads ) ) { |
|
82 | - $has_downloads = true; |
|
83 | - } |
|
84 | - return $has_downloads; |
|
76 | + $has_downloads = false; |
|
77 | + if ( '' === $post_id ) { |
|
78 | + $post_id = get_the_ID(); |
|
79 | + } |
|
80 | + $downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id ); |
|
81 | + if ( ! empty( $downloads ) ) { |
|
82 | + $has_downloads = true; |
|
83 | + } |
|
84 | + return $has_downloads; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @return boolean |
92 | 92 | */ |
93 | 93 | function lsx_health_plan_has_tip( $post_id = '' ) { |
94 | - if ( ! post_type_exists( 'tip' ) ) { |
|
95 | - return false; |
|
96 | - } |
|
97 | - if ( '' === $post_id ) { |
|
98 | - $post_id = get_the_ID(); |
|
99 | - } |
|
100 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' ); |
|
94 | + if ( ! post_type_exists( 'tip' ) ) { |
|
95 | + return false; |
|
96 | + } |
|
97 | + if ( '' === $post_id ) { |
|
98 | + $post_id = get_the_ID(); |
|
99 | + } |
|
100 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' ); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | * @return boolean |
108 | 108 | */ |
109 | 109 | function lsx_health_plan_has_video( $post_id = '' ) { |
110 | - if ( ! post_type_exists( 'video' ) ) { |
|
111 | - return false; |
|
112 | - } |
|
113 | - if ( '' === $post_id ) { |
|
114 | - $post_id = get_the_ID(); |
|
115 | - } |
|
116 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' ); |
|
110 | + if ( ! post_type_exists( 'video' ) ) { |
|
111 | + return false; |
|
112 | + } |
|
113 | + if ( '' === $post_id ) { |
|
114 | + $post_id = get_the_ID(); |
|
115 | + } |
|
116 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' ); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @return boolean |
123 | 123 | */ |
124 | 124 | function lsx_health_plan_user_has_purchase() { |
125 | - $valid_order = false; |
|
126 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
125 | + $valid_order = false; |
|
126 | + $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
127 | 127 | |
128 | - if ( is_user_logged_in() && false !== $product_id ) { |
|
129 | - $current_user = wp_get_current_user(); |
|
130 | - if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id ) ) { |
|
131 | - $valid_order = true; |
|
132 | - } |
|
133 | - } |
|
134 | - return $valid_order; |
|
128 | + if ( is_user_logged_in() && false !== $product_id ) { |
|
129 | + $current_user = wp_get_current_user(); |
|
130 | + if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id ) ) { |
|
131 | + $valid_order = true; |
|
132 | + } |
|
133 | + } |
|
134 | + return $valid_order; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -141,18 +141,18 @@ discard block |
||
141 | 141 | * @return boolean |
142 | 142 | */ |
143 | 143 | function lsx_health_plan_is_current_tab( $needle = '' ) { |
144 | - $is_tab = false; |
|
145 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
146 | - if ( false === $plan_slug ) { |
|
147 | - $plan_slug = 'my-plan'; |
|
148 | - } |
|
149 | - if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) { |
|
150 | - $endpoint = get_query_var( 'endpoint' ); |
|
151 | - if ( false !== $endpoint && $needle === $endpoint ) { |
|
152 | - $is_tab = true; |
|
153 | - } |
|
154 | - } |
|
155 | - return $is_tab; |
|
144 | + $is_tab = false; |
|
145 | + $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
146 | + if ( false === $plan_slug ) { |
|
147 | + $plan_slug = 'my-plan'; |
|
148 | + } |
|
149 | + if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) { |
|
150 | + $endpoint = get_query_var( 'endpoint' ); |
|
151 | + if ( false !== $endpoint && $needle === $endpoint ) { |
|
152 | + $is_tab = true; |
|
153 | + } |
|
154 | + } |
|
155 | + return $is_tab; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -162,22 +162,22 @@ discard block |
||
162 | 162 | * @return boolean |
163 | 163 | */ |
164 | 164 | function lsx_health_plan_is_day_complete( $post_id = '', $section_key = '' ) { |
165 | - $is_complete = false; |
|
166 | - if ( '' === $post_id ) { |
|
167 | - $post_id = get_the_ID(); |
|
168 | - } |
|
169 | - $key = \lsx_health_plan\functions\plan\generate_section_id( $section_key ); |
|
170 | - $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $key . '_complete', true ); |
|
171 | - if ( false !== $is_day_complete && '' !== $is_day_complete ) { |
|
172 | - $is_complete = true; |
|
173 | - } |
|
165 | + $is_complete = false; |
|
166 | + if ( '' === $post_id ) { |
|
167 | + $post_id = get_the_ID(); |
|
168 | + } |
|
169 | + $key = \lsx_health_plan\functions\plan\generate_section_id( $section_key ); |
|
170 | + $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $key . '_complete', true ); |
|
171 | + if ( false !== $is_day_complete && '' !== $is_day_complete ) { |
|
172 | + $is_complete = true; |
|
173 | + } |
|
174 | 174 | |
175 | - return $is_complete; |
|
175 | + return $is_complete; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | function lsx_health_plan_is_plan_complete() { |
179 | - $complete = false; |
|
180 | - return $complete; |
|
179 | + $complete = false; |
|
180 | + return $complete; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -187,14 +187,14 @@ discard block |
||
187 | 187 | * @return boolean |
188 | 188 | */ |
189 | 189 | function lsx_health_plan_week_has_downloads( $week = '' ) { |
190 | - $has_downloads = false; |
|
191 | - if ( '' !== $week ) { |
|
192 | - $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week ); |
|
193 | - if ( ! empty( $downloads ) ) { |
|
194 | - $has_downloads = true; |
|
195 | - } |
|
196 | - } |
|
197 | - return $has_downloads; |
|
190 | + $has_downloads = false; |
|
191 | + if ( '' !== $week ) { |
|
192 | + $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week ); |
|
193 | + if ( ! empty( $downloads ) ) { |
|
194 | + $has_downloads = true; |
|
195 | + } |
|
196 | + } |
|
197 | + return $has_downloads; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | * @return boolean |
205 | 205 | */ |
206 | 206 | function lsx_health_plan_has_tips( $post_id = '' ) { |
207 | - $has_tips = false; |
|
208 | - if ( '' === $post_id ) { |
|
209 | - $post_id = get_the_ID(); |
|
210 | - } |
|
211 | - $post_type = get_post_type( $post_id ); |
|
212 | - $connected_tips = get_post_meta( get_the_ID(), $post_type . '_connected_tips', true ); |
|
213 | - $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips ); |
|
214 | - if ( ! empty( $connected_tips ) ) { |
|
215 | - $has_tips = true; |
|
216 | - } |
|
217 | - return $has_tips; |
|
207 | + $has_tips = false; |
|
208 | + if ( '' === $post_id ) { |
|
209 | + $post_id = get_the_ID(); |
|
210 | + } |
|
211 | + $post_type = get_post_type( $post_id ); |
|
212 | + $connected_tips = get_post_meta( get_the_ID(), $post_type . '_connected_tips', true ); |
|
213 | + $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips ); |
|
214 | + if ( ! empty( $connected_tips ) ) { |
|
215 | + $has_tips = true; |
|
216 | + } |
|
217 | + return $has_tips; |
|
218 | 218 | } |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | * @param string $post_id |
12 | 12 | * @return boolean |
13 | 13 | */ |
14 | -function lsx_health_plan_has_warmup( $post_id = '' ) { |
|
15 | - if ( '' === $post_id ) { |
|
14 | +function lsx_health_plan_has_warmup($post_id = '') { |
|
15 | + if ('' === $post_id) { |
|
16 | 16 | $post_id = get_the_ID(); |
17 | 17 | } |
18 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' ); |
|
18 | + return \lsx_health_plan\functions\has_attached_post($post_id, 'plan_warmup'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * @param string $post_id |
25 | 25 | * @return boolean |
26 | 26 | */ |
27 | -function lsx_health_plan_has_workout( $post_id = '' ) { |
|
28 | - if ( ! post_type_exists( 'workout' ) ) { |
|
27 | +function lsx_health_plan_has_workout($post_id = '') { |
|
28 | + if ( ! post_type_exists('workout')) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | - if ( '' === $post_id ) { |
|
31 | + if ('' === $post_id) { |
|
32 | 32 | $post_id = get_the_ID(); |
33 | 33 | } |
34 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' ); |
|
34 | + return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_workouts'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * @param string $post_id |
41 | 41 | * @return boolean |
42 | 42 | */ |
43 | -function lsx_health_plan_has_meal( $post_id = '' ) { |
|
44 | - if ( ! post_type_exists( 'meal' ) ) { |
|
43 | +function lsx_health_plan_has_meal($post_id = '') { |
|
44 | + if ( ! post_type_exists('meal')) { |
|
45 | 45 | return false; |
46 | 46 | } |
47 | - if ( '' === $post_id ) { |
|
47 | + if ('' === $post_id) { |
|
48 | 48 | $post_id = get_the_ID(); |
49 | 49 | } |
50 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' ); |
|
50 | + return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_meals'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | * @param string $post_id |
57 | 57 | * @return boolean |
58 | 58 | */ |
59 | -function lsx_health_plan_has_recipe( $post_id = '' ) { |
|
60 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
59 | +function lsx_health_plan_has_recipe($post_id = '') { |
|
60 | + if ( ! post_type_exists('recipe')) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | - if ( '' === $post_id ) { |
|
63 | + if ('' === $post_id) { |
|
64 | 64 | $post_id = get_the_ID(); |
65 | 65 | } |
66 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' ); |
|
66 | + return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_recipes'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | * @param string $post_id |
73 | 73 | * @return boolean |
74 | 74 | */ |
75 | -function lsx_health_plan_has_downloads( $post_id = '' ) { |
|
75 | +function lsx_health_plan_has_downloads($post_id = '') { |
|
76 | 76 | $has_downloads = false; |
77 | - if ( '' === $post_id ) { |
|
77 | + if ('' === $post_id) { |
|
78 | 78 | $post_id = get_the_ID(); |
79 | 79 | } |
80 | - $downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id ); |
|
81 | - if ( ! empty( $downloads ) ) { |
|
80 | + $downloads = \lsx_health_plan\functions\get_downloads('all', $post_id); |
|
81 | + if ( ! empty($downloads)) { |
|
82 | 82 | $has_downloads = true; |
83 | 83 | } |
84 | 84 | return $has_downloads; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * @param string $post_id |
91 | 91 | * @return boolean |
92 | 92 | */ |
93 | -function lsx_health_plan_has_tip( $post_id = '' ) { |
|
94 | - if ( ! post_type_exists( 'tip' ) ) { |
|
93 | +function lsx_health_plan_has_tip($post_id = '') { |
|
94 | + if ( ! post_type_exists('tip')) { |
|
95 | 95 | return false; |
96 | 96 | } |
97 | - if ( '' === $post_id ) { |
|
97 | + if ('' === $post_id) { |
|
98 | 98 | $post_id = get_the_ID(); |
99 | 99 | } |
100 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' ); |
|
100 | + return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_tips'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @param string $post_id |
107 | 107 | * @return boolean |
108 | 108 | */ |
109 | -function lsx_health_plan_has_video( $post_id = '' ) { |
|
110 | - if ( ! post_type_exists( 'video' ) ) { |
|
109 | +function lsx_health_plan_has_video($post_id = '') { |
|
110 | + if ( ! post_type_exists('video')) { |
|
111 | 111 | return false; |
112 | 112 | } |
113 | - if ( '' === $post_id ) { |
|
113 | + if ('' === $post_id) { |
|
114 | 114 | $post_id = get_the_ID(); |
115 | 115 | } |
116 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' ); |
|
116 | + return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_videos'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function lsx_health_plan_user_has_purchase() { |
125 | 125 | $valid_order = false; |
126 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
126 | + $product_id = \lsx_health_plan\functions\get_option('membership_product', false); |
|
127 | 127 | |
128 | - if ( is_user_logged_in() && false !== $product_id ) { |
|
128 | + if (is_user_logged_in() && false !== $product_id) { |
|
129 | 129 | $current_user = wp_get_current_user(); |
130 | - if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id ) ) { |
|
130 | + if (wc_customer_bought_product($current_user->user_email, $current_user->ID, $product_id)) { |
|
131 | 131 | $valid_order = true; |
132 | 132 | } |
133 | 133 | } |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | * @param string $post_id |
141 | 141 | * @return boolean |
142 | 142 | */ |
143 | -function lsx_health_plan_is_current_tab( $needle = '' ) { |
|
143 | +function lsx_health_plan_is_current_tab($needle = '') { |
|
144 | 144 | $is_tab = false; |
145 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
146 | - if ( false === $plan_slug ) { |
|
145 | + $plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false); |
|
146 | + if (false === $plan_slug) { |
|
147 | 147 | $plan_slug = 'my-plan'; |
148 | 148 | } |
149 | - if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) { |
|
150 | - $endpoint = get_query_var( 'endpoint' ); |
|
151 | - if ( false !== $endpoint && $needle === $endpoint ) { |
|
149 | + if (is_singular('plan') || is_page($plan_slug)) { |
|
150 | + $endpoint = get_query_var('endpoint'); |
|
151 | + if (false !== $endpoint && $needle === $endpoint) { |
|
152 | 152 | $is_tab = true; |
153 | 153 | } |
154 | 154 | } |
@@ -161,14 +161,14 @@ discard block |
||
161 | 161 | * @param string $post_id |
162 | 162 | * @return boolean |
163 | 163 | */ |
164 | -function lsx_health_plan_is_day_complete( $post_id = '', $section_key = '' ) { |
|
164 | +function lsx_health_plan_is_day_complete($post_id = '', $section_key = '') { |
|
165 | 165 | $is_complete = false; |
166 | - if ( '' === $post_id ) { |
|
166 | + if ('' === $post_id) { |
|
167 | 167 | $post_id = get_the_ID(); |
168 | 168 | } |
169 | - $key = \lsx_health_plan\functions\plan\generate_section_id( $section_key ); |
|
170 | - $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $key . '_complete', true ); |
|
171 | - if ( false !== $is_day_complete && '' !== $is_day_complete ) { |
|
169 | + $key = \lsx_health_plan\functions\plan\generate_section_id($section_key); |
|
170 | + $is_day_complete = get_user_meta(get_current_user_id(), 'day_' . $key . '_complete', true); |
|
171 | + if (false !== $is_day_complete && '' !== $is_day_complete) { |
|
172 | 172 | $is_complete = true; |
173 | 173 | } |
174 | 174 | |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | * @param string $week The week name 'week-1'. |
187 | 187 | * @return boolean |
188 | 188 | */ |
189 | -function lsx_health_plan_week_has_downloads( $week = '' ) { |
|
189 | +function lsx_health_plan_week_has_downloads($week = '') { |
|
190 | 190 | $has_downloads = false; |
191 | - if ( '' !== $week ) { |
|
192 | - $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week ); |
|
193 | - if ( ! empty( $downloads ) ) { |
|
191 | + if ('' !== $week) { |
|
192 | + $downloads = \lsx_health_plan\functions\get_weekly_downloads($week); |
|
193 | + if ( ! empty($downloads)) { |
|
194 | 194 | $has_downloads = true; |
195 | 195 | } |
196 | 196 | } |
@@ -203,15 +203,15 @@ discard block |
||
203 | 203 | * @param string $post_id |
204 | 204 | * @return boolean |
205 | 205 | */ |
206 | -function lsx_health_plan_has_tips( $post_id = '' ) { |
|
206 | +function lsx_health_plan_has_tips($post_id = '') { |
|
207 | 207 | $has_tips = false; |
208 | - if ( '' === $post_id ) { |
|
208 | + if ('' === $post_id) { |
|
209 | 209 | $post_id = get_the_ID(); |
210 | 210 | } |
211 | - $post_type = get_post_type( $post_id ); |
|
212 | - $connected_tips = get_post_meta( get_the_ID(), $post_type . '_connected_tips', true ); |
|
213 | - $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips ); |
|
214 | - if ( ! empty( $connected_tips ) ) { |
|
211 | + $post_type = get_post_type($post_id); |
|
212 | + $connected_tips = get_post_meta(get_the_ID(), $post_type . '_connected_tips', true); |
|
213 | + $connected_tips = \lsx_health_plan\functions\check_posts_exist($connected_tips); |
|
214 | + if ( ! empty($connected_tips)) { |
|
215 | 215 | $has_tips = true; |
216 | 216 | } |
217 | 217 | return $has_tips; |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | global $connected_meals, $shortcode_args; |
8 | 8 | |
9 | 9 | if ( is_singular( 'plan' ) ) { |
10 | - $section_key = get_query_var( 'section' ); |
|
11 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | - if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | - $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
15 | - } |
|
16 | - } |
|
10 | + $section_key = get_query_var( 'section' ); |
|
11 | + if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | + if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | + $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
15 | + } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Check for any shortcode overrides. |
20 | 20 | if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
21 | - $connected_meals = array( get_the_ID() ); |
|
21 | + $connected_meals = array( get_the_ID() ); |
|
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | |
@@ -26,144 +26,144 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | - // Looking for meals. |
|
30 | - if ( empty( $connected_meals ) ) { |
|
31 | - $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
32 | - |
|
33 | - if ( empty( $connected_meals ) ) { |
|
34 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | - if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
36 | - $connected_meals = $options['connected_meals']; |
|
37 | - if ( ! array( $connected_meals ) ) { |
|
38 | - $connected_meals = array( $connected_meals ); |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - // This is for the meal single template. |
|
45 | - if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | - $connected_meals = array( get_the_ID() ); |
|
47 | - } |
|
48 | - |
|
49 | - // The top part |
|
50 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
51 | - |
|
52 | - if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
53 | - |
|
54 | - $args = array( |
|
55 | - 'orderby' => 'date', |
|
56 | - 'order' => 'DESC', |
|
57 | - 'post_type' => 'meal', |
|
58 | - 'post__in' => $connected_meals, |
|
59 | - ); |
|
60 | - $meals = new WP_Query( $args ); |
|
61 | - if ( $meals->have_posts() ) { |
|
62 | - while ( $meals->have_posts() ) { |
|
63 | - $meals->the_post(); |
|
64 | - $meal_id = get_the_ID(); |
|
29 | + // Looking for meals. |
|
30 | + if ( empty( $connected_meals ) ) { |
|
31 | + $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
32 | + |
|
33 | + if ( empty( $connected_meals ) ) { |
|
34 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | + if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
36 | + $connected_meals = $options['connected_meals']; |
|
37 | + if ( ! array( $connected_meals ) ) { |
|
38 | + $connected_meals = array( $connected_meals ); |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + // This is for the meal single template. |
|
45 | + if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | + $connected_meals = array( get_the_ID() ); |
|
47 | + } |
|
48 | + |
|
49 | + // The top part |
|
50 | + echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
51 | + |
|
52 | + if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
53 | + |
|
54 | + $args = array( |
|
55 | + 'orderby' => 'date', |
|
56 | + 'order' => 'DESC', |
|
57 | + 'post_type' => 'meal', |
|
58 | + 'post__in' => $connected_meals, |
|
59 | + ); |
|
60 | + $meals = new WP_Query( $args ); |
|
61 | + if ( $meals->have_posts() ) { |
|
62 | + while ( $meals->have_posts() ) { |
|
63 | + $meals->the_post(); |
|
64 | + $meal_id = get_the_ID(); |
|
65 | 65 | |
66 | 66 | |
67 | - // Breakfast. |
|
68 | - $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
69 | - $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
70 | - $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
67 | + // Breakfast. |
|
68 | + $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
69 | + $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
70 | + $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
71 | 71 | |
72 | - // Lunch. |
|
73 | - $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
74 | - $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
75 | - $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
72 | + // Lunch. |
|
73 | + $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
74 | + $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
75 | + $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
76 | 76 | |
77 | - // Dinner. |
|
78 | - $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
79 | - $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
80 | - $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
77 | + // Dinner. |
|
78 | + $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
79 | + $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
80 | + $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
81 | 81 | |
82 | - //Main Meals Title |
|
83 | - //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
|
84 | - ?> |
|
82 | + //Main Meals Title |
|
83 | + //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
|
84 | + ?> |
|
85 | 85 | <div class="row eating-row"> |
86 | 86 | <div class="col-md-4 eating-column"> |
87 | 87 | <?php |
88 | - if ( ! empty( $pre_breakfast_snack ) ) { |
|
89 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
90 | - echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
91 | - echo '</div>'; |
|
92 | - } |
|
93 | - if ( ! empty( $breakfast ) ) { |
|
94 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
95 | - echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
96 | - echo '</div>'; |
|
97 | - } |
|
98 | - if ( ! empty( $post_breakfast_snack ) ) { |
|
99 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
100 | - echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
101 | - echo '</div>'; |
|
102 | - } |
|
103 | - |
|
104 | - $args = array( |
|
105 | - 'meal_id' => $meal_id, |
|
106 | - 'meal_time' => 'breakfast', |
|
107 | - ); |
|
108 | - lsx_hp_meal_plan_recipes( $args ); |
|
109 | - ?> |
|
88 | + if ( ! empty( $pre_breakfast_snack ) ) { |
|
89 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
90 | + echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
91 | + echo '</div>'; |
|
92 | + } |
|
93 | + if ( ! empty( $breakfast ) ) { |
|
94 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
95 | + echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
96 | + echo '</div>'; |
|
97 | + } |
|
98 | + if ( ! empty( $post_breakfast_snack ) ) { |
|
99 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
100 | + echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
101 | + echo '</div>'; |
|
102 | + } |
|
103 | + |
|
104 | + $args = array( |
|
105 | + 'meal_id' => $meal_id, |
|
106 | + 'meal_time' => 'breakfast', |
|
107 | + ); |
|
108 | + lsx_hp_meal_plan_recipes( $args ); |
|
109 | + ?> |
|
110 | 110 | </div> |
111 | 111 | <div class="col-md-4 eating-column"> |
112 | 112 | <?php |
113 | - if ( ! empty( $pre_lunch_snack ) ) { |
|
114 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
115 | - echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
116 | - echo '</div>'; |
|
117 | - } |
|
118 | - if ( ! empty( $lunch ) ) { |
|
119 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
120 | - echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
121 | - echo '</div>'; |
|
122 | - } |
|
123 | - if ( ! empty( $post_lunch_snack ) ) { |
|
124 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
125 | - echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
126 | - echo '</div>'; |
|
127 | - } |
|
128 | - |
|
129 | - $args = array( |
|
130 | - 'meal_id' => $meal_id, |
|
131 | - 'meal_time' => 'lunch', |
|
132 | - ); |
|
133 | - lsx_hp_meal_plan_recipes( $args ); |
|
134 | - ?> |
|
113 | + if ( ! empty( $pre_lunch_snack ) ) { |
|
114 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
115 | + echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
116 | + echo '</div>'; |
|
117 | + } |
|
118 | + if ( ! empty( $lunch ) ) { |
|
119 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
120 | + echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
121 | + echo '</div>'; |
|
122 | + } |
|
123 | + if ( ! empty( $post_lunch_snack ) ) { |
|
124 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
125 | + echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
126 | + echo '</div>'; |
|
127 | + } |
|
128 | + |
|
129 | + $args = array( |
|
130 | + 'meal_id' => $meal_id, |
|
131 | + 'meal_time' => 'lunch', |
|
132 | + ); |
|
133 | + lsx_hp_meal_plan_recipes( $args ); |
|
134 | + ?> |
|
135 | 135 | </div> |
136 | 136 | <div class="col-md-4 eating-column"> |
137 | 137 | <?php |
138 | - if ( ! empty( $pre_dinner_snack ) ) { |
|
139 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
140 | - echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
141 | - echo '</div>'; |
|
142 | - } |
|
143 | - if ( ! empty( $dinner ) ) { |
|
144 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
145 | - echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
146 | - echo '</div>'; |
|
147 | - } |
|
148 | - if ( ! empty( $post_dinner_snack ) ) { |
|
149 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
150 | - echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
151 | - echo '</div>'; |
|
152 | - } |
|
153 | - |
|
154 | - $args = array( |
|
155 | - 'meal_id' => $meal_id, |
|
156 | - 'meal_time' => 'dinner', |
|
157 | - ); |
|
158 | - lsx_hp_meal_plan_recipes( $args ); |
|
159 | - ?> |
|
138 | + if ( ! empty( $pre_dinner_snack ) ) { |
|
139 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
140 | + echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
141 | + echo '</div>'; |
|
142 | + } |
|
143 | + if ( ! empty( $dinner ) ) { |
|
144 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
145 | + echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
146 | + echo '</div>'; |
|
147 | + } |
|
148 | + if ( ! empty( $post_dinner_snack ) ) { |
|
149 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
150 | + echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
151 | + echo '</div>'; |
|
152 | + } |
|
153 | + |
|
154 | + $args = array( |
|
155 | + 'meal_id' => $meal_id, |
|
156 | + 'meal_time' => 'dinner', |
|
157 | + ); |
|
158 | + lsx_hp_meal_plan_recipes( $args ); |
|
159 | + ?> |
|
160 | 160 | </div> |
161 | 161 | </div> |
162 | 162 | <?php |
163 | - } |
|
164 | - } |
|
165 | - } |
|
166 | - ?> |
|
163 | + } |
|
164 | + } |
|
165 | + } |
|
166 | + ?> |
|
167 | 167 | <?php wp_reset_postdata(); ?> |
168 | 168 | </div> |
169 | 169 | <?php |
@@ -6,19 +6,19 @@ discard block |
||
6 | 6 | */ |
7 | 7 | global $connected_meals, $shortcode_args; |
8 | 8 | |
9 | -if ( is_singular( 'plan' ) ) { |
|
10 | - $section_key = get_query_var( 'section' ); |
|
11 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | - if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | - $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
9 | +if (is_singular('plan')) { |
|
10 | + $section_key = get_query_var('section'); |
|
11 | + if ('' !== $section_key && \lsx_health_plan\functions\plan\has_sections()) { |
|
12 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
13 | + if (isset($section_info['connected_meals']) && '' !== $section_info['connected_meals']) { |
|
14 | + $connected_meals = \lsx_health_plan\functions\prep_array($section_info['connected_meals']); |
|
15 | 15 | } |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Check for any shortcode overrides. |
20 | -if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
|
21 | - $connected_meals = array( get_the_ID() ); |
|
20 | +if (null !== $shortcode_args && isset($shortcode_args['include'])) { |
|
21 | + $connected_meals = array(get_the_ID()); |
|
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | |
@@ -27,57 +27,57 @@ discard block |
||
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Looking for meals. |
30 | - if ( empty( $connected_meals ) ) { |
|
31 | - $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
30 | + if (empty($connected_meals)) { |
|
31 | + $connected_meals = get_post_meta(get_the_ID(), 'connected_meals', true); |
|
32 | 32 | |
33 | - if ( empty( $connected_meals ) ) { |
|
34 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | - if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
33 | + if (empty($connected_meals)) { |
|
34 | + $options = \lsx_health_plan\functions\get_option('all'); |
|
35 | + if (isset($options['connected_meals']) && '' !== $options['connected_meals'] && ! empty($options['connected_meals'])) { |
|
36 | 36 | $connected_meals = $options['connected_meals']; |
37 | - if ( ! array( $connected_meals ) ) { |
|
38 | - $connected_meals = array( $connected_meals ); |
|
37 | + if ( ! array($connected_meals)) { |
|
38 | + $connected_meals = array($connected_meals); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | // This is for the meal single template. |
45 | - if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | - $connected_meals = array( get_the_ID() ); |
|
45 | + if (is_single() && is_singular('meal')) { |
|
46 | + $connected_meals = array(get_the_ID()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // The top part |
50 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
50 | + echo wp_kses_post(wp_kses_post(lsx_health_plan_meal_main_content())); |
|
51 | 51 | |
52 | - if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
52 | + if (false !== $connected_meals && '' !== $connected_meals && ! empty($connected_meals)) { |
|
53 | 53 | |
54 | - $args = array( |
|
54 | + $args = array( |
|
55 | 55 | 'orderby' => 'date', |
56 | 56 | 'order' => 'DESC', |
57 | 57 | 'post_type' => 'meal', |
58 | 58 | 'post__in' => $connected_meals, |
59 | 59 | ); |
60 | - $meals = new WP_Query( $args ); |
|
61 | - if ( $meals->have_posts() ) { |
|
62 | - while ( $meals->have_posts() ) { |
|
60 | + $meals = new WP_Query($args); |
|
61 | + if ($meals->have_posts()) { |
|
62 | + while ($meals->have_posts()) { |
|
63 | 63 | $meals->the_post(); |
64 | - $meal_id = get_the_ID(); |
|
64 | + $meal_id = get_the_ID(); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | // Breakfast. |
68 | - $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
69 | - $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
70 | - $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
68 | + $pre_breakfast_snack = get_post_meta(get_the_ID(), 'meal_pre_breakfast_snack', true); |
|
69 | + $breakfast = get_post_meta(get_the_ID(), 'meal_breakfast', true); |
|
70 | + $post_breakfast_snack = get_post_meta(get_the_ID(), 'meal_breakfast_snack', true); |
|
71 | 71 | |
72 | 72 | // Lunch. |
73 | - $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
74 | - $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
75 | - $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
73 | + $pre_lunch_snack = get_post_meta(get_the_ID(), 'meal_pre_lunch_snack', true); |
|
74 | + $lunch = get_post_meta(get_the_ID(), 'meal_lunch', true); |
|
75 | + $post_lunch_snack = get_post_meta(get_the_ID(), 'meal_lunch_snack', true); |
|
76 | 76 | |
77 | 77 | // Dinner. |
78 | - $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
79 | - $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
80 | - $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
78 | + $pre_dinner_snack = get_post_meta(get_the_ID(), 'meal_pre_dinner_snack', true); |
|
79 | + $dinner = get_post_meta(get_the_ID(), 'meal_dinner', true); |
|
80 | + $post_dinner_snack = get_post_meta(get_the_ID(), 'meal_dinner_snack', true); |
|
81 | 81 | |
82 | 82 | //Main Meals Title |
83 | 83 | //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | <div class="row eating-row"> |
86 | 86 | <div class="col-md-4 eating-column"> |
87 | 87 | <?php |
88 | - if ( ! empty( $pre_breakfast_snack ) ) { |
|
89 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
90 | - echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
88 | + if ( ! empty($pre_breakfast_snack)) { |
|
89 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
90 | + echo wp_kses_post(apply_filters('the_content', $pre_breakfast_snack)); |
|
91 | 91 | echo '</div>'; |
92 | 92 | } |
93 | - if ( ! empty( $breakfast ) ) { |
|
94 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
95 | - echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
93 | + if ( ! empty($breakfast)) { |
|
94 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__('Breakfast', 'lsx-health-plan') . '</h3>'; |
|
95 | + echo wp_kses_post(apply_filters('the_content', $breakfast)); |
|
96 | 96 | echo '</div>'; |
97 | 97 | } |
98 | - if ( ! empty( $post_breakfast_snack ) ) { |
|
99 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
100 | - echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
98 | + if ( ! empty($post_breakfast_snack)) { |
|
99 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
100 | + echo wp_kses_post(apply_filters('the_content', $post_breakfast_snack)); |
|
101 | 101 | echo '</div>'; |
102 | 102 | } |
103 | 103 | |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | 'meal_id' => $meal_id, |
106 | 106 | 'meal_time' => 'breakfast', |
107 | 107 | ); |
108 | - lsx_hp_meal_plan_recipes( $args ); |
|
108 | + lsx_hp_meal_plan_recipes($args); |
|
109 | 109 | ?> |
110 | 110 | </div> |
111 | 111 | <div class="col-md-4 eating-column"> |
112 | 112 | <?php |
113 | - if ( ! empty( $pre_lunch_snack ) ) { |
|
114 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
115 | - echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
113 | + if ( ! empty($pre_lunch_snack)) { |
|
114 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
115 | + echo wp_kses_post(apply_filters('the_content', $pre_lunch_snack)); |
|
116 | 116 | echo '</div>'; |
117 | 117 | } |
118 | - if ( ! empty( $lunch ) ) { |
|
119 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
120 | - echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
118 | + if ( ! empty($lunch)) { |
|
119 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__('Lunch', 'lsx-health-plan') . '</h3>'; |
|
120 | + echo wp_kses_post(apply_filters('the_content', $lunch)); |
|
121 | 121 | echo '</div>'; |
122 | 122 | } |
123 | - if ( ! empty( $post_lunch_snack ) ) { |
|
124 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
125 | - echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
123 | + if ( ! empty($post_lunch_snack)) { |
|
124 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
125 | + echo wp_kses_post(apply_filters('the_content', $post_lunch_snack)); |
|
126 | 126 | echo '</div>'; |
127 | 127 | } |
128 | 128 | |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | 'meal_id' => $meal_id, |
131 | 131 | 'meal_time' => 'lunch', |
132 | 132 | ); |
133 | - lsx_hp_meal_plan_recipes( $args ); |
|
133 | + lsx_hp_meal_plan_recipes($args); |
|
134 | 134 | ?> |
135 | 135 | </div> |
136 | 136 | <div class="col-md-4 eating-column"> |
137 | 137 | <?php |
138 | - if ( ! empty( $pre_dinner_snack ) ) { |
|
139 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
140 | - echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
138 | + if ( ! empty($pre_dinner_snack)) { |
|
139 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
140 | + echo wp_kses_post(apply_filters('the_content', $pre_dinner_snack)); |
|
141 | 141 | echo '</div>'; |
142 | 142 | } |
143 | - if ( ! empty( $dinner ) ) { |
|
144 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
145 | - echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
143 | + if ( ! empty($dinner)) { |
|
144 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__('Dinner', 'lsx-health-plan') . '</h3>'; |
|
145 | + echo wp_kses_post(apply_filters('the_content', $dinner)); |
|
146 | 146 | echo '</div>'; |
147 | 147 | } |
148 | - if ( ! empty( $post_dinner_snack ) ) { |
|
149 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
150 | - echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
148 | + if ( ! empty($post_dinner_snack)) { |
|
149 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
150 | + echo wp_kses_post(apply_filters('the_content', $post_dinner_snack)); |
|
151 | 151 | echo '</div>'; |
152 | 152 | } |
153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'meal_id' => $meal_id, |
156 | 156 | 'meal_time' => 'dinner', |
157 | 157 | ); |
158 | - lsx_hp_meal_plan_recipes( $args ); |
|
158 | + lsx_hp_meal_plan_recipes($args); |
|
159 | 159 | ?> |
160 | 160 | </div> |
161 | 161 | </div> |
@@ -38,9 +38,12 @@ |
||
38 | 38 | |
39 | 39 | <?php endwhile; ?> |
40 | 40 | |
41 | - <?php else : ?> |
|
41 | + <?php else { |
|
42 | + : ?> |
|
42 | 43 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
44 | + <?php get_template_part( 'partials/content', 'none' ); |
|
45 | +} |
|
46 | +?> |
|
44 | 47 | |
45 | 48 | <?php endif; ?> |
46 | 49 | </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 ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
24 | - ?> |
|
23 | + if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
24 | + ?> |
|
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | <div class="row"> |
31 | 31 | <?php if ( have_posts() ) : ?> |
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
34 | - the_post(); |
|
35 | - ?> |
|
33 | + while ( have_posts() ) : |
|
34 | + the_post(); |
|
35 | + ?> |
|
36 | 36 | |
37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-meal.php'; ?> |
38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | </main><!-- #main --> |
52 | 52 | |
53 | 53 | <?php |
54 | - } else { |
|
55 | - wp_redirect( $redirect ); |
|
56 | - exit; |
|
57 | - } |
|
58 | - ?> |
|
54 | + } else { |
|
55 | + wp_redirect( $redirect ); |
|
56 | + exit; |
|
57 | + } |
|
58 | + ?> |
|
59 | 59 | |
60 | 60 | <?php lsx_content_after(); ?> |
61 | 61 |
@@ -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 ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
23 | + if (current_user_can('administrator', $page_id) || 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 | ?> |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | <?php } ?> |
23 | 23 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
24 | 24 | <?php |
25 | - $featured_image = get_the_post_thumbnail(); |
|
26 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
27 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
28 | - 'class' => 'aligncenter', |
|
29 | - ) ); |
|
30 | - } else { |
|
31 | - ?> |
|
25 | + $featured_image = get_the_post_thumbnail(); |
|
26 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
27 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
28 | + 'class' => 'aligncenter', |
|
29 | + ) ); |
|
30 | + } else { |
|
31 | + ?> |
|
32 | 32 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
33 | 33 | <?php |
34 | - } |
|
35 | - ?> |
|
34 | + } |
|
35 | + ?> |
|
36 | 36 | </a> |
37 | 37 | </div> |
38 | 38 | <div class="content-box meal-content-box white-bg"> |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | <?php the_title( '<h3 class="meal-title">', '</h3>' ); ?> |
41 | 41 | </a> |
42 | 42 | <?php |
43 | - if ( ! has_excerpt() ) { |
|
44 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
45 | - $content = '<p>' . $content . '</p>'; |
|
46 | - } else { |
|
47 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
48 | - } |
|
49 | - echo wp_kses_post( $content ); |
|
50 | - ?> |
|
43 | + if ( ! has_excerpt() ) { |
|
44 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
45 | + $content = '<p>' . $content . '</p>'; |
|
46 | + } else { |
|
47 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
48 | + } |
|
49 | + echo wp_kses_post( $content ); |
|
50 | + ?> |
|
51 | 51 | <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See meal', 'lsx-health-plan' ); ?></a> |
52 | 52 | </div> |
53 | 53 | <?php lsx_entry_bottom(); ?> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package lsx-health-plan |
6 | 6 | */ |
7 | 7 | |
8 | -$featured = get_post_meta( get_the_ID(), 'meal_featured_meal', true ); |
|
8 | +$featured = get_post_meta(get_the_ID(), 'meal_featured_meal', true); |
|
9 | 9 | ?> |
10 | 10 | |
11 | 11 | <?php lsx_entry_before(); ?> |
@@ -17,38 +17,38 @@ discard block |
||
17 | 17 | <?php lsx_hp_exercise_plan_meta(); ?> |
18 | 18 | |
19 | 19 | <div class="meal-feature-img"> |
20 | - <?php if ( $featured ) { ?> |
|
21 | - <span class="featured-meal"><?php lsx_get_svg_icon( 'icon-featured.svg' ); ?></span> |
|
20 | + <?php if ($featured) { ?> |
|
21 | + <span class="featured-meal"><?php lsx_get_svg_icon('icon-featured.svg'); ?></span> |
|
22 | 22 | <?php } ?> |
23 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
23 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
24 | 24 | <?php |
25 | 25 | $featured_image = get_the_post_thumbnail(); |
26 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
27 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
26 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
27 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
28 | 28 | 'class' => 'aligncenter', |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | } else { |
31 | 31 | ?> |
32 | - <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
32 | + <img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
33 | 33 | <?php |
34 | 34 | } |
35 | 35 | ?> |
36 | 36 | </a> |
37 | 37 | </div> |
38 | 38 | <div class="content-box meal-content-box white-bg"> |
39 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
40 | - <?php the_title( '<h3 class="meal-title">', '</h3>' ); ?> |
|
39 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
40 | + <?php the_title('<h3 class="meal-title">', '</h3>'); ?> |
|
41 | 41 | </a> |
42 | 42 | <?php |
43 | - if ( ! has_excerpt() ) { |
|
44 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
43 | + if ( ! has_excerpt()) { |
|
44 | + $content = wp_trim_words(get_the_content(), 20); |
|
45 | 45 | $content = '<p>' . $content . '</p>'; |
46 | 46 | } else { |
47 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
47 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
48 | 48 | } |
49 | - echo wp_kses_post( $content ); |
|
49 | + echo wp_kses_post($content); |
|
50 | 50 | ?> |
51 | - <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See meal', 'lsx-health-plan' ); ?></a> |
|
51 | + <a href="<?php echo esc_url(get_permalink()); ?>" class="btn border-btn"><?php esc_html_e('See meal', 'lsx-health-plan'); ?></a> |
|
52 | 52 | </div> |
53 | 53 | <?php lsx_entry_bottom(); ?> |
54 | 54 | </article> |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * Constructor |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
34 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
33 | + add_action('init', array($this, 'register_post_type')); |
|
34 | + add_action('init', array($this, 'taxonomy_setup')); |
|
35 | 35 | |
36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
37 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
36 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
37 | + add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5); |
|
38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
39 | 39 | |
40 | 40 | // Template Redirects. |
41 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
42 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
41 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
42 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
43 | 43 | |
44 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
44 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public static function get_instance() { |
55 | 55 | // If the single instance hasn't been set, set it now. |
56 | - if ( null === self::$instance ) { |
|
56 | + if (null === self::$instance) { |
|
57 | 57 | self::$instance = new self(); |
58 | 58 | } |
59 | 59 | return self::$instance; |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function register_post_type() { |
65 | 65 | $labels = array( |
66 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
67 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
68 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
69 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
70 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
71 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
72 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
73 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
74 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
75 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
76 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
66 | + 'name' => esc_html__('Meals', 'lsx-health-plan'), |
|
67 | + 'singular_name' => esc_html__('Meal', 'lsx-health-plan'), |
|
68 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
69 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
70 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
71 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
72 | + 'all_items' => esc_html__('All Meals', 'lsx-health-plan'), |
|
73 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
74 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
75 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
76 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
77 | 77 | 'parent_item_colon' => '', |
78 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
78 | + 'menu_name' => esc_html__('Meals', 'lsx-health-plan'), |
|
79 | 79 | ); |
80 | - $args = array( |
|
80 | + $args = array( |
|
81 | 81 | 'labels' => $labels, |
82 | 82 | 'public' => true, |
83 | 83 | 'publicly_queryable' => true, |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | 'menu_icon' => 'dashicons-carrot', |
88 | 88 | 'query_var' => true, |
89 | 89 | 'rewrite' => array( |
90 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
90 | + 'slug' => \lsx_health_plan\functions\get_option('meal_single_slug', 'meal'), |
|
91 | 91 | ), |
92 | 92 | 'capability_type' => 'post', |
93 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
93 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'), |
|
94 | 94 | 'hierarchical' => true, |
95 | 95 | 'menu_position' => null, |
96 | 96 | 'supports' => array( |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'custom-fields', |
102 | 102 | ), |
103 | 103 | ); |
104 | - register_post_type( 'meal', $args ); |
|
104 | + register_post_type('meal', $args); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function taxonomy_setup() { |
111 | 111 | $labels = array( |
112 | - 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
113 | - 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
114 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
115 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
116 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
117 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
118 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
119 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
120 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
121 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
122 | - 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
112 | + 'name' => esc_html_x('Meal Type', 'taxonomy general name', 'lsx-health-plan'), |
|
113 | + 'singular_name' => esc_html_x('Meal Types', 'taxonomy singular name', 'lsx-health-plan'), |
|
114 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
115 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
116 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
117 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
118 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
119 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
120 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
121 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
122 | + 'menu_name' => esc_html__('Meal Types', 'lsx-health-plan'), |
|
123 | 123 | ); |
124 | - $args = array( |
|
124 | + $args = array( |
|
125 | 125 | 'hierarchical' => true, |
126 | 126 | 'labels' => $labels, |
127 | 127 | 'show_ui' => true, |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 'slug' => 'meal-type', |
133 | 133 | ), |
134 | 134 | ); |
135 | - register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
135 | + register_taxonomy('meal-type', array($this->slug), $args); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param array $post_types |
142 | 142 | * @return array |
143 | 143 | */ |
144 | - public function enable_post_type( $post_types = array() ) { |
|
144 | + public function enable_post_type($post_types = array()) { |
|
145 | 145 | $post_types[] = $this->slug; |
146 | 146 | return $post_types; |
147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param array $connections |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public function enable_connections( $connections = array() ) { |
|
155 | + public function enable_connections($connections = array()) { |
|
156 | 156 | $connections['meal']['connected_plans'] = 'connected_meals'; |
157 | 157 | $connections['plan']['connected_meals'] = 'connected_plans'; |
158 | 158 | return $connections; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @param string $title the term title. |
165 | 165 | * @return string |
166 | 166 | */ |
167 | - public function get_the_archive_title( $title ) { |
|
168 | - if ( is_post_type_archive( 'meal' ) ) { |
|
169 | - $title = __( 'Meals', 'lsx-health-plan' ); |
|
167 | + public function get_the_archive_title($title) { |
|
168 | + if (is_post_type_archive('meal')) { |
|
169 | + $title = __('Meals', 'lsx-health-plan'); |
|
170 | 170 | } |
171 | 171 | return $title; |
172 | 172 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | $cmb = new_cmb2_box( |
179 | 179 | array( |
180 | 180 | 'id' => $this->slug . '_featured_metabox_meal', |
181 | - 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
182 | - 'object_types' => array( $this->slug ), // Post type |
|
181 | + 'title' => __('Featured Meal', 'lsx-health-plan'), |
|
182 | + 'object_types' => array($this->slug), // Post type |
|
183 | 183 | 'context' => 'side', |
184 | 184 | 'priority' => 'high', |
185 | 185 | 'show_names' => true, |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | ); |
188 | 188 | $cmb->add_field( |
189 | 189 | array( |
190 | - 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
191 | - 'desc' => __( 'Enable a featured meal' ), |
|
190 | + 'name' => __('Featured Meal', 'lsx-health-plan'), |
|
191 | + 'desc' => __('Enable a featured meal'), |
|
192 | 192 | 'id' => $this->slug . '_featured_meal', |
193 | 193 | 'type' => 'checkbox', |
194 | 194 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -200,66 +200,66 @@ discard block |
||
200 | 200 | * Define the metabox and field configurations. |
201 | 201 | */ |
202 | 202 | public function details_metaboxes() { |
203 | - $cmb = new_cmb2_box( array( |
|
203 | + $cmb = new_cmb2_box(array( |
|
204 | 204 | 'id' => $this->slug . '_shopping_list_metabox', |
205 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
206 | - 'object_types' => array( $this->slug ), // Post type |
|
205 | + 'title' => __('Shopping List', 'lsx-health-plan'), |
|
206 | + 'object_types' => array($this->slug), // Post type |
|
207 | 207 | 'context' => 'normal', |
208 | 208 | 'priority' => 'high', |
209 | 209 | 'show_names' => true, |
210 | - ) ); |
|
211 | - $cmb->add_field( array( |
|
212 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
213 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
210 | + )); |
|
211 | + $cmb->add_field(array( |
|
212 | + 'name' => __('Shopping List', 'lsx-health-plan'), |
|
213 | + 'desc' => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'), |
|
214 | 214 | 'id' => $this->slug . '_shopping_list', |
215 | 215 | 'type' => 'post_search_ajax', |
216 | 216 | // Optional : |
217 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
217 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
218 | 218 | 'sortable' => true, // Allow selected items to be sortable (default false) |
219 | 219 | 'query_args' => array( |
220 | - 'post_type' => array( 'page' ), |
|
221 | - 'post_status' => array( 'publish' ), |
|
220 | + 'post_type' => array('page'), |
|
221 | + 'post_status' => array('publish'), |
|
222 | 222 | 'posts_per_page' => -1, |
223 | 223 | ), |
224 | - ) ); |
|
225 | - $cmb = new_cmb2_box( array( |
|
224 | + )); |
|
225 | + $cmb = new_cmb2_box(array( |
|
226 | 226 | 'id' => $this->slug . '_details_metabox', |
227 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
228 | - 'object_types' => array( $this->slug ), // Post type |
|
227 | + 'title' => __('Meal Details', 'lsx-health-plan'), |
|
228 | + 'object_types' => array($this->slug), // Post type |
|
229 | 229 | 'context' => 'normal', |
230 | 230 | 'priority' => 'high', |
231 | 231 | 'show_names' => true, |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | |
234 | - $cmb->add_field( array( |
|
235 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
234 | + $cmb->add_field(array( |
|
235 | + 'name' => __('Meal Short Description', 'lsx-health-plan'), |
|
236 | 236 | 'id' => $this->slug . '_short_description', |
237 | 237 | 'type' => 'textarea_small', |
238 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
239 | - ) ); |
|
238 | + 'desc' => __('Add a small description for this meal (optional)', 'lsx-health-plan'), |
|
239 | + )); |
|
240 | 240 | |
241 | - $cmb->add_field( array( |
|
242 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
241 | + $cmb->add_field(array( |
|
242 | + 'name' => __('Pre Breakfast Snack', 'lsx-health-plan'), |
|
243 | 243 | 'id' => $this->slug . '_pre_breakfast_snack', |
244 | 244 | 'type' => 'wysiwyg', |
245 | 245 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
246 | 246 | 'options' => array( |
247 | 247 | 'textarea_rows' => 5, |
248 | 248 | ), |
249 | - ) ); |
|
250 | - $cmb->add_field( array( |
|
251 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
249 | + )); |
|
250 | + $cmb->add_field(array( |
|
251 | + 'name' => __('Breakfast', 'lsx-health-plan'), |
|
252 | 252 | 'id' => $this->slug . '_breakfast', |
253 | 253 | 'type' => 'wysiwyg', |
254 | 254 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
255 | 255 | 'options' => array( |
256 | 256 | 'textarea_rows' => 5, |
257 | 257 | ), |
258 | - ) ); |
|
258 | + )); |
|
259 | 259 | |
260 | 260 | $cmb->add_field( |
261 | 261 | array( |
262 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
262 | + 'name' => __('Post Breakfast Snack', 'lsx-health-plan'), |
|
263 | 263 | 'id' => $this->slug . '_breakfast_snack', |
264 | 264 | 'type' => 'wysiwyg', |
265 | 265 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -269,19 +269,19 @@ discard block |
||
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | |
272 | - if ( post_type_exists( 'recipe' ) ) { |
|
272 | + if (post_type_exists('recipe')) { |
|
273 | 273 | $cmb->add_field( |
274 | 274 | array( |
275 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
276 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
275 | + 'name' => __('Breakfast Recipes', 'lsx-health-plan'), |
|
276 | + 'desc' => __('Connect additional recipes options for breakfast.', 'lsx-health-plan'), |
|
277 | 277 | 'id' => 'breakfast_recipes', |
278 | 278 | 'type' => 'post_search_ajax', |
279 | 279 | // Optional : |
280 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
280 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
281 | 281 | 'sortable' => true, // Allow selected items to be sortable (default false) |
282 | 282 | 'query_args' => array( |
283 | - 'post_type' => array( 'recipe' ), |
|
284 | - 'post_status' => array( 'publish' ), |
|
283 | + 'post_type' => array('recipe'), |
|
284 | + 'post_status' => array('publish'), |
|
285 | 285 | 'posts_per_page' => -1, |
286 | 286 | ), |
287 | 287 | ) |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | $cmb->add_field( |
292 | 292 | array( |
293 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
293 | + 'name' => __('Pre Lunch Snack', 'lsx-health-plan'), |
|
294 | 294 | 'id' => $this->slug . '_pre_lunch_snack', |
295 | 295 | 'type' => 'wysiwyg', |
296 | 296 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | ); |
302 | 302 | $cmb->add_field( |
303 | 303 | array( |
304 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
304 | + 'name' => __('Lunch', 'lsx-health-plan'), |
|
305 | 305 | 'id' => $this->slug . '_lunch', |
306 | 306 | 'type' => 'wysiwyg', |
307 | 307 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | ); |
313 | 313 | $cmb->add_field( |
314 | 314 | array( |
315 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
315 | + 'name' => __('Post Lunch Snack', 'lsx-health-plan'), |
|
316 | 316 | 'id' => $this->slug . '_lunch_snack', |
317 | 317 | 'type' => 'wysiwyg', |
318 | 318 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -322,19 +322,19 @@ discard block |
||
322 | 322 | ) |
323 | 323 | ); |
324 | 324 | |
325 | - if ( post_type_exists( 'recipe' ) ) { |
|
325 | + if (post_type_exists('recipe')) { |
|
326 | 326 | $cmb->add_field( |
327 | 327 | array( |
328 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
329 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
328 | + 'name' => __('Lunch Recipes', 'lsx-health-plan'), |
|
329 | + 'desc' => __('Connect additional recipes options for lunch.', 'lsx-health-plan'), |
|
330 | 330 | 'id' => 'lunch_recipes', |
331 | 331 | 'type' => 'post_search_ajax', |
332 | 332 | // Optional : |
333 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
333 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
334 | 334 | 'sortable' => true, // Allow selected items to be sortable (default false) |
335 | 335 | 'query_args' => array( |
336 | - 'post_type' => array( 'recipe' ), |
|
337 | - 'post_status' => array( 'publish' ), |
|
336 | + 'post_type' => array('recipe'), |
|
337 | + 'post_status' => array('publish'), |
|
338 | 338 | 'posts_per_page' => -1, |
339 | 339 | ), |
340 | 340 | ) |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | $cmb->add_field( |
345 | 345 | array( |
346 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
346 | + 'name' => __('Pre Dinner Snack', 'lsx-health-plan'), |
|
347 | 347 | 'id' => $this->slug . '_pre_dinner_snack', |
348 | 348 | 'type' => 'wysiwyg', |
349 | 349 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | ); |
355 | 355 | $cmb->add_field( |
356 | 356 | array( |
357 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
357 | + 'name' => __('Dinner', 'lsx-health-plan'), |
|
358 | 358 | 'id' => $this->slug . '_dinner', |
359 | 359 | 'type' => 'wysiwyg', |
360 | 360 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | ); |
366 | 366 | $cmb->add_field( |
367 | 367 | array( |
368 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
368 | + 'name' => __('Post Dinner Snack', 'lsx-health-plan'), |
|
369 | 369 | 'id' => $this->slug . '_dinner_snack', |
370 | 370 | 'type' => 'wysiwyg', |
371 | 371 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -375,19 +375,19 @@ discard block |
||
375 | 375 | ) |
376 | 376 | ); |
377 | 377 | |
378 | - if ( post_type_exists( 'recipe' ) ) { |
|
378 | + if (post_type_exists('recipe')) { |
|
379 | 379 | $cmb->add_field( |
380 | 380 | array( |
381 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
382 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
381 | + 'name' => __('Dinner Recipes', 'lsx-health-plan'), |
|
382 | + 'desc' => __('Connect additional recipes options for dinner.', 'lsx-health-plan'), |
|
383 | 383 | 'id' => 'dinner_recipes', |
384 | 384 | 'type' => 'post_search_ajax', |
385 | 385 | // Optional : |
386 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
386 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
387 | 387 | 'sortable' => true, // Allow selected items to be sortable (default false) |
388 | 388 | 'query_args' => array( |
389 | - 'post_type' => array( 'recipe' ), |
|
390 | - 'post_status' => array( 'publish' ), |
|
389 | + 'post_type' => array('recipe'), |
|
390 | + 'post_status' => array('publish'), |
|
391 | 391 | 'posts_per_page' => -1, |
392 | 392 | ), |
393 | 393 | ) |
@@ -8,390 +8,390 @@ |
||
8 | 8 | */ |
9 | 9 | class Meal { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Meal() |
|
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\Meal() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds post_type slug used as an index |
|
22 | - * |
|
23 | - * @since 1.0.0 |
|
24 | - * |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - public $slug = 'meal'; |
|
20 | + /** |
|
21 | + * Holds post_type slug used as an index |
|
22 | + * |
|
23 | + * @since 1.0.0 |
|
24 | + * |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + public $slug = 'meal'; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Constructor |
|
31 | - */ |
|
32 | - public function __construct() { |
|
33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
34 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
29 | + /** |
|
30 | + * Constructor |
|
31 | + */ |
|
32 | + public function __construct() { |
|
33 | + add_action( 'init', array( $this, 'register_post_type' ) ); |
|
34 | + add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
35 | 35 | |
36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
37 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
36 | + add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
37 | + add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
38 | + add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
39 | 39 | |
40 | - // Template Redirects. |
|
41 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
42 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
40 | + // Template Redirects. |
|
41 | + add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
42 | + add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
43 | 43 | |
44 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
45 | - } |
|
44 | + add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Return an instance of this class. |
|
49 | - * |
|
50 | - * @since 1.0.0 |
|
51 | - * |
|
52 | - * @return object \lsx_health_plan\classes\Day() A single instance of this class. |
|
53 | - */ |
|
54 | - public static function get_instance() { |
|
55 | - // If the single instance hasn't been set, set it now. |
|
56 | - if ( null === self::$instance ) { |
|
57 | - self::$instance = new self(); |
|
58 | - } |
|
59 | - return self::$instance; |
|
60 | - } |
|
61 | - /** |
|
62 | - * Register the post type. |
|
63 | - */ |
|
64 | - public function register_post_type() { |
|
65 | - $labels = array( |
|
66 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
67 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
68 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
69 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
70 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
71 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
72 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
73 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
74 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
75 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
76 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
77 | - 'parent_item_colon' => '', |
|
78 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
79 | - ); |
|
80 | - $args = array( |
|
81 | - 'labels' => $labels, |
|
82 | - 'public' => true, |
|
83 | - 'publicly_queryable' => true, |
|
84 | - 'show_ui' => true, |
|
85 | - 'show_in_menu' => true, |
|
86 | - 'show_in_rest' => true, |
|
87 | - 'menu_icon' => 'dashicons-carrot', |
|
88 | - 'query_var' => true, |
|
89 | - 'rewrite' => array( |
|
90 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
91 | - ), |
|
92 | - 'capability_type' => 'post', |
|
93 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
94 | - 'hierarchical' => true, |
|
95 | - 'menu_position' => null, |
|
96 | - 'supports' => array( |
|
97 | - 'title', |
|
98 | - 'editor', |
|
99 | - 'thumbnail', |
|
100 | - 'page-attributes', |
|
101 | - 'custom-fields', |
|
102 | - ), |
|
103 | - ); |
|
104 | - register_post_type( 'meal', $args ); |
|
105 | - } |
|
47 | + /** |
|
48 | + * Return an instance of this class. |
|
49 | + * |
|
50 | + * @since 1.0.0 |
|
51 | + * |
|
52 | + * @return object \lsx_health_plan\classes\Day() A single instance of this class. |
|
53 | + */ |
|
54 | + public static function get_instance() { |
|
55 | + // If the single instance hasn't been set, set it now. |
|
56 | + if ( null === self::$instance ) { |
|
57 | + self::$instance = new self(); |
|
58 | + } |
|
59 | + return self::$instance; |
|
60 | + } |
|
61 | + /** |
|
62 | + * Register the post type. |
|
63 | + */ |
|
64 | + public function register_post_type() { |
|
65 | + $labels = array( |
|
66 | + 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
67 | + 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
68 | + 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
69 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
70 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
71 | + 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
72 | + 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
73 | + 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
74 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
75 | + 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
76 | + 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
77 | + 'parent_item_colon' => '', |
|
78 | + 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
79 | + ); |
|
80 | + $args = array( |
|
81 | + 'labels' => $labels, |
|
82 | + 'public' => true, |
|
83 | + 'publicly_queryable' => true, |
|
84 | + 'show_ui' => true, |
|
85 | + 'show_in_menu' => true, |
|
86 | + 'show_in_rest' => true, |
|
87 | + 'menu_icon' => 'dashicons-carrot', |
|
88 | + 'query_var' => true, |
|
89 | + 'rewrite' => array( |
|
90 | + 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
91 | + ), |
|
92 | + 'capability_type' => 'post', |
|
93 | + 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
94 | + 'hierarchical' => true, |
|
95 | + 'menu_position' => null, |
|
96 | + 'supports' => array( |
|
97 | + 'title', |
|
98 | + 'editor', |
|
99 | + 'thumbnail', |
|
100 | + 'page-attributes', |
|
101 | + 'custom-fields', |
|
102 | + ), |
|
103 | + ); |
|
104 | + register_post_type( 'meal', $args ); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Register the Meal Type taxonomy. |
|
109 | - */ |
|
110 | - public function taxonomy_setup() { |
|
111 | - $labels = array( |
|
112 | - 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
113 | - 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
114 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
115 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
116 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
117 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
118 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
119 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
120 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
121 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
122 | - 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
123 | - ); |
|
124 | - $args = array( |
|
125 | - 'hierarchical' => true, |
|
126 | - 'labels' => $labels, |
|
127 | - 'show_ui' => true, |
|
128 | - 'show_in_menu' => 'edit.php?post_type=meal', |
|
129 | - 'show_admin_column' => true, |
|
130 | - 'query_var' => true, |
|
131 | - 'rewrite' => array( |
|
132 | - 'slug' => 'meal-type', |
|
133 | - ), |
|
134 | - ); |
|
135 | - register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
136 | - } |
|
107 | + /** |
|
108 | + * Register the Meal Type taxonomy. |
|
109 | + */ |
|
110 | + public function taxonomy_setup() { |
|
111 | + $labels = array( |
|
112 | + 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
113 | + 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
114 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
115 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
116 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
117 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
118 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
119 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
120 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
121 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
122 | + 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
123 | + ); |
|
124 | + $args = array( |
|
125 | + 'hierarchical' => true, |
|
126 | + 'labels' => $labels, |
|
127 | + 'show_ui' => true, |
|
128 | + 'show_in_menu' => 'edit.php?post_type=meal', |
|
129 | + 'show_admin_column' => true, |
|
130 | + 'query_var' => true, |
|
131 | + 'rewrite' => array( |
|
132 | + 'slug' => 'meal-type', |
|
133 | + ), |
|
134 | + ); |
|
135 | + register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
136 | + } |
|
137 | 137 | |
138 | - /** |
|
139 | - * Adds the post type to the different arrays. |
|
140 | - * |
|
141 | - * @param array $post_types |
|
142 | - * @return array |
|
143 | - */ |
|
144 | - public function enable_post_type( $post_types = array() ) { |
|
145 | - $post_types[] = $this->slug; |
|
146 | - return $post_types; |
|
147 | - } |
|
138 | + /** |
|
139 | + * Adds the post type to the different arrays. |
|
140 | + * |
|
141 | + * @param array $post_types |
|
142 | + * @return array |
|
143 | + */ |
|
144 | + public function enable_post_type( $post_types = array() ) { |
|
145 | + $post_types[] = $this->slug; |
|
146 | + return $post_types; |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * Enables the Bi Directional relationships |
|
151 | - * |
|
152 | - * @param array $connections |
|
153 | - * @return void |
|
154 | - */ |
|
155 | - public function enable_connections( $connections = array() ) { |
|
156 | - $connections['meal']['connected_plans'] = 'connected_meals'; |
|
157 | - $connections['plan']['connected_meals'] = 'connected_plans'; |
|
158 | - return $connections; |
|
159 | - } |
|
149 | + /** |
|
150 | + * Enables the Bi Directional relationships |
|
151 | + * |
|
152 | + * @param array $connections |
|
153 | + * @return void |
|
154 | + */ |
|
155 | + public function enable_connections( $connections = array() ) { |
|
156 | + $connections['meal']['connected_plans'] = 'connected_meals'; |
|
157 | + $connections['plan']['connected_meals'] = 'connected_plans'; |
|
158 | + return $connections; |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
162 | - * Remove the "Archives:" from the post type meal. |
|
163 | - * |
|
164 | - * @param string $title the term title. |
|
165 | - * @return string |
|
166 | - */ |
|
167 | - public function get_the_archive_title( $title ) { |
|
168 | - if ( is_post_type_archive( 'meal' ) ) { |
|
169 | - $title = __( 'Meals', 'lsx-health-plan' ); |
|
170 | - } |
|
171 | - return $title; |
|
172 | - } |
|
161 | + /** |
|
162 | + * Remove the "Archives:" from the post type meal. |
|
163 | + * |
|
164 | + * @param string $title the term title. |
|
165 | + * @return string |
|
166 | + */ |
|
167 | + public function get_the_archive_title( $title ) { |
|
168 | + if ( is_post_type_archive( 'meal' ) ) { |
|
169 | + $title = __( 'Meals', 'lsx-health-plan' ); |
|
170 | + } |
|
171 | + return $title; |
|
172 | + } |
|
173 | 173 | |
174 | - /** |
|
175 | - * Define the metabox and field configurations. |
|
176 | - */ |
|
177 | - public function featured_metabox() { |
|
178 | - $cmb = new_cmb2_box( |
|
179 | - array( |
|
180 | - 'id' => $this->slug . '_featured_metabox_meal', |
|
181 | - 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
182 | - 'object_types' => array( $this->slug ), // Post type |
|
183 | - 'context' => 'side', |
|
184 | - 'priority' => 'high', |
|
185 | - 'show_names' => true, |
|
186 | - ) |
|
187 | - ); |
|
188 | - $cmb->add_field( |
|
189 | - array( |
|
190 | - 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
191 | - 'desc' => __( 'Enable a featured meal' ), |
|
192 | - 'id' => $this->slug . '_featured_meal', |
|
193 | - 'type' => 'checkbox', |
|
194 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
195 | - ) |
|
196 | - ); |
|
197 | - } |
|
174 | + /** |
|
175 | + * Define the metabox and field configurations. |
|
176 | + */ |
|
177 | + public function featured_metabox() { |
|
178 | + $cmb = new_cmb2_box( |
|
179 | + array( |
|
180 | + 'id' => $this->slug . '_featured_metabox_meal', |
|
181 | + 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
182 | + 'object_types' => array( $this->slug ), // Post type |
|
183 | + 'context' => 'side', |
|
184 | + 'priority' => 'high', |
|
185 | + 'show_names' => true, |
|
186 | + ) |
|
187 | + ); |
|
188 | + $cmb->add_field( |
|
189 | + array( |
|
190 | + 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
191 | + 'desc' => __( 'Enable a featured meal' ), |
|
192 | + 'id' => $this->slug . '_featured_meal', |
|
193 | + 'type' => 'checkbox', |
|
194 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
195 | + ) |
|
196 | + ); |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * Define the metabox and field configurations. |
|
201 | - */ |
|
202 | - public function details_metaboxes() { |
|
203 | - $cmb = new_cmb2_box( array( |
|
204 | - 'id' => $this->slug . '_shopping_list_metabox', |
|
205 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
206 | - 'object_types' => array( $this->slug ), // Post type |
|
207 | - 'context' => 'normal', |
|
208 | - 'priority' => 'high', |
|
209 | - 'show_names' => true, |
|
210 | - ) ); |
|
211 | - $cmb->add_field( array( |
|
212 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
213 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
214 | - 'id' => $this->slug . '_shopping_list', |
|
215 | - 'type' => 'post_search_ajax', |
|
216 | - // Optional : |
|
217 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
218 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
219 | - 'query_args' => array( |
|
220 | - 'post_type' => array( 'page' ), |
|
221 | - 'post_status' => array( 'publish' ), |
|
222 | - 'posts_per_page' => -1, |
|
223 | - ), |
|
224 | - ) ); |
|
225 | - $cmb = new_cmb2_box( array( |
|
226 | - 'id' => $this->slug . '_details_metabox', |
|
227 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
228 | - 'object_types' => array( $this->slug ), // Post type |
|
229 | - 'context' => 'normal', |
|
230 | - 'priority' => 'high', |
|
231 | - 'show_names' => true, |
|
232 | - ) ); |
|
199 | + /** |
|
200 | + * Define the metabox and field configurations. |
|
201 | + */ |
|
202 | + public function details_metaboxes() { |
|
203 | + $cmb = new_cmb2_box( array( |
|
204 | + 'id' => $this->slug . '_shopping_list_metabox', |
|
205 | + 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
206 | + 'object_types' => array( $this->slug ), // Post type |
|
207 | + 'context' => 'normal', |
|
208 | + 'priority' => 'high', |
|
209 | + 'show_names' => true, |
|
210 | + ) ); |
|
211 | + $cmb->add_field( array( |
|
212 | + 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
213 | + 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
214 | + 'id' => $this->slug . '_shopping_list', |
|
215 | + 'type' => 'post_search_ajax', |
|
216 | + // Optional : |
|
217 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
218 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
219 | + 'query_args' => array( |
|
220 | + 'post_type' => array( 'page' ), |
|
221 | + 'post_status' => array( 'publish' ), |
|
222 | + 'posts_per_page' => -1, |
|
223 | + ), |
|
224 | + ) ); |
|
225 | + $cmb = new_cmb2_box( array( |
|
226 | + 'id' => $this->slug . '_details_metabox', |
|
227 | + 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
228 | + 'object_types' => array( $this->slug ), // Post type |
|
229 | + 'context' => 'normal', |
|
230 | + 'priority' => 'high', |
|
231 | + 'show_names' => true, |
|
232 | + ) ); |
|
233 | 233 | |
234 | - $cmb->add_field( array( |
|
235 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
236 | - 'id' => $this->slug . '_short_description', |
|
237 | - 'type' => 'textarea_small', |
|
238 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
239 | - ) ); |
|
234 | + $cmb->add_field( array( |
|
235 | + 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
236 | + 'id' => $this->slug . '_short_description', |
|
237 | + 'type' => 'textarea_small', |
|
238 | + 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
239 | + ) ); |
|
240 | 240 | |
241 | - $cmb->add_field( array( |
|
242 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
243 | - 'id' => $this->slug . '_pre_breakfast_snack', |
|
244 | - 'type' => 'wysiwyg', |
|
245 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
246 | - 'options' => array( |
|
247 | - 'textarea_rows' => 5, |
|
248 | - ), |
|
249 | - ) ); |
|
250 | - $cmb->add_field( array( |
|
251 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
252 | - 'id' => $this->slug . '_breakfast', |
|
253 | - 'type' => 'wysiwyg', |
|
254 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
255 | - 'options' => array( |
|
256 | - 'textarea_rows' => 5, |
|
257 | - ), |
|
258 | - ) ); |
|
241 | + $cmb->add_field( array( |
|
242 | + 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
243 | + 'id' => $this->slug . '_pre_breakfast_snack', |
|
244 | + 'type' => 'wysiwyg', |
|
245 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
246 | + 'options' => array( |
|
247 | + 'textarea_rows' => 5, |
|
248 | + ), |
|
249 | + ) ); |
|
250 | + $cmb->add_field( array( |
|
251 | + 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
252 | + 'id' => $this->slug . '_breakfast', |
|
253 | + 'type' => 'wysiwyg', |
|
254 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
255 | + 'options' => array( |
|
256 | + 'textarea_rows' => 5, |
|
257 | + ), |
|
258 | + ) ); |
|
259 | 259 | |
260 | - $cmb->add_field( |
|
261 | - array( |
|
262 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
263 | - 'id' => $this->slug . '_breakfast_snack', |
|
264 | - 'type' => 'wysiwyg', |
|
265 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
266 | - 'options' => array( |
|
267 | - 'textarea_rows' => 5, |
|
268 | - ), |
|
269 | - ) |
|
270 | - ); |
|
260 | + $cmb->add_field( |
|
261 | + array( |
|
262 | + 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
263 | + 'id' => $this->slug . '_breakfast_snack', |
|
264 | + 'type' => 'wysiwyg', |
|
265 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
266 | + 'options' => array( |
|
267 | + 'textarea_rows' => 5, |
|
268 | + ), |
|
269 | + ) |
|
270 | + ); |
|
271 | 271 | |
272 | - if ( post_type_exists( 'recipe' ) ) { |
|
273 | - $cmb->add_field( |
|
274 | - array( |
|
275 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
276 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
277 | - 'id' => 'breakfast_recipes', |
|
278 | - 'type' => 'post_search_ajax', |
|
279 | - // Optional : |
|
280 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
281 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
282 | - 'query_args' => array( |
|
283 | - 'post_type' => array( 'recipe' ), |
|
284 | - 'post_status' => array( 'publish' ), |
|
285 | - 'posts_per_page' => -1, |
|
286 | - ), |
|
287 | - ) |
|
288 | - ); |
|
289 | - } |
|
272 | + if ( post_type_exists( 'recipe' ) ) { |
|
273 | + $cmb->add_field( |
|
274 | + array( |
|
275 | + 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
276 | + 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
277 | + 'id' => 'breakfast_recipes', |
|
278 | + 'type' => 'post_search_ajax', |
|
279 | + // Optional : |
|
280 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
281 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
282 | + 'query_args' => array( |
|
283 | + 'post_type' => array( 'recipe' ), |
|
284 | + 'post_status' => array( 'publish' ), |
|
285 | + 'posts_per_page' => -1, |
|
286 | + ), |
|
287 | + ) |
|
288 | + ); |
|
289 | + } |
|
290 | 290 | |
291 | - $cmb->add_field( |
|
292 | - array( |
|
293 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
294 | - 'id' => $this->slug . '_pre_lunch_snack', |
|
295 | - 'type' => 'wysiwyg', |
|
296 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
297 | - 'options' => array( |
|
298 | - 'textarea_rows' => 5, |
|
299 | - ), |
|
300 | - ) |
|
301 | - ); |
|
302 | - $cmb->add_field( |
|
303 | - array( |
|
304 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
305 | - 'id' => $this->slug . '_lunch', |
|
306 | - 'type' => 'wysiwyg', |
|
307 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
308 | - 'options' => array( |
|
309 | - 'textarea_rows' => 5, |
|
310 | - ), |
|
311 | - ) |
|
312 | - ); |
|
313 | - $cmb->add_field( |
|
314 | - array( |
|
315 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
316 | - 'id' => $this->slug . '_lunch_snack', |
|
317 | - 'type' => 'wysiwyg', |
|
318 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
319 | - 'options' => array( |
|
320 | - 'textarea_rows' => 5, |
|
321 | - ), |
|
322 | - ) |
|
323 | - ); |
|
291 | + $cmb->add_field( |
|
292 | + array( |
|
293 | + 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
294 | + 'id' => $this->slug . '_pre_lunch_snack', |
|
295 | + 'type' => 'wysiwyg', |
|
296 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
297 | + 'options' => array( |
|
298 | + 'textarea_rows' => 5, |
|
299 | + ), |
|
300 | + ) |
|
301 | + ); |
|
302 | + $cmb->add_field( |
|
303 | + array( |
|
304 | + 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
305 | + 'id' => $this->slug . '_lunch', |
|
306 | + 'type' => 'wysiwyg', |
|
307 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
308 | + 'options' => array( |
|
309 | + 'textarea_rows' => 5, |
|
310 | + ), |
|
311 | + ) |
|
312 | + ); |
|
313 | + $cmb->add_field( |
|
314 | + array( |
|
315 | + 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
316 | + 'id' => $this->slug . '_lunch_snack', |
|
317 | + 'type' => 'wysiwyg', |
|
318 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
319 | + 'options' => array( |
|
320 | + 'textarea_rows' => 5, |
|
321 | + ), |
|
322 | + ) |
|
323 | + ); |
|
324 | 324 | |
325 | - if ( post_type_exists( 'recipe' ) ) { |
|
326 | - $cmb->add_field( |
|
327 | - array( |
|
328 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
329 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
330 | - 'id' => 'lunch_recipes', |
|
331 | - 'type' => 'post_search_ajax', |
|
332 | - // Optional : |
|
333 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
334 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
335 | - 'query_args' => array( |
|
336 | - 'post_type' => array( 'recipe' ), |
|
337 | - 'post_status' => array( 'publish' ), |
|
338 | - 'posts_per_page' => -1, |
|
339 | - ), |
|
340 | - ) |
|
341 | - ); |
|
342 | - } |
|
325 | + if ( post_type_exists( 'recipe' ) ) { |
|
326 | + $cmb->add_field( |
|
327 | + array( |
|
328 | + 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
329 | + 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
330 | + 'id' => 'lunch_recipes', |
|
331 | + 'type' => 'post_search_ajax', |
|
332 | + // Optional : |
|
333 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
334 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
335 | + 'query_args' => array( |
|
336 | + 'post_type' => array( 'recipe' ), |
|
337 | + 'post_status' => array( 'publish' ), |
|
338 | + 'posts_per_page' => -1, |
|
339 | + ), |
|
340 | + ) |
|
341 | + ); |
|
342 | + } |
|
343 | 343 | |
344 | - $cmb->add_field( |
|
345 | - array( |
|
346 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
347 | - 'id' => $this->slug . '_pre_dinner_snack', |
|
348 | - 'type' => 'wysiwyg', |
|
349 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
350 | - 'options' => array( |
|
351 | - 'textarea_rows' => 5, |
|
352 | - ), |
|
353 | - ) |
|
354 | - ); |
|
355 | - $cmb->add_field( |
|
356 | - array( |
|
357 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
358 | - 'id' => $this->slug . '_dinner', |
|
359 | - 'type' => 'wysiwyg', |
|
360 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
361 | - 'options' => array( |
|
362 | - 'textarea_rows' => 5, |
|
363 | - ), |
|
364 | - ) |
|
365 | - ); |
|
366 | - $cmb->add_field( |
|
367 | - array( |
|
368 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
369 | - 'id' => $this->slug . '_dinner_snack', |
|
370 | - 'type' => 'wysiwyg', |
|
371 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
372 | - 'options' => array( |
|
373 | - 'textarea_rows' => 5, |
|
374 | - ), |
|
375 | - ) |
|
376 | - ); |
|
344 | + $cmb->add_field( |
|
345 | + array( |
|
346 | + 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
347 | + 'id' => $this->slug . '_pre_dinner_snack', |
|
348 | + 'type' => 'wysiwyg', |
|
349 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
350 | + 'options' => array( |
|
351 | + 'textarea_rows' => 5, |
|
352 | + ), |
|
353 | + ) |
|
354 | + ); |
|
355 | + $cmb->add_field( |
|
356 | + array( |
|
357 | + 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
358 | + 'id' => $this->slug . '_dinner', |
|
359 | + 'type' => 'wysiwyg', |
|
360 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
361 | + 'options' => array( |
|
362 | + 'textarea_rows' => 5, |
|
363 | + ), |
|
364 | + ) |
|
365 | + ); |
|
366 | + $cmb->add_field( |
|
367 | + array( |
|
368 | + 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
369 | + 'id' => $this->slug . '_dinner_snack', |
|
370 | + 'type' => 'wysiwyg', |
|
371 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
372 | + 'options' => array( |
|
373 | + 'textarea_rows' => 5, |
|
374 | + ), |
|
375 | + ) |
|
376 | + ); |
|
377 | 377 | |
378 | - if ( post_type_exists( 'recipe' ) ) { |
|
379 | - $cmb->add_field( |
|
380 | - array( |
|
381 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
382 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
383 | - 'id' => 'dinner_recipes', |
|
384 | - 'type' => 'post_search_ajax', |
|
385 | - // Optional : |
|
386 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
387 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
388 | - 'query_args' => array( |
|
389 | - 'post_type' => array( 'recipe' ), |
|
390 | - 'post_status' => array( 'publish' ), |
|
391 | - 'posts_per_page' => -1, |
|
392 | - ), |
|
393 | - ) |
|
394 | - ); |
|
395 | - } |
|
396 | - } |
|
378 | + if ( post_type_exists( 'recipe' ) ) { |
|
379 | + $cmb->add_field( |
|
380 | + array( |
|
381 | + 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
382 | + 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
383 | + 'id' => 'dinner_recipes', |
|
384 | + 'type' => 'post_search_ajax', |
|
385 | + // Optional : |
|
386 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
387 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
388 | + 'query_args' => array( |
|
389 | + 'post_type' => array( 'recipe' ), |
|
390 | + 'post_status' => array( 'publish' ), |
|
391 | + 'posts_per_page' => -1, |
|
392 | + ), |
|
393 | + ) |
|
394 | + ); |
|
395 | + } |
|
396 | + } |
|
397 | 397 | } |