@@ -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 = '' ) { |
|
| 164 | +function lsx_health_plan_is_day_complete($post_id = '') { |
|
| 165 | 165 | $is_complete = false; |
| 166 | - if ( '' === $post_id ) { |
|
| 166 | + if ('' === $post_id) { |
|
| 167 | 167 | $post_id = get_the_ID(); |
| 168 | 168 | } |
| 169 | - if ( is_user_logged_in() ) { |
|
| 170 | - $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $post_id . '_complete', true ); |
|
| 171 | - if ( false !== $is_day_complete && '' !== $is_day_complete ) { |
|
| 169 | + if (is_user_logged_in()) { |
|
| 170 | + $is_day_complete = get_user_meta(get_current_user_id(), 'day_' . $post_id . '_complete', true); |
|
| 171 | + if (false !== $is_day_complete && '' !== $is_day_complete) { |
|
| 172 | 172 | $is_complete = true; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | * @param string $week The week name 'week-1'. |
| 182 | 182 | * @return boolean |
| 183 | 183 | */ |
| 184 | -function lsx_health_plan_week_has_downloads( $week = '' ) { |
|
| 184 | +function lsx_health_plan_week_has_downloads($week = '') { |
|
| 185 | 185 | $has_downloads = false; |
| 186 | - if ( '' !== $week ) { |
|
| 187 | - $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week ); |
|
| 188 | - if ( ! empty( $downloads ) ) { |
|
| 186 | + if ('' !== $week) { |
|
| 187 | + $downloads = \lsx_health_plan\functions\get_weekly_downloads($week); |
|
| 188 | + if ( ! empty($downloads)) { |
|
| 189 | 189 | $has_downloads = true; |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -198,14 +198,14 @@ discard block |
||
| 198 | 198 | * @param string $post_id |
| 199 | 199 | * @return boolean |
| 200 | 200 | */ |
| 201 | -function lsx_health_plan_has_tips( $post_id = '' ) { |
|
| 201 | +function lsx_health_plan_has_tips($post_id = '') { |
|
| 202 | 202 | $has_tips = false; |
| 203 | - if ( '' === $post_id ) { |
|
| 203 | + if ('' === $post_id) { |
|
| 204 | 204 | $post_id = get_the_ID(); |
| 205 | 205 | } |
| 206 | - $connected_tips = get_post_meta( get_the_ID(), 'connected_tips', true ); |
|
| 207 | - $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips ); |
|
| 208 | - if ( ! empty( $connected_tips ) ) { |
|
| 206 | + $connected_tips = get_post_meta(get_the_ID(), 'connected_tips', true); |
|
| 207 | + $connected_tips = \lsx_health_plan\functions\check_posts_exist($connected_tips); |
|
| 208 | + if ( ! empty($connected_tips)) { |
|
| 209 | 209 | $has_tips = true; |
| 210 | 210 | } |
| 211 | 211 | return $has_tips; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * Contructor |
| 32 | 32 | */ |
| 33 | 33 | public function __construct() { |
| 34 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 34 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
| 35 | 35 | |
| 36 | 36 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
| 37 | 37 | $this->endpoints = Endpoints::get_instance(); |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
| 43 | 43 | $this->gallery = frontend\Gallery::get_instance(); |
| 44 | 44 | |
| 45 | - if ( is_admin() ) { |
|
| 46 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
| 45 | + if (is_admin()) { |
|
| 46 | + add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Handle the template redirects. |
| 50 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 51 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 52 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
| 53 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 50 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
| 51 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
| 52 | + add_filter('template_include', array($this, 'taxonomy_template_include'), 99); |
|
| 53 | + add_action('template_redirect', array($this, 'redirect')); |
|
| 54 | 54 | |
| 55 | - add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
| 56 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wpkses_post_tags' ), 100, 2 ); |
|
| 55 | + add_action('init', array($this, 'handle_day_action'), 100); |
|
| 56 | + add_filter('wp_kses_allowed_html', array($this, 'wpkses_post_tags'), 100, 2); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public static function get_instance() { |
| 67 | 67 | // If the single instance hasn't been set, set it now. |
| 68 | - if ( null === self::$instance ) { |
|
| 68 | + if (null === self::$instance) { |
|
| 69 | 69 | self::$instance = new self(); |
| 70 | 70 | } |
| 71 | 71 | return self::$instance; |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | 79 | public function assets() { |
| 80 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 81 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
| 82 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
| 80 | + wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER); |
|
| 81 | + wp_style_add_data('lsx-health-plan', 'rtl', 'replace'); |
|
| 82 | + wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery')); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Handle body colours that might be change by LSX Customizer. |
| 87 | 87 | */ |
| 88 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
| 88 | + public function customizer_body_colours_handler($css, $colors) { |
|
| 89 | 89 | $css .= ' |
| 90 | 90 | @import "' . LSX_HEALTH_PLAN_PATH . '/assets/css/scss/partials/customizer-health-plan-body-colours"; |
| 91 | 91 | |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Archive template. |
| 110 | 110 | */ |
| 111 | - public function archive_template_include( $template ) { |
|
| 112 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
| 113 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
| 111 | + public function archive_template_include($template) { |
|
| 112 | + $applicable_post_types = apply_filters('lsx_health_plan_archive_template', array()); |
|
| 113 | + if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) { |
|
| 114 | 114 | $post_type = get_post_type(); |
| 115 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
| 115 | + if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) { |
|
| 116 | 116 | $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | /** |
| 123 | 123 | * Single template. |
| 124 | 124 | */ |
| 125 | - public function single_template_include( $template ) { |
|
| 126 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
| 127 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
| 125 | + public function single_template_include($template) { |
|
| 126 | + $applicable_post_types = apply_filters('lsx_health_plan_single_template', array()); |
|
| 127 | + if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) { |
|
| 128 | 128 | $post_type = get_post_type(); |
| 129 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
| 129 | + if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) { |
|
| 130 | 130 | $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | * @param $template string |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | - public function taxonomy_template_include( $template ) { |
|
| 143 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
| 144 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
| 145 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
| 146 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
| 142 | + public function taxonomy_template_include($template) { |
|
| 143 | + $applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array()); |
|
| 144 | + if (is_main_query() && is_tax($applicable_taxonomies)) { |
|
| 145 | + $current_taxonomy = get_query_var('taxonomy'); |
|
| 146 | + if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) { |
|
| 147 | 147 | $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | 158 | public function redirect() { |
| 159 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 159 | + if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | - if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
| 163 | - wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 162 | + if (lsx_health_plan_user_has_purchase() && (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout')))) { |
|
| 163 | + wp_redirect(get_permalink(wc_get_page_id('myaccount'))); |
|
| 164 | 164 | die; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
| 168 | - if ( false !== $product_id && is_single( $product_id ) ) { |
|
| 169 | - wp_redirect( home_url() ); |
|
| 167 | + $product_id = \lsx_health_plan\functions\get_option('membership_product', false); |
|
| 168 | + if (false !== $product_id && is_single($product_id)) { |
|
| 169 | + wp_redirect(home_url()); |
|
| 170 | 170 | die; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -175,21 +175,21 @@ discard block |
||
| 175 | 175 | * Registers the rewrites. |
| 176 | 176 | */ |
| 177 | 177 | public function handle_day_action() { |
| 178 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
| 179 | - update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
| 180 | - wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 178 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) { |
|
| 179 | + update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true); |
|
| 180 | + wp_safe_redirect(get_permalink(wc_get_page_id('myaccount'))); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
| 184 | - delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
| 183 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) { |
|
| 184 | + delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete'); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Registers the rewrites. |
| 190 | 190 | */ |
| 191 | - public function wpkses_post_tags( $tags, $context ) { |
|
| 192 | - if ( 'post' === $context ) { |
|
| 191 | + public function wpkses_post_tags($tags, $context) { |
|
| 192 | + if ('post' === $context) { |
|
| 193 | 193 | $tags['iframe'] = array( |
| 194 | 194 | 'src' => true, |
| 195 | 195 | 'height' => true, |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public static function get_instance() { |
| 61 | 61 | |
| 62 | 62 | // If the single instance hasn't been set, set it now. |
| 63 | - if ( null === self::$instance ) { |
|
| 63 | + if (null === self::$instance) { |
|
| 64 | 64 | self::$instance = new self(); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | 109 | public function get_post_types() { |
| 110 | - $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
| 111 | - foreach ( $post_types as $index => $post_type ) { |
|
| 112 | - $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
|
| 113 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
| 114 | - unset( $post_types[ $index ] ); |
|
| 110 | + $post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types)); |
|
| 111 | + foreach ($post_types as $index => $post_type) { |
|
| 112 | + $is_disabled = \cmb2_get_option('lsx_health_plan_options', $post_type . '_disabled', false); |
|
| 113 | + if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) { |
|
| 114 | + unset($post_types[$index]); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | return $post_types; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * Contructor |
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | - add_action( 'init', array( $this, 'setup' ) ); |
|
| 24 | + add_action('init', array($this, 'setup')); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function get_instance() { |
| 35 | 35 | // If the single instance hasn't been set, set it now. |
| 36 | - if ( null === self::$instance ) { |
|
| 36 | + if (null === self::$instance) { |
|
| 37 | 37 | self::$instance = new self(); |
| 38 | 38 | } |
| 39 | 39 | return self::$instance; |
@@ -51,40 +51,40 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function add_rewrite_rules() { |
| 53 | 53 | // Here is where we add in the rewrite rules above the normal WP ones. |
| 54 | - add_rewrite_tag( '%endpoint%', '([^&]+)' ); |
|
| 54 | + add_rewrite_tag('%endpoint%', '([^&]+)'); |
|
| 55 | 55 | |
| 56 | 56 | // Warm up. |
| 57 | - $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 58 | - if ( false === $warm_up ) { |
|
| 57 | + $warm_up = \lsx_health_plan\functions\get_option('endpoint_warm_up', false); |
|
| 58 | + if (false === $warm_up) { |
|
| 59 | 59 | $warm_up = 'warm-up'; |
| 60 | 60 | } |
| 61 | - add_rewrite_rule( 'plan/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&endpoint=warm-up', 'top' ); |
|
| 61 | + add_rewrite_rule('plan/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&endpoint=warm-up', 'top'); |
|
| 62 | 62 | |
| 63 | 63 | // Workout. |
| 64 | - if ( post_type_exists( 'workout' ) ) { |
|
| 65 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 66 | - if ( false === $workout ) { |
|
| 64 | + if (post_type_exists('workout')) { |
|
| 65 | + $workout = \lsx_health_plan\functions\get_option('endpoint_workout', false); |
|
| 66 | + if (false === $workout) { |
|
| 67 | 67 | $workout = 'workout'; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - add_rewrite_rule( 'plan/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&endpoint=workout', 'top' ); |
|
| 70 | + add_rewrite_rule('plan/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&endpoint=workout', 'top'); |
|
| 71 | 71 | |
| 72 | 72 | // Meal. |
| 73 | - if ( post_type_exists( 'meal' ) ) { |
|
| 74 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 75 | - if ( false === $meal ) { |
|
| 73 | + if (post_type_exists('meal')) { |
|
| 74 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', false); |
|
| 75 | + if (false === $meal) { |
|
| 76 | 76 | $meal = 'meal'; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | - add_rewrite_rule( 'plan/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&endpoint=meal', 'top' ); |
|
| 79 | + add_rewrite_rule('plan/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&endpoint=meal', 'top'); |
|
| 80 | 80 | |
| 81 | 81 | // Recipe. |
| 82 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 83 | - $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 84 | - if ( false === $recipe ) { |
|
| 82 | + if (post_type_exists('recipe')) { |
|
| 83 | + $recipe = \lsx_health_plan\functions\get_option('endpoint_recipe', false); |
|
| 84 | + if (false === $recipe) { |
|
| 85 | 85 | $recipe = 'recipes'; |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | - add_rewrite_rule( 'plan/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&endpoint=recipes', 'top' ); |
|
| 88 | + add_rewrite_rule('plan/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&endpoint=recipes', 'top'); |
|
| 89 | 89 | } |
| 90 | 90 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * Contructor |
| 29 | 29 | */ |
| 30 | 30 | public function __construct() { |
| 31 | - add_action( 'wp_footer', array( $this, 'output_modals' ) ); |
|
| 31 | + add_action('wp_footer', array($this, 'output_modals')); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public static function get_instance() { |
| 42 | 42 | // If the single instance hasn't been set, set it now. |
| 43 | - if ( null === self::$instance ) { |
|
| 43 | + if (null === self::$instance) { |
|
| 44 | 44 | self::$instance = new self(); |
| 45 | 45 | } |
| 46 | 46 | return self::$instance; |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | * @param string $index |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | - public function register_modal( $modal = array(), $index = '' ) { |
|
| 57 | - if ( '' !== $index && ! empty( $modal ) ) { |
|
| 56 | + public function register_modal($modal = array(), $index = '') { |
|
| 57 | + if ('' !== $index && ! empty($modal)) { |
|
| 58 | 58 | $modal['id'] = $index; |
| 59 | - $this->modals[ $index ] = $modal; |
|
| 59 | + $this->modals[$index] = $modal; |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * Registers the rewrites. |
| 65 | 65 | */ |
| 66 | 66 | public function output_modals() { |
| 67 | - if ( ! empty( $this->modals ) ) { |
|
| 68 | - wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 67 | + if ( ! empty($this->modals)) { |
|
| 68 | + wp_enqueue_script('lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array('slick'), LSX_HEALTH_PLAN_VER, true); |
|
| 69 | 69 | |
| 70 | - foreach ( $this->modals as $index => $modal ) { |
|
| 71 | - \lsx_health_plan\functions\output_modal( $modal ); |
|
| 70 | + foreach ($this->modals as $index => $modal) { |
|
| 71 | + \lsx_health_plan\functions\output_modal($modal); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | * Contructor |
| 31 | 31 | */ |
| 32 | 32 | public function __construct() { |
| 33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 33 | + add_action('init', array($this, 'register_post_type')); |
|
| 34 | 34 | |
| 35 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 35 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
| 36 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
| 37 | 37 | |
| 38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 39 | - add_action( 'cmb2_admin_init', array( $this, 'meal_connections' ), 15 ); |
|
| 38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
| 39 | + add_action('cmb2_admin_init', array($this, 'meal_connections'), 15); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function get_instance() { |
| 50 | 50 | // If the single instance hasn't been set, set it now. |
| 51 | - if ( null === self::$instance ) { |
|
| 51 | + if (null === self::$instance) { |
|
| 52 | 52 | self::$instance = new self(); |
| 53 | 53 | } |
| 54 | 54 | return self::$instance; |
@@ -58,21 +58,21 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function register_post_type() { |
| 60 | 60 | $labels = array( |
| 61 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
| 62 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
| 63 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 64 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 65 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 66 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 67 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 68 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 69 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 70 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 71 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 61 | + 'name' => esc_html__('Meals', 'lsx-health-plan'), |
|
| 62 | + 'singular_name' => esc_html__('Meal', 'lsx-health-plan'), |
|
| 63 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
| 64 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 65 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 66 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
| 67 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 68 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
| 69 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 70 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
| 71 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
| 72 | 72 | 'parent_item_colon' => '', |
| 73 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
| 73 | + 'menu_name' => esc_html__('Meals', 'lsx-health-plan'), |
|
| 74 | 74 | ); |
| 75 | - $args = array( |
|
| 75 | + $args = array( |
|
| 76 | 76 | 'labels' => $labels, |
| 77 | 77 | 'public' => true, |
| 78 | 78 | 'publicly_queryable' => true, |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'title', |
| 91 | 91 | ), |
| 92 | 92 | ); |
| 93 | - register_post_type( 'meal', $args ); |
|
| 93 | + register_post_type('meal', $args); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param array $post_types |
| 100 | 100 | * @return array |
| 101 | 101 | */ |
| 102 | - public function enable_post_type( $post_types = array() ) { |
|
| 102 | + public function enable_post_type($post_types = array()) { |
|
| 103 | 103 | $post_types[] = $this->slug; |
| 104 | 104 | return $post_types; |
| 105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param array $connections |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function enable_connections( $connections = array() ) { |
|
| 113 | + public function enable_connections($connections = array()) { |
|
| 114 | 114 | $connections['meal']['connected_plans'] = 'connected_meals'; |
| 115 | 115 | $connections['plan']['connected_meals'] = 'connected_plans'; |
| 116 | 116 | return $connections; |
@@ -120,117 +120,117 @@ discard block |
||
| 120 | 120 | * Define the metabox and field configurations. |
| 121 | 121 | */ |
| 122 | 122 | public function details_metaboxes() { |
| 123 | - $cmb = new_cmb2_box( array( |
|
| 123 | + $cmb = new_cmb2_box(array( |
|
| 124 | 124 | 'id' => $this->slug . '_shopping_list_metabox', |
| 125 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
| 126 | - 'object_types' => array( $this->slug ), // Post type |
|
| 125 | + 'title' => __('Shopping List', 'lsx-health-plan'), |
|
| 126 | + 'object_types' => array($this->slug), // Post type |
|
| 127 | 127 | 'context' => 'normal', |
| 128 | 128 | 'priority' => 'high', |
| 129 | 129 | 'show_names' => true, |
| 130 | - ) ); |
|
| 131 | - $cmb->add_field( array( |
|
| 132 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
| 133 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
| 130 | + )); |
|
| 131 | + $cmb->add_field(array( |
|
| 132 | + 'name' => __('Shopping List', 'lsx-health-plan'), |
|
| 133 | + 'desc' => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'), |
|
| 134 | 134 | 'id' => $this->slug . '_shopping_list', |
| 135 | 135 | 'type' => 'post_search_ajax', |
| 136 | 136 | // Optional : |
| 137 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
| 137 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
| 138 | 138 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 139 | 139 | 'query_args' => array( |
| 140 | - 'post_type' => array( 'page' ), |
|
| 141 | - 'post_status' => array( 'publish' ), |
|
| 140 | + 'post_type' => array('page'), |
|
| 141 | + 'post_status' => array('publish'), |
|
| 142 | 142 | 'posts_per_page' => -1, |
| 143 | 143 | ), |
| 144 | - ) ); |
|
| 145 | - $cmb = new_cmb2_box( array( |
|
| 144 | + )); |
|
| 145 | + $cmb = new_cmb2_box(array( |
|
| 146 | 146 | 'id' => $this->slug . '_details_metabox', |
| 147 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
| 148 | - 'object_types' => array( $this->slug ), // Post type |
|
| 147 | + 'title' => __('Meal Details', 'lsx-health-plan'), |
|
| 148 | + 'object_types' => array($this->slug), // Post type |
|
| 149 | 149 | 'context' => 'normal', |
| 150 | 150 | 'priority' => 'high', |
| 151 | 151 | 'show_names' => true, |
| 152 | - ) ); |
|
| 153 | - $cmb->add_field( array( |
|
| 154 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
| 152 | + )); |
|
| 153 | + $cmb->add_field(array( |
|
| 154 | + 'name' => __('Pre Breakfast Snack', 'lsx-health-plan'), |
|
| 155 | 155 | 'id' => $this->slug . '_pre_breakfast_snack', |
| 156 | 156 | 'type' => 'wysiwyg', |
| 157 | 157 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 158 | 158 | 'options' => array( |
| 159 | 159 | 'textarea_rows' => 5, |
| 160 | 160 | ), |
| 161 | - ) ); |
|
| 162 | - $cmb->add_field( array( |
|
| 163 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
| 161 | + )); |
|
| 162 | + $cmb->add_field(array( |
|
| 163 | + 'name' => __('Breakfast', 'lsx-health-plan'), |
|
| 164 | 164 | 'id' => $this->slug . '_breakfast', |
| 165 | 165 | 'type' => 'wysiwyg', |
| 166 | 166 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 167 | 167 | 'options' => array( |
| 168 | 168 | 'textarea_rows' => 5, |
| 169 | 169 | ), |
| 170 | - ) ); |
|
| 171 | - $cmb->add_field( array( |
|
| 172 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
| 170 | + )); |
|
| 171 | + $cmb->add_field(array( |
|
| 172 | + 'name' => __('Post Breakfast Snack', 'lsx-health-plan'), |
|
| 173 | 173 | 'id' => $this->slug . '_breakfast_snack', |
| 174 | 174 | 'type' => 'wysiwyg', |
| 175 | 175 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 176 | 176 | 'options' => array( |
| 177 | 177 | 'textarea_rows' => 5, |
| 178 | 178 | ), |
| 179 | - ) ); |
|
| 180 | - $cmb->add_field( array( |
|
| 181 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
| 179 | + )); |
|
| 180 | + $cmb->add_field(array( |
|
| 181 | + 'name' => __('Pre Lunch Snack', 'lsx-health-plan'), |
|
| 182 | 182 | 'id' => $this->slug . '_pre_lunch_snack', |
| 183 | 183 | 'type' => 'wysiwyg', |
| 184 | 184 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 185 | 185 | 'options' => array( |
| 186 | 186 | 'textarea_rows' => 5, |
| 187 | 187 | ), |
| 188 | - ) ); |
|
| 189 | - $cmb->add_field( array( |
|
| 190 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
| 188 | + )); |
|
| 189 | + $cmb->add_field(array( |
|
| 190 | + 'name' => __('Lunch', 'lsx-health-plan'), |
|
| 191 | 191 | 'id' => $this->slug . '_lunch', |
| 192 | 192 | 'type' => 'wysiwyg', |
| 193 | 193 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 194 | 194 | 'options' => array( |
| 195 | 195 | 'textarea_rows' => 5, |
| 196 | 196 | ), |
| 197 | - ) ); |
|
| 198 | - $cmb->add_field( array( |
|
| 199 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
| 197 | + )); |
|
| 198 | + $cmb->add_field(array( |
|
| 199 | + 'name' => __('Post Lunch Snack', 'lsx-health-plan'), |
|
| 200 | 200 | 'id' => $this->slug . '_lunch_snack', |
| 201 | 201 | 'type' => 'wysiwyg', |
| 202 | 202 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 203 | 203 | 'options' => array( |
| 204 | 204 | 'textarea_rows' => 5, |
| 205 | 205 | ), |
| 206 | - ) ); |
|
| 207 | - $cmb->add_field( array( |
|
| 208 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
| 206 | + )); |
|
| 207 | + $cmb->add_field(array( |
|
| 208 | + 'name' => __('Pre Dinner Snack', 'lsx-health-plan'), |
|
| 209 | 209 | 'id' => $this->slug . '_pre_dinner_snack', |
| 210 | 210 | 'type' => 'wysiwyg', |
| 211 | 211 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 212 | 212 | 'options' => array( |
| 213 | 213 | 'textarea_rows' => 5, |
| 214 | 214 | ), |
| 215 | - ) ); |
|
| 216 | - $cmb->add_field( array( |
|
| 217 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
| 215 | + )); |
|
| 216 | + $cmb->add_field(array( |
|
| 217 | + 'name' => __('Dinner', 'lsx-health-plan'), |
|
| 218 | 218 | 'id' => $this->slug . '_dinner', |
| 219 | 219 | 'type' => 'wysiwyg', |
| 220 | 220 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 221 | 221 | 'options' => array( |
| 222 | 222 | 'textarea_rows' => 5, |
| 223 | 223 | ), |
| 224 | - ) ); |
|
| 225 | - $cmb->add_field( array( |
|
| 226 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
| 224 | + )); |
|
| 225 | + $cmb->add_field(array( |
|
| 226 | + 'name' => __('Post Dinner Snack', 'lsx-health-plan'), |
|
| 227 | 227 | 'id' => $this->slug . '_dinner_snack', |
| 228 | 228 | 'type' => 'wysiwyg', |
| 229 | 229 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 230 | 230 | 'options' => array( |
| 231 | 231 | 'textarea_rows' => 5, |
| 232 | 232 | ), |
| 233 | - ) ); |
|
| 233 | + )); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -239,14 +239,14 @@ discard block |
||
| 239 | 239 | * @return void |
| 240 | 240 | */ |
| 241 | 241 | public function meal_connections() { |
| 242 | - $cmb = new_cmb2_box( array( |
|
| 242 | + $cmb = new_cmb2_box(array( |
|
| 243 | 243 | 'id' => $this->slug . '_meals_connections_metabox', |
| 244 | - 'title' => __( 'Meal Plan', 'lsx-health-plan' ), |
|
| 245 | - 'object_types' => array( 'plan' ), // Post type |
|
| 244 | + 'title' => __('Meal Plan', 'lsx-health-plan'), |
|
| 245 | + 'object_types' => array('plan'), // Post type |
|
| 246 | 246 | 'context' => 'normal', |
| 247 | 247 | 'priority' => 'high', |
| 248 | 248 | 'show_names' => true, |
| 249 | - ) ); |
|
| 249 | + )); |
|
| 250 | 250 | /*$cmb->add_field( array( |
| 251 | 251 | 'name' => __( 'Box Description', 'lsx-health-plan' ), |
| 252 | 252 | 'id' => $this->slug . '_box_description', |
@@ -254,19 +254,19 @@ discard block |
||
| 254 | 254 | 'type' => 'textarea_small', |
| 255 | 255 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 256 | 256 | ) );*/ |
| 257 | - $cmb->add_field( array( |
|
| 258 | - 'name' => __( 'Meals', 'lsx-health-plan' ), |
|
| 259 | - 'desc' => __( 'Connect the meal that applies to this day plan using the field provided.', 'lsx-health-plan' ), |
|
| 257 | + $cmb->add_field(array( |
|
| 258 | + 'name' => __('Meals', 'lsx-health-plan'), |
|
| 259 | + 'desc' => __('Connect the meal that applies to this day plan using the field provided.', 'lsx-health-plan'), |
|
| 260 | 260 | 'id' => 'connected_meals', |
| 261 | 261 | 'type' => 'post_search_ajax', |
| 262 | 262 | // Optional : |
| 263 | 263 | 'limit' => 15, // Limit selection to X items only (default 1) |
| 264 | 264 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 265 | 265 | 'query_args' => array( |
| 266 | - 'post_type' => array( $this->slug ), |
|
| 267 | - 'post_status' => array( 'publish' ), |
|
| 266 | + 'post_type' => array($this->slug), |
|
| 267 | + 'post_status' => array('publish'), |
|
| 268 | 268 | 'posts_per_page' => -1, |
| 269 | 269 | ), |
| 270 | - ) ); |
|
| 270 | + )); |
|
| 271 | 271 | } |
| 272 | 272 | } |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | * Contructor |
| 33 | 33 | */ |
| 34 | 34 | public function __construct() { |
| 35 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 36 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 37 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 39 | - add_action( 'cmb2_admin_init', array( $this, 'workout_connections' ), 15 ); |
|
| 40 | - add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 8, 1 ); |
|
| 41 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
| 35 | + add_action('init', array($this, 'register_post_type')); |
|
| 36 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
| 37 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
| 38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
| 39 | + add_action('cmb2_admin_init', array($this, 'workout_connections'), 15); |
|
| 40 | + add_action('lsx_hp_settings_page', array($this, 'register_settings'), 8, 1); |
|
| 41 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
| 42 | 42 | |
| 43 | 43 | // Template Redirects. |
| 44 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 44 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
| 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,19 +63,19 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function register_post_type() { |
| 65 | 65 | $labels = array( |
| 66 | - 'name' => esc_html__( 'Workout', 'lsx-health-plan' ), |
|
| 67 | - 'singular_name' => esc_html__( 'Workouts', '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', '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__('Workout', 'lsx-health-plan'), |
|
| 67 | + 'singular_name' => esc_html__('Workouts', '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', '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__( 'Workouts', 'lsx-health-plan' ), |
|
| 78 | + 'menu_name' => esc_html__('Workouts', 'lsx-health-plan'), |
|
| 79 | 79 | ); |
| 80 | 80 | $args = array( |
| 81 | 81 | 'labels' => $labels, |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | 'menu_icon' => 'dashicons-universal-access', |
| 88 | 88 | 'query_var' => true, |
| 89 | 89 | 'rewrite' => array( |
| 90 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 90 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
| 91 | 91 | ), |
| 92 | 92 | 'capability_type' => 'page', |
| 93 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', false ), |
|
| 93 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_workout_archive', false), |
|
| 94 | 94 | 'hierarchical' => true, |
| 95 | 95 | 'menu_position' => null, |
| 96 | 96 | 'supports' => array( |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | 'excerpt', |
| 101 | 101 | ), |
| 102 | 102 | ); |
| 103 | - register_post_type( 'workout', $args ); |
|
| 103 | + register_post_type('workout', $args); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $post_types |
| 110 | 110 | * @return array |
| 111 | 111 | */ |
| 112 | - public function enable_post_type( $post_types = array() ) { |
|
| 112 | + public function enable_post_type($post_types = array()) { |
|
| 113 | 113 | $post_types[] = $this->slug; |
| 114 | 114 | return $post_types; |
| 115 | 115 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param array $connections |
| 121 | 121 | * @return void |
| 122 | 122 | */ |
| 123 | - public function enable_connections( $connections = array() ) { |
|
| 123 | + public function enable_connections($connections = array()) { |
|
| 124 | 124 | $connections['workout']['connected_plans'] = 'connected_workouts'; |
| 125 | 125 | $connections['plan']['connected_workouts'] = 'connected_plans'; |
| 126 | 126 | |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | * @param string $title the term title. |
| 139 | 139 | * @return string |
| 140 | 140 | */ |
| 141 | - public function get_the_archive_title( $title ) { |
|
| 142 | - if ( is_post_type_archive( 'workout' ) ) { |
|
| 143 | - $title = __( 'Workouts', 'lsx-health-plan' ); |
|
| 141 | + public function get_the_archive_title($title) { |
|
| 142 | + if (is_post_type_archive('workout')) { |
|
| 143 | + $title = __('Workouts', 'lsx-health-plan'); |
|
| 144 | 144 | } |
| 145 | 145 | return $title; |
| 146 | 146 | } |
@@ -149,27 +149,27 @@ discard block |
||
| 149 | 149 | * Define the metabox and field configurations. |
| 150 | 150 | */ |
| 151 | 151 | public function details_metaboxes() { |
| 152 | - $workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 ); |
|
| 153 | - if ( false !== $workout_sections && null !== $workout_sections ) { |
|
| 152 | + $workout_sections = apply_filters('lsx_health_plan_workout_sections_amount', 6); |
|
| 153 | + if (false !== $workout_sections && null !== $workout_sections) { |
|
| 154 | 154 | $i = 1; |
| 155 | - while ( $i <= $workout_sections ) { |
|
| 155 | + while ($i <= $workout_sections) { |
|
| 156 | 156 | |
| 157 | - $cmb_group = new_cmb2_box( array( |
|
| 157 | + $cmb_group = new_cmb2_box(array( |
|
| 158 | 158 | 'id' => $this->slug . '_section_' . $i . '_metabox', |
| 159 | - 'title' => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i, |
|
| 160 | - 'object_types' => array( $this->slug ), |
|
| 161 | - ) ); |
|
| 159 | + 'title' => esc_html__('Exercise Group ', 'lsx-health-plan') . $i, |
|
| 160 | + 'object_types' => array($this->slug), |
|
| 161 | + )); |
|
| 162 | 162 | |
| 163 | - $cmb_group->add_field( array( |
|
| 164 | - 'name' => __( 'Title', 'lsx-health-plan' ), |
|
| 163 | + $cmb_group->add_field(array( |
|
| 164 | + 'name' => __('Title', 'lsx-health-plan'), |
|
| 165 | 165 | 'id' => $this->slug . '_section_' . $i . '_title', |
| 166 | 166 | 'type' => 'text', |
| 167 | 167 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 168 | - ) ); |
|
| 168 | + )); |
|
| 169 | 169 | |
| 170 | 170 | $cmb_group->add_field( |
| 171 | 171 | array( |
| 172 | - 'name' => __( 'Description', 'lsx-health-plan' ), |
|
| 172 | + 'name' => __('Description', 'lsx-health-plan'), |
|
| 173 | 173 | 'id' => $this->slug . '_section_' . $i . '_description', |
| 174 | 174 | 'type' => 'wysiwyg', |
| 175 | 175 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -188,27 +188,27 @@ discard block |
||
| 188 | 188 | 'id' => $this->slug . '_section_' . $i, |
| 189 | 189 | 'type' => 'group', |
| 190 | 190 | 'options' => array( |
| 191 | - 'group_title' => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number |
|
| 192 | - 'add_button' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 193 | - 'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ), |
|
| 191 | + 'group_title' => esc_html__('Exercise {#}', 'lsx-health-plan'), // {#} gets replaced by row number |
|
| 192 | + 'add_button' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 193 | + 'remove_button' => esc_html__('Delete', 'lsx-health-plan'), |
|
| 194 | 194 | 'sortable' => true, |
| 195 | 195 | ), |
| 196 | 196 | ) |
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 199 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 200 | 200 | $cmb_group->add_group_field( |
| 201 | 201 | $group_field_id, |
| 202 | 202 | array( |
| 203 | - 'name' => __( 'Exercise related to this workout', 'lsx-health-plan' ), |
|
| 203 | + 'name' => __('Exercise related to this workout', 'lsx-health-plan'), |
|
| 204 | 204 | 'id' => 'connected_exercises', |
| 205 | 205 | 'type' => 'post_search_ajax', |
| 206 | 206 | // Optional : |
| 207 | 207 | 'limit' => 1, // Limit selection to X items only (default 1) |
| 208 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
| 208 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
| 209 | 209 | 'query_args' => array( |
| 210 | - 'post_type' => array( 'exercise' ), |
|
| 211 | - 'post_status' => array( 'publish' ), |
|
| 210 | + 'post_type' => array('exercise'), |
|
| 211 | + 'post_status' => array('publish'), |
|
| 212 | 212 | 'posts_per_page' => -1, |
| 213 | 213 | ), |
| 214 | 214 | ) |
@@ -217,15 +217,15 @@ discard block |
||
| 217 | 217 | $cmb_group->add_group_field( |
| 218 | 218 | $group_field_id, |
| 219 | 219 | array( |
| 220 | - 'name' => __( 'Video related to this workout', 'lsx-health-plan' ), |
|
| 220 | + 'name' => __('Video related to this workout', 'lsx-health-plan'), |
|
| 221 | 221 | 'id' => 'connected_videos', |
| 222 | 222 | 'type' => 'post_search_ajax', |
| 223 | 223 | // Optional : |
| 224 | 224 | 'limit' => 1, // Limit selection to X items only (default 1) |
| 225 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
| 225 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
| 226 | 226 | 'query_args' => array( |
| 227 | - 'post_type' => array( 'video' ), |
|
| 228 | - 'post_status' => array( 'publish' ), |
|
| 227 | + 'post_type' => array('video'), |
|
| 228 | + 'post_status' => array('publish'), |
|
| 229 | 229 | 'posts_per_page' => -1, |
| 230 | 230 | ), |
| 231 | 231 | ) |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $cmb_group->add_group_field( |
| 234 | 234 | $group_field_id, |
| 235 | 235 | array( |
| 236 | - 'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ), |
|
| 236 | + 'name' => esc_html__('Workout Name', 'lsx-health-plan'), |
|
| 237 | 237 | 'id' => 'name', |
| 238 | 238 | 'type' => 'text', |
| 239 | 239 | // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $cmb_group->add_group_field( |
| 244 | 244 | $group_field_id, |
| 245 | 245 | array( |
| 246 | - 'name' => __( 'Description', 'lsx-health-plan' ), |
|
| 246 | + 'name' => __('Description', 'lsx-health-plan'), |
|
| 247 | 247 | 'id' => 'description', |
| 248 | 248 | 'type' => 'wysiwyg', |
| 249 | 249 | 'options' => array( |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $cmb_group->add_group_field( |
| 257 | 257 | $group_field_id, |
| 258 | 258 | array( |
| 259 | - 'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ), |
|
| 259 | + 'name' => esc_html__('Reps / Time / Distance', 'lsx-health-plan'), |
|
| 260 | 260 | 'id' => 'reps', |
| 261 | 261 | 'type' => 'text', |
| 262 | 262 | // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | $cmb = new_cmb2_box( |
| 277 | 277 | array( |
| 278 | 278 | 'id' => $this->slug . '_workout_connections_metabox', |
| 279 | - 'title' => __( 'Workouts', 'lsx-health-plan' ), |
|
| 280 | - 'desc' => __( 'Start typing to search for your workouts', 'lsx-health-plan' ), |
|
| 281 | - 'object_types' => array( 'plan' ), |
|
| 279 | + 'title' => __('Workouts', 'lsx-health-plan'), |
|
| 280 | + 'desc' => __('Start typing to search for your workouts', 'lsx-health-plan'), |
|
| 281 | + 'object_types' => array('plan'), |
|
| 282 | 282 | 'context' => 'normal', |
| 283 | 283 | 'priority' => 'high', |
| 284 | 284 | 'show_names' => true, |
@@ -286,22 +286,22 @@ discard block |
||
| 286 | 286 | ); |
| 287 | 287 | $cmb->add_field( |
| 288 | 288 | array( |
| 289 | - 'name' => __( 'Workouts', 'lsx-health-plan' ), |
|
| 289 | + 'name' => __('Workouts', 'lsx-health-plan'), |
|
| 290 | 290 | 'id' => 'connected_workouts', |
| 291 | - 'desc' => __( 'Connect the workout that applies to this day plan using the field provided.', 'lsx-health-plan' ), |
|
| 291 | + 'desc' => __('Connect the workout that applies to this day plan using the field provided.', 'lsx-health-plan'), |
|
| 292 | 292 | 'type' => 'post_search_ajax', |
| 293 | 293 | 'limit' => 15, |
| 294 | 294 | 'sortable' => true, |
| 295 | 295 | 'query_args' => array( |
| 296 | - 'post_type' => array( 'workout' ), |
|
| 297 | - 'post_status' => array( 'publish' ), |
|
| 296 | + 'post_type' => array('workout'), |
|
| 297 | + 'post_status' => array('publish'), |
|
| 298 | 298 | 'posts_per_page' => -1, |
| 299 | 299 | ), |
| 300 | 300 | ) |
| 301 | 301 | ); |
| 302 | 302 | $cmb->add_field( |
| 303 | 303 | array( |
| 304 | - 'name' => __( 'Pre Workout Snack', 'lsx-health-plan' ), |
|
| 304 | + 'name' => __('Pre Workout Snack', 'lsx-health-plan'), |
|
| 305 | 305 | 'id' => 'pre_workout_snack', |
| 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 Workout Snack', 'lsx-health-plan' ), |
|
| 315 | + 'name' => __('Post Workout Snack', 'lsx-health-plan'), |
|
| 316 | 316 | 'id' => 'post_workout_snack', |
| 317 | 317 | 'type' => 'wysiwyg', |
| 318 | 318 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | * @param object $cmb new_cmb2_box(). |
| 330 | 330 | * @return void |
| 331 | 331 | */ |
| 332 | - public function register_settings( $cmb ) { |
|
| 333 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 332 | + public function register_settings($cmb) { |
|
| 333 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 334 | 334 | $cmb->add_field( |
| 335 | 335 | array( |
| 336 | 336 | 'id' => 'workout_settings_title', |
| 337 | 337 | 'type' => 'title', |
| 338 | - 'name' => __( 'Workout Settings', 'lsx-health-plan' ), |
|
| 339 | - 'description' => __( 'Choose the layout, content and link settings for your exercises.', 'lsx-health-plan' ), |
|
| 338 | + 'name' => __('Workout Settings', 'lsx-health-plan'), |
|
| 339 | + 'description' => __('Choose the layout, content and link settings for your exercises.', 'lsx-health-plan'), |
|
| 340 | 340 | ) |
| 341 | 341 | ); |
| 342 | 342 | |
@@ -344,12 +344,12 @@ discard block |
||
| 344 | 344 | array( |
| 345 | 345 | 'id' => 'workout_tab_layout', |
| 346 | 346 | 'type' => 'select', |
| 347 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
| 348 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
| 347 | + 'name' => __('Workout Tab Layout', 'lsx-health-plan'), |
|
| 348 | + 'description' => __('Choose the layout for the workouts.', 'lsx-health-plan'), |
|
| 349 | 349 | 'options' => array( |
| 350 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
| 351 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
| 352 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 350 | + 'table' => __('Table', 'lsx-health-plan'), |
|
| 351 | + 'list' => __('List', 'lsx-health-plan'), |
|
| 352 | + 'grid' => __('Grid', 'lsx-health-plan'), |
|
| 353 | 353 | ), |
| 354 | 354 | ) |
| 355 | 355 | ); |
@@ -357,12 +357,12 @@ discard block |
||
| 357 | 357 | array( |
| 358 | 358 | 'id' => 'workout_tab_link', |
| 359 | 359 | 'type' => 'select', |
| 360 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
| 361 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
| 360 | + 'name' => __('Workout Tab Link', 'lsx-health-plan'), |
|
| 361 | + 'description' => __('Choose to show the excerpt, full content or nothing.', 'lsx-health-plan'), |
|
| 362 | 362 | 'options' => array( |
| 363 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 364 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
| 365 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
| 363 | + '' => __('None', 'lsx-health-plan'), |
|
| 364 | + 'single' => __('Single', 'lsx-health-plan'), |
|
| 365 | + 'modal' => __('Modal', 'lsx-health-plan'), |
|
| 366 | 366 | ), |
| 367 | 367 | 'default' => 'modal', |
| 368 | 368 | ) |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | array( |
| 372 | 372 | 'id' => 'workout_tab_modal_content', |
| 373 | 373 | 'type' => 'select', |
| 374 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
| 375 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
| 374 | + 'name' => __('Modal Content', 'lsx-health-plan'), |
|
| 375 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan'), |
|
| 376 | 376 | 'options' => array( |
| 377 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 378 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 379 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 377 | + '' => __('None', 'lsx-health-plan'), |
|
| 378 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
| 379 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
| 380 | 380 | ), |
| 381 | 381 | 'default' => '', |
| 382 | 382 | ) |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | array( |
| 386 | 386 | 'id' => 'workout_tab_columns', |
| 387 | 387 | 'type' => 'select', |
| 388 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 389 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
| 388 | + 'name' => __('Grid Columns', 'lsx-health-plan'), |
|
| 389 | + 'description' => __('If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan'), |
|
| 390 | 390 | 'options' => array( |
| 391 | - '12' => __( '1', 'lsx-health-plan' ), |
|
| 392 | - '6' => __( '2', 'lsx-health-plan' ), |
|
| 393 | - '4' => __( '3', 'lsx-health-plan' ), |
|
| 394 | - '3' => __( '4', 'lsx-health-plan' ), |
|
| 395 | - '2' => __( '6', 'lsx-health-plan' ), |
|
| 391 | + '12' => __('1', 'lsx-health-plan'), |
|
| 392 | + '6' => __('2', 'lsx-health-plan'), |
|
| 393 | + '4' => __('3', 'lsx-health-plan'), |
|
| 394 | + '3' => __('4', 'lsx-health-plan'), |
|
| 395 | + '2' => __('6', 'lsx-health-plan'), |
|
| 396 | 396 | ), |
| 397 | 397 | 'default' => '4', |
| 398 | 398 | ) |
@@ -401,18 +401,18 @@ discard block |
||
| 401 | 401 | array( |
| 402 | 402 | 'id' => 'workout_tab_content', |
| 403 | 403 | 'type' => 'select', |
| 404 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
| 405 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
| 404 | + 'name' => __('Grid Content', 'lsx-health-plan'), |
|
| 405 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan'), |
|
| 406 | 406 | 'options' => array( |
| 407 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 408 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 409 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 407 | + '' => __('None', 'lsx-health-plan'), |
|
| 408 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
| 409 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
| 410 | 410 | ), |
| 411 | 411 | 'default' => '', |
| 412 | 412 | ) |
| 413 | 413 | ); |
| 414 | 414 | |
| 415 | - do_action( 'lsx_hp_workout_settings_page', $cmb ); |
|
| 415 | + do_action('lsx_hp_workout_settings_page', $cmb); |
|
| 416 | 416 | |
| 417 | 417 | $cmb->add_field( |
| 418 | 418 | array( |
@@ -39,24 +39,24 @@ discard block |
||
| 39 | 39 | * Contructor |
| 40 | 40 | */ |
| 41 | 41 | public function __construct() { |
| 42 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 43 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
| 44 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 42 | + add_action('init', array($this, 'register_post_type')); |
|
| 43 | + add_action('init', array($this, 'taxonomy_setup')); |
|
| 44 | + add_action('admin_menu', array($this, 'register_menus')); |
|
| 45 | 45 | |
| 46 | 46 | // Frontend Actions and Filters. |
| 47 | - add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 ); |
|
| 48 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 49 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 50 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 51 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
| 52 | - add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 ); |
|
| 53 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 ); |
|
| 47 | + add_action('lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11); |
|
| 48 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
| 49 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
| 50 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
| 51 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
| 52 | + add_filter('lsx_display_global_header_description', array($this, 'disable_global_header_description'), 100); |
|
| 53 | + add_filter('woocommerce_get_breadcrumb', array($this, 'recipes_breadcrumb_filter'), 30, 1); |
|
| 54 | 54 | |
| 55 | 55 | // Backend Actions and Filters. |
| 56 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) ); |
|
| 57 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 58 | - add_action( 'cmb2_admin_init', array( $this, 'recipes_connections' ), 5 ); |
|
| 59 | - add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 9, 1 ); |
|
| 56 | + add_action('cmb2_admin_init', array($this, 'featured_metabox')); |
|
| 57 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
| 58 | + add_action('cmb2_admin_init', array($this, 'recipes_connections'), 5); |
|
| 59 | + add_action('lsx_hp_settings_page', array($this, 'register_settings'), 9, 1); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public static function get_instance() { |
| 70 | 70 | |
| 71 | 71 | // If the single instance hasn't been set, set it now. |
| 72 | - if ( null === self::$instance ) { |
|
| 72 | + if (null === self::$instance) { |
|
| 73 | 73 | self::$instance = new self(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -82,21 +82,21 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function register_post_type() { |
| 84 | 84 | $this->labels = array( |
| 85 | - 'name' => esc_html__( 'Recipe', 'lsx-health-plan' ), |
|
| 86 | - 'singular_name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 87 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 88 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 89 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 90 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 91 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 92 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 93 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 94 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 95 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 85 | + 'name' => esc_html__('Recipe', 'lsx-health-plan'), |
|
| 86 | + 'singular_name' => esc_html__('Recipes', 'lsx-health-plan'), |
|
| 87 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
| 88 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 89 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 90 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
| 91 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 92 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
| 93 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 94 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
| 95 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
| 96 | 96 | 'parent_item_colon' => '', |
| 97 | - 'menu_name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 97 | + 'menu_name' => esc_html__('Recipes', 'lsx-health-plan'), |
|
| 98 | 98 | ); |
| 99 | - $args = array( |
|
| 99 | + $args = array( |
|
| 100 | 100 | 'labels' => $this->labels, |
| 101 | 101 | 'public' => true, |
| 102 | 102 | 'publicly_queryable' => true, |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | 'thumbnail', |
| 119 | 119 | ), |
| 120 | 120 | ); |
| 121 | - register_post_type( 'recipe', $args ); |
|
| 121 | + register_post_type('recipe', $args); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | 129 | public function register_menus() { |
| 130 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' ); |
|
| 131 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Types', 'lsx-health-plan' ), esc_html__( 'Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' ); |
|
| 132 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' ); |
|
| 130 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Recipes', 'lsx-health-plan'), esc_html__('Recipes', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=recipe'); |
|
| 131 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Types', 'lsx-health-plan'), esc_html__('Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe'); |
|
| 132 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Cuisines', 'lsx-health-plan'), esc_html__('Cuisines', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -137,19 +137,19 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function taxonomy_setup() { |
| 139 | 139 | $labels = array( |
| 140 | - 'name' => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 141 | - 'singular_name' => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 142 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 143 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 144 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 145 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 146 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 147 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 148 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 149 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 150 | - 'menu_name' => esc_html__( 'Cuisines', 'lsx-health-plan' ), |
|
| 140 | + 'name' => esc_html_x('Cuisine', 'taxonomy general name', 'lsx-health-plan'), |
|
| 141 | + 'singular_name' => esc_html_x('Cuisines', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 142 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 143 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 144 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 145 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 146 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 147 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 148 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 149 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 150 | + 'menu_name' => esc_html__('Cuisines', 'lsx-health-plan'), |
|
| 151 | 151 | ); |
| 152 | - $args = array( |
|
| 152 | + $args = array( |
|
| 153 | 153 | 'hierarchical' => true, |
| 154 | 154 | 'labels' => $labels, |
| 155 | 155 | 'show_ui' => true, |
@@ -160,22 +160,22 @@ discard block |
||
| 160 | 160 | 'slug' => 'recipe-cuisine', |
| 161 | 161 | ), |
| 162 | 162 | ); |
| 163 | - register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args ); |
|
| 163 | + register_taxonomy('recipe-cuisine', array($this->slug), $args); |
|
| 164 | 164 | |
| 165 | 165 | $labels = array( |
| 166 | - 'name' => esc_html_x( 'Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 167 | - 'singular_name' => esc_html_x( 'Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 168 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 169 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 170 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 171 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 172 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 173 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 174 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 175 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 176 | - 'menu_name' => esc_html__( 'Types', 'lsx-health-plan' ), |
|
| 166 | + 'name' => esc_html_x('Type', 'taxonomy general name', 'lsx-health-plan'), |
|
| 167 | + 'singular_name' => esc_html_x('Types', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 168 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 169 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 170 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 171 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 172 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 173 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 174 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 175 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 176 | + 'menu_name' => esc_html__('Types', 'lsx-health-plan'), |
|
| 177 | 177 | ); |
| 178 | - $args = array( |
|
| 178 | + $args = array( |
|
| 179 | 179 | 'hierarchical' => true, |
| 180 | 180 | 'labels' => $labels, |
| 181 | 181 | 'show_ui' => true, |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | 'slug' => 'recipe-type', |
| 187 | 187 | ), |
| 188 | 188 | ); |
| 189 | - register_taxonomy( 'recipe-type', array( $this->slug ), $args ); |
|
| 189 | + register_taxonomy('recipe-type', array($this->slug), $args); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param array $post_types |
| 196 | 196 | * @return array |
| 197 | 197 | */ |
| 198 | - public function enable_post_type( $post_types = array() ) { |
|
| 198 | + public function enable_post_type($post_types = array()) { |
|
| 199 | 199 | $post_types[] = $this->slug; |
| 200 | 200 | return $post_types; |
| 201 | 201 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param array $connections |
| 207 | 207 | * @return void |
| 208 | 208 | */ |
| 209 | - public function enable_connections( $connections = array() ) { |
|
| 209 | + public function enable_connections($connections = array()) { |
|
| 210 | 210 | $connections['recipe']['connected_plans'] = 'connected_recipes'; |
| 211 | 211 | $connections['plan']['connected_recipes'] = 'connected_plans'; |
| 212 | 212 | return $connections; |
@@ -218,17 +218,17 @@ discard block |
||
| 218 | 218 | * @param string $title the term title. |
| 219 | 219 | * @return string |
| 220 | 220 | */ |
| 221 | - public function get_the_archive_title( $title ) { |
|
| 222 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 223 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 221 | + public function get_the_archive_title($title) { |
|
| 222 | + if (is_post_type_archive('recipe')) { |
|
| 223 | + $title = __('Recipes', 'lsx-health-plan'); |
|
| 224 | 224 | } |
| 225 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
| 226 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 225 | + if (is_post_type_archive('exercise')) { |
|
| 226 | + $title = __('Exercises', 'lsx-health-plan'); |
|
| 227 | 227 | } |
| 228 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 228 | + if (is_tax('recipe-type')) { |
|
| 229 | 229 | $queried_object = get_queried_object(); |
| 230 | - if ( isset( $queried_object->name ) ) { |
|
| 231 | - $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' ); |
|
| 230 | + if (isset($queried_object->name)) { |
|
| 231 | + $title = $queried_object->name . ' ' . __('Recipes', 'lsx-health-plan'); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | return $title; |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | * @param boolean $disable |
| 241 | 241 | * @return boolean |
| 242 | 242 | */ |
| 243 | - public function disable_global_header_description( $disable ) { |
|
| 244 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 243 | + public function disable_global_header_description($disable) { |
|
| 244 | + if (is_tax('recipe-type')) { |
|
| 245 | 245 | $disable = true; |
| 246 | 246 | } |
| 247 | 247 | return $disable; |
@@ -253,11 +253,11 @@ discard block |
||
| 253 | 253 | * @var array $crumbs |
| 254 | 254 | * @return array |
| 255 | 255 | */ |
| 256 | - public function recipes_breadcrumb_filter( $crumbs ) { |
|
| 257 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 256 | + public function recipes_breadcrumb_filter($crumbs) { |
|
| 257 | + if (is_tax('recipe-type')) { |
|
| 258 | 258 | $text = $this->labels['singular_name']; |
| 259 | - $url = get_post_type_archive_link( 'recipe' ); |
|
| 260 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 259 | + $url = get_post_type_archive_link('recipe'); |
|
| 260 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 261 | 261 | $crumbs[1] = array( |
| 262 | 262 | 0 => $text, |
| 263 | 263 | 1 => $url, |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | $cmb = new_cmb2_box( |
| 280 | 280 | array( |
| 281 | 281 | 'id' => $this->slug . '_featured_metabox', |
| 282 | - 'title' => __( 'Featured', 'lsx-health-plan' ), |
|
| 283 | - 'object_types' => array( $this->slug ), |
|
| 282 | + 'title' => __('Featured', 'lsx-health-plan'), |
|
| 283 | + 'object_types' => array($this->slug), |
|
| 284 | 284 | 'context' => 'side', |
| 285 | 285 | 'priority' => 'high', |
| 286 | 286 | 'show_names' => true, |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | ); |
| 289 | 289 | $cmb->add_field( |
| 290 | 290 | array( |
| 291 | - 'name' => __( 'Featured', 'lsx-health-plan' ), |
|
| 292 | - 'desc' => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ), |
|
| 291 | + 'name' => __('Featured', 'lsx-health-plan'), |
|
| 292 | + 'desc' => __('Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan'), |
|
| 293 | 293 | 'id' => $this->slug . '_featured', |
| 294 | 294 | 'type' => 'checkbox', |
| 295 | 295 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | $cmb = new_cmb2_box( |
| 305 | 305 | array( |
| 306 | 306 | 'id' => $this->slug . '_details_metabox', |
| 307 | - 'title' => __( 'Cooking Info', 'lsx-health-plan' ), |
|
| 308 | - 'object_types' => array( $this->slug ), // Post type |
|
| 307 | + 'title' => __('Cooking Info', 'lsx-health-plan'), |
|
| 308 | + 'object_types' => array($this->slug), // Post type |
|
| 309 | 309 | 'context' => 'normal', |
| 310 | 310 | 'priority' => 'high', |
| 311 | 311 | 'show_names' => true, |
@@ -313,27 +313,27 @@ discard block |
||
| 313 | 313 | ); |
| 314 | 314 | $cmb->add_field( |
| 315 | 315 | array( |
| 316 | - 'name' => __( 'Prep Time', 'lsx-health-plan' ), |
|
| 316 | + 'name' => __('Prep Time', 'lsx-health-plan'), |
|
| 317 | 317 | 'id' => $this->slug . '_prep_time', |
| 318 | - 'desc' => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ), |
|
| 318 | + 'desc' => __('Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan'), |
|
| 319 | 319 | 'type' => 'text', |
| 320 | 320 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 321 | 321 | ) |
| 322 | 322 | ); |
| 323 | 323 | $cmb->add_field( |
| 324 | 324 | array( |
| 325 | - 'name' => __( 'Cooking Time', 'lsx-health-plan' ), |
|
| 325 | + 'name' => __('Cooking Time', 'lsx-health-plan'), |
|
| 326 | 326 | 'id' => $this->slug . '_cooking_time', |
| 327 | - 'desc' => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ), |
|
| 327 | + 'desc' => __('Add the cooking time i.e: 15 mins', 'lsx-health-plan'), |
|
| 328 | 328 | 'type' => 'text', |
| 329 | 329 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 330 | 330 | ) |
| 331 | 331 | ); |
| 332 | 332 | $cmb->add_field( |
| 333 | 333 | array( |
| 334 | - 'name' => __( 'Serves', 'lsx-health-plan' ), |
|
| 334 | + 'name' => __('Serves', 'lsx-health-plan'), |
|
| 335 | 335 | 'id' => $this->slug . '_serves', |
| 336 | - 'desc' => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ), |
|
| 336 | + 'desc' => __('Add the recommended serving size i.e: 6', 'lsx-health-plan'), |
|
| 337 | 337 | 'type' => 'text', |
| 338 | 338 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 339 | 339 | 'attributes' => array( |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | ); |
| 345 | 345 | $cmb->add_field( |
| 346 | 346 | array( |
| 347 | - 'name' => __( 'Portion', 'lsx-health-plan' ), |
|
| 348 | - 'desc' => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ), |
|
| 347 | + 'name' => __('Portion', 'lsx-health-plan'), |
|
| 348 | + 'desc' => __('Add the recommended portion size i.e: 200mg', 'lsx-health-plan'), |
|
| 349 | 349 | 'id' => $this->slug . '_portion', |
| 350 | 350 | 'type' => 'text', |
| 351 | 351 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -354,8 +354,8 @@ discard block |
||
| 354 | 354 | $cmb = new_cmb2_box( |
| 355 | 355 | array( |
| 356 | 356 | 'id' => $this->slug . '_nutritional_metabox', |
| 357 | - 'title' => __( 'Nutritional Info', 'lsx-health-plan' ), |
|
| 358 | - 'object_types' => array( $this->slug ), // Post type |
|
| 357 | + 'title' => __('Nutritional Info', 'lsx-health-plan'), |
|
| 358 | + 'object_types' => array($this->slug), // Post type |
|
| 359 | 359 | 'context' => 'normal', |
| 360 | 360 | 'priority' => 'high', |
| 361 | 361 | 'show_names' => true, |
@@ -363,45 +363,45 @@ discard block |
||
| 363 | 363 | ); |
| 364 | 364 | $cmb->add_field( |
| 365 | 365 | array( |
| 366 | - 'name' => __( 'Energy', 'lsx-health-plan' ), |
|
| 366 | + 'name' => __('Energy', 'lsx-health-plan'), |
|
| 367 | 367 | 'id' => $this->slug . '_energy', |
| 368 | - 'desc' => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ), |
|
| 368 | + 'desc' => __('Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan'), |
|
| 369 | 369 | 'type' => 'text', |
| 370 | 370 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 371 | 371 | ) |
| 372 | 372 | ); |
| 373 | 373 | $cmb->add_field( |
| 374 | 374 | array( |
| 375 | - 'name' => __( 'Protein', 'lsx-health-plan' ), |
|
| 375 | + 'name' => __('Protein', 'lsx-health-plan'), |
|
| 376 | 376 | 'id' => $this->slug . '_protein', |
| 377 | - 'desc' => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ), |
|
| 377 | + 'desc' => __('Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan'), |
|
| 378 | 378 | 'type' => 'text', |
| 379 | 379 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 380 | 380 | ) |
| 381 | 381 | ); |
| 382 | 382 | $cmb->add_field( |
| 383 | 383 | array( |
| 384 | - 'name' => __( 'Carbohydrates', 'lsx-health-plan' ), |
|
| 384 | + 'name' => __('Carbohydrates', 'lsx-health-plan'), |
|
| 385 | 385 | 'id' => $this->slug . '_carbohydrates', |
| 386 | - 'desc' => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 386 | + 'desc' => __('Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan'), |
|
| 387 | 387 | 'type' => 'text', |
| 388 | 388 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 389 | 389 | ) |
| 390 | 390 | ); |
| 391 | 391 | $cmb->add_field( |
| 392 | 392 | array( |
| 393 | - 'name' => __( 'Fibre', 'lsx-health-plan' ), |
|
| 393 | + 'name' => __('Fibre', 'lsx-health-plan'), |
|
| 394 | 394 | 'id' => $this->slug . '_fibre', |
| 395 | - 'desc' => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 395 | + 'desc' => __('Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan'), |
|
| 396 | 396 | 'type' => 'text', |
| 397 | 397 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 398 | 398 | ) |
| 399 | 399 | ); |
| 400 | 400 | $cmb->add_field( |
| 401 | 401 | array( |
| 402 | - 'name' => __( 'Fat', 'lsx-health-plan' ), |
|
| 402 | + 'name' => __('Fat', 'lsx-health-plan'), |
|
| 403 | 403 | 'id' => $this->slug . '_fat', |
| 404 | - 'desc' => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ), |
|
| 404 | + 'desc' => __('Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan'), |
|
| 405 | 405 | 'type' => 'text', |
| 406 | 406 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 407 | 407 | ) |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | $cmb = new_cmb2_box( |
| 418 | 418 | array( |
| 419 | 419 | 'id' => $this->slug . '_recipes_connections_metabox', |
| 420 | - 'title' => __( 'Recipes', 'lsx-health-plan' ), |
|
| 421 | - 'object_types' => array( 'plan' ), // Post type |
|
| 420 | + 'title' => __('Recipes', 'lsx-health-plan'), |
|
| 421 | + 'object_types' => array('plan'), // Post type |
|
| 422 | 422 | 'context' => 'normal', |
| 423 | 423 | 'priority' => 'high', |
| 424 | 424 | 'show_names' => true, |
@@ -426,16 +426,16 @@ discard block |
||
| 426 | 426 | ); |
| 427 | 427 | $cmb->add_field( |
| 428 | 428 | array( |
| 429 | - 'name' => __( 'Recipes', 'lsx-health-plan' ), |
|
| 430 | - 'desc' => __( 'Connect the recipes that apply to this day plan using the field provided.', 'lsx-health-plan' ), |
|
| 429 | + 'name' => __('Recipes', 'lsx-health-plan'), |
|
| 430 | + 'desc' => __('Connect the recipes that apply to this day plan using the field provided.', 'lsx-health-plan'), |
|
| 431 | 431 | 'id' => 'connected_recipes', |
| 432 | 432 | 'type' => 'post_search_ajax', |
| 433 | 433 | // Optional : |
| 434 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 434 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 435 | 435 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 436 | 436 | 'query_args' => array( |
| 437 | - 'post_type' => array( $this->slug ), |
|
| 438 | - 'post_status' => array( 'publish' ), |
|
| 437 | + 'post_type' => array($this->slug), |
|
| 438 | + 'post_status' => array('publish'), |
|
| 439 | 439 | 'posts_per_page' => -1, |
| 440 | 440 | ), |
| 441 | 441 | ) |
@@ -448,24 +448,24 @@ discard block |
||
| 448 | 448 | * @param object $cmb new_cmb2_box(). |
| 449 | 449 | * @return void |
| 450 | 450 | */ |
| 451 | - public function register_settings( $cmb ) { |
|
| 451 | + public function register_settings($cmb) { |
|
| 452 | 452 | $cmb->add_field( |
| 453 | 453 | array( |
| 454 | 454 | 'id' => 'recipe_archive_settings_title', |
| 455 | 455 | 'type' => 'title', |
| 456 | - 'name' => __( 'Recipes Archive', 'lsx-health-plan' ), |
|
| 457 | - 'description' => __( 'All of the settings relating to the recipes post type archive.', 'lsx-health-plan' ), |
|
| 456 | + 'name' => __('Recipes Archive', 'lsx-health-plan'), |
|
| 457 | + 'description' => __('All of the settings relating to the recipes post type archive.', 'lsx-health-plan'), |
|
| 458 | 458 | ) |
| 459 | 459 | ); |
| 460 | 460 | $cmb->add_field( |
| 461 | 461 | array( |
| 462 | 462 | 'id' => 'recipe_archive_description', |
| 463 | 463 | 'type' => 'wysiwyg', |
| 464 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 465 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 464 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
| 465 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
| 466 | 466 | ) |
| 467 | 467 | ); |
| 468 | - do_action( 'lsx_hp_recipe_settings_page', $cmb ); |
|
| 468 | + do_action('lsx_hp_recipe_settings_page', $cmb); |
|
| 469 | 469 | $cmb->add_field( |
| 470 | 470 | array( |
| 471 | 471 | 'id' => 'settings_recipe_archive_closing', |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * Contructor |
| 31 | 31 | */ |
| 32 | 32 | public function __construct() { |
| 33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 34 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 35 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 36 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) ); |
|
| 37 | - add_action( 'cmb2_admin_init', array( $this, 'tips_connections' ), 15 ); |
|
| 33 | + add_action('init', array($this, 'register_post_type')); |
|
| 34 | + add_action('admin_menu', array($this, 'register_menus')); |
|
| 35 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
| 36 | + add_action('cmb2_admin_init', array($this, 'featured_metabox')); |
|
| 37 | + add_action('cmb2_admin_init', array($this, 'tips_connections'), 15); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public static function get_instance() { |
| 48 | 48 | // If the single instance hasn't been set, set it now. |
| 49 | - if ( null === self::$instance ) { |
|
| 49 | + if (null === self::$instance) { |
|
| 50 | 50 | self::$instance = new self(); |
| 51 | 51 | } |
| 52 | 52 | return self::$instance; |
@@ -56,21 +56,21 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function register_post_type() { |
| 58 | 58 | $labels = array( |
| 59 | - 'name' => esc_html__( 'Tip', 'lsx-health-plan' ), |
|
| 60 | - 'singular_name' => esc_html__( 'Tips', 'lsx-health-plan' ), |
|
| 61 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 62 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 63 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 64 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 65 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 66 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 67 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 68 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 69 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 59 | + 'name' => esc_html__('Tip', 'lsx-health-plan'), |
|
| 60 | + 'singular_name' => esc_html__('Tips', 'lsx-health-plan'), |
|
| 61 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
| 62 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 63 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 64 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
| 65 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 66 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
| 67 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 68 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
| 69 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
| 70 | 70 | 'parent_item_colon' => '', |
| 71 | - 'menu_name' => esc_html__( 'Tips', 'lsx-health-plan' ), |
|
| 71 | + 'menu_name' => esc_html__('Tips', 'lsx-health-plan'), |
|
| 72 | 72 | ); |
| 73 | - $args = array( |
|
| 73 | + $args = array( |
|
| 74 | 74 | 'labels' => $labels, |
| 75 | 75 | 'public' => true, |
| 76 | 76 | 'publicly_queryable' => false, |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'thumbnail', |
| 91 | 91 | ), |
| 92 | 92 | ); |
| 93 | - register_post_type( 'tip', $args ); |
|
| 93 | + register_post_type('tip', $args); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | 101 | public function register_menus() { |
| 102 | - add_submenu_page( 'edit.php?post_type=plan', esc_html__( 'Tips', 'lsx-health-plan' ), esc_html__( 'Tips', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=tip' ); |
|
| 102 | + add_submenu_page('edit.php?post_type=plan', esc_html__('Tips', 'lsx-health-plan'), esc_html__('Tips', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=tip'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param array $connections |
| 109 | 109 | * @return void |
| 110 | 110 | */ |
| 111 | - public function enable_connections( $connections = array() ) { |
|
| 111 | + public function enable_connections($connections = array()) { |
|
| 112 | 112 | $connections['tip']['connected_plans'] = 'connected_tips'; |
| 113 | 113 | $connections['plan']['connected_tips'] = 'connected_plans'; |
| 114 | 114 | return $connections; |
@@ -120,49 +120,49 @@ discard block |
||
| 120 | 120 | * @return void |
| 121 | 121 | */ |
| 122 | 122 | public function tips_connections() { |
| 123 | - $cmb = new_cmb2_box( array( |
|
| 123 | + $cmb = new_cmb2_box(array( |
|
| 124 | 124 | 'id' => $this->slug . '_tips_connections_metabox', |
| 125 | - 'title' => __( 'Tips', 'lsx-health-plan' ), |
|
| 126 | - 'object_types' => array( 'plan' ), // Post type |
|
| 125 | + 'title' => __('Tips', 'lsx-health-plan'), |
|
| 126 | + 'object_types' => array('plan'), // Post type |
|
| 127 | 127 | 'context' => 'normal', |
| 128 | 128 | 'priority' => 'high', |
| 129 | 129 | 'show_names' => false, |
| 130 | - ) ); |
|
| 131 | - $cmb->add_field( array( |
|
| 132 | - 'name' => __( 'Tips', 'lsx-health-plan' ), |
|
| 130 | + )); |
|
| 131 | + $cmb->add_field(array( |
|
| 132 | + 'name' => __('Tips', 'lsx-health-plan'), |
|
| 133 | 133 | 'id' => 'connected_tips', |
| 134 | - 'desc' => __( 'Connect the tips that apply to this day plan using the field provided.', 'lsx-health-plan' ), |
|
| 134 | + 'desc' => __('Connect the tips that apply to this day plan using the field provided.', 'lsx-health-plan'), |
|
| 135 | 135 | 'type' => 'post_search_ajax', |
| 136 | 136 | // Optional : |
| 137 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 138 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
| 137 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 138 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
| 139 | 139 | 'query_args' => array( |
| 140 | - 'post_type' => array( 'tip' ), |
|
| 141 | - 'post_status' => array( 'publish' ), |
|
| 140 | + 'post_type' => array('tip'), |
|
| 141 | + 'post_status' => array('publish'), |
|
| 142 | 142 | 'posts_per_page' => -1, |
| 143 | 143 | ), |
| 144 | - ) ); |
|
| 144 | + )); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * Define the metabox and field configurations. |
| 149 | 149 | */ |
| 150 | 150 | public function featured_metabox() { |
| 151 | - $cmb = new_cmb2_box( array( |
|
| 151 | + $cmb = new_cmb2_box(array( |
|
| 152 | 152 | 'id' => $this->slug . '_featured_metabox_tip', |
| 153 | - 'title' => __( 'Featured', 'lsx-health-plan' ), |
|
| 154 | - 'object_types' => array( $this->slug ), // Post type |
|
| 153 | + 'title' => __('Featured', 'lsx-health-plan'), |
|
| 154 | + 'object_types' => array($this->slug), // Post type |
|
| 155 | 155 | 'context' => 'side', |
| 156 | 156 | 'priority' => 'high', |
| 157 | 157 | 'show_names' => true, |
| 158 | - ) ); |
|
| 159 | - $cmb->add_field( array( |
|
| 160 | - 'name' => __( 'Featured', 'lsx-health-plan' ), |
|
| 161 | - 'desc' => __( 'Enable the checkbox to feature this tip, featured tips display in any page that has the tip shortcode: [lsx_health_plan_featured_tips_block]' ), |
|
| 158 | + )); |
|
| 159 | + $cmb->add_field(array( |
|
| 160 | + 'name' => __('Featured', 'lsx-health-plan'), |
|
| 161 | + 'desc' => __('Enable the checkbox to feature this tip, featured tips display in any page that has the tip shortcode: [lsx_health_plan_featured_tips_block]'), |
|
| 162 | 162 | 'id' => $this->slug . '_featured_tip', |
| 163 | 163 | 'type' => 'checkbox', |
| 164 | 164 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 165 | - ) ); |
|
| 165 | + )); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | } |