@@ -6,29 +6,29 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | |
| 9 | -$this_post_type = get_post_type( get_the_ID() ); |
|
| 9 | +$this_post_type = get_post_type(get_the_ID()); |
|
| 10 | 10 | |
| 11 | -$connected_tips = get_post_meta( get_the_ID(), ( $this_post_type . '_connected_tips' ), true ); |
|
| 11 | +$connected_tips = get_post_meta(get_the_ID(), ($this_post_type . '_connected_tips'), true); |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | <div id="lsx-tips-shortcode" class="daily-plan-block"> |
| 15 | 15 | <div class="lsx-tips-shortcode lsx-tips-slider slick-slider slick-dotted" > |
| 16 | 16 | <?php |
| 17 | 17 | |
| 18 | - foreach ( $connected_tips as $tip ) { |
|
| 19 | - $tip_link = get_permalink( $tip ); |
|
| 20 | - $tip_name = get_the_title( $tip ); |
|
| 21 | - $tip_content = get_post_field( 'post_content', $tip ); |
|
| 18 | + foreach ($connected_tips as $tip) { |
|
| 19 | + $tip_link = get_permalink($tip); |
|
| 20 | + $tip_name = get_the_title($tip); |
|
| 21 | + $tip_content = get_post_field('post_content', $tip); |
|
| 22 | 22 | $icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg'; |
| 23 | 23 | ?> |
| 24 | 24 | <div class="content-box diet-tip-wrapper quick-tip"> |
| 25 | 25 | <div class="row"> |
| 26 | 26 | <div class="col-xs-2"> |
| 27 | - <img loading="lazy" src="<?php echo esc_url( $icon ); ?>" alt="tip"/> |
|
| 27 | + <img loading="lazy" src="<?php echo esc_url($icon); ?>" alt="tip"/> |
|
| 28 | 28 | </div> |
| 29 | 29 | <div class="col-xs-10"> |
| 30 | - <h3 class="tip-title"><?php echo esc_html( $tip_name ); ?></h3> |
|
| 31 | - <?php echo wp_kses_post( $tip_content ); ?> |
|
| 30 | + <h3 class="tip-title"><?php echo esc_html($tip_name); ?></h3> |
|
| 31 | + <?php echo wp_kses_post($tip_content); ?> |
|
| 32 | 32 | </div> |
| 33 | 33 | </div> |
| 34 | 34 | </div> |
@@ -17,47 +17,47 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $plan_id = get_the_ID(); |
| 19 | 19 | $has_sections = \lsx_health_plan\functions\plan\has_sections(); |
| 20 | -$has_parent = wp_get_post_parent_id( $plan_id ); |
|
| 20 | +$has_parent = wp_get_post_parent_id($plan_id); |
|
| 21 | 21 | $restricted = false; |
| 22 | -$is_section = get_query_var( 'section', false ); |
|
| 22 | +$is_section = get_query_var('section', false); |
|
| 23 | 23 | |
| 24 | 24 | // Getting translated endpoint. |
| 25 | -$plan = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ); |
|
| 25 | +$plan = \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'); |
|
| 26 | 26 | |
| 27 | -$connected_members = get_post_meta( get_the_ID(), ( $plan . '_connected_team_member' ), true ); |
|
| 28 | -$connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true ); |
|
| 27 | +$connected_members = get_post_meta(get_the_ID(), ($plan . '_connected_team_member'), true); |
|
| 28 | +$connected_articles = get_post_meta(get_the_ID(), ($plan . '_connected_articles'), true); |
|
| 29 | 29 | |
| 30 | -if ( ! empty( $has_sections ) ) { |
|
| 30 | +if ( ! empty($has_sections)) { |
|
| 31 | 31 | $plan_type_class = 'parent-plan'; |
| 32 | - if ( 0 !== $has_parent ) { |
|
| 32 | + if (0 !== $has_parent) { |
|
| 33 | 33 | $plan_type_class = 'parent-sub-plan'; |
| 34 | 34 | } |
| 35 | 35 | } else { |
| 36 | 36 | $plan_type_class = 'unique-plan'; |
| 37 | - if ( 0 !== $has_parent ) { |
|
| 37 | + if (0 !== $has_parent) { |
|
| 38 | 38 | $plan_type_class = 'child-plan-' . $has_parent; |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // Get the plan restrictions. |
| 43 | -if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
| 44 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 43 | +if (function_exists('wc_memberships_is_post_content_restricted') && wc_memberships_is_post_content_restricted(get_the_ID())) { |
|
| 44 | + $restricted = ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
| 45 | 45 | } |
| 46 | -if ( false === $restricted ) { |
|
| 47 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 46 | +if (false === $restricted) { |
|
| 47 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
| 48 | 48 | } |
| 49 | 49 | ?> |
| 50 | 50 | |
| 51 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 51 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 52 | 52 | |
| 53 | 53 | <?php lsx_content_before(); ?> |
| 54 | 54 | |
| 55 | - <main id="main" class="site-main <?php echo esc_html( $plan_type_class ); ?>" role="main"> |
|
| 55 | + <main id="main" class="site-main <?php echo esc_html($plan_type_class); ?>" role="main"> |
|
| 56 | 56 | |
| 57 | 57 | <?php lsx_content_top(); ?> |
| 58 | 58 | |
| 59 | 59 | <?php |
| 60 | - if ( ! empty( $has_sections ) && false === $is_section ) { |
|
| 60 | + if ( ! empty($has_sections) && false === $is_section) { |
|
| 61 | 61 | ?> |
| 62 | 62 | <div class="post-wrapper"> |
| 63 | 63 | <div class="plan-content"> |
@@ -67,32 +67,32 @@ discard block |
||
| 67 | 67 | <div class="entry-content"> |
| 68 | 68 | <div class="single-plan-inner main-plan-content"> |
| 69 | 69 | <div class="single-plan-section-title title-lined"> |
| 70 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
| 70 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
| 71 | 71 | <h2><?php the_title(); ?></h2> |
| 72 | 72 | </div> |
| 73 | 73 | <div class="plan"> |
| 74 | 74 | <?php |
| 75 | 75 | |
| 76 | 76 | // The top part |
| 77 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_main_content() ) ); |
|
| 77 | + echo wp_kses_post(wp_kses_post(lsx_health_plan_main_content())); |
|
| 78 | 78 | |
| 79 | - echo wp_kses_post( '<h3 class="my-plan-title">' . __( 'Your Game Plan', 'lsx-health-plan' ) . '</h3>' ); |
|
| 79 | + echo wp_kses_post('<h3 class="my-plan-title">' . __('Your Game Plan', 'lsx-health-plan') . '</h3>'); |
|
| 80 | 80 | |
| 81 | 81 | ?> |
| 82 | 82 | <div class="the-plan-content"> |
| 83 | 83 | <?php |
| 84 | - if ( false === $restricted ) { |
|
| 85 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 84 | + if (false === $restricted) { |
|
| 85 | + echo wp_kses_post('<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '" max="100"> ' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '% </progress><span>' . $round_progress . '%</span></span>'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
| 88 | + echo do_shortcode('[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]'); |
|
| 89 | 89 | |
| 90 | 90 | ?> |
| 91 | 91 | <div class="row status-plan-buttons main-plan-btn"> |
| 92 | 92 | <?php |
| 93 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 93 | + if (function_exists('wc_get_page_id')) { |
|
| 94 | 94 | ?> |
| 95 | - <a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a> |
|
| 95 | + <a class="btn border-btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a> |
|
| 96 | 96 | <?php |
| 97 | 97 | } |
| 98 | 98 | ?> |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | <?php lsx_content_bottom(); ?> |
| 123 | 123 | |
| 124 | 124 | <?php |
| 125 | - if ( ! empty( $connected_articles ) ) { |
|
| 126 | - lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
| 125 | + if ( ! empty($connected_articles)) { |
|
| 126 | + lsx_hp_single_related($connected_articles, __('Latest articles', 'lsx-health-plan')); |
|
| 127 | 127 | } |
| 128 | 128 | ?> |
| 129 | 129 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | * Contructor |
| 31 | 31 | */ |
| 32 | 32 | public function __construct() { |
| 33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 34 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
| 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 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
| 38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 33 | + add_action('init', array($this, 'register_post_type')); |
|
| 34 | + add_action('init', array($this, 'taxonomy_setup')); |
|
| 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 | + add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5); |
|
| 38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public static function get_instance() { |
| 49 | 49 | // If the single instance hasn't been set, set it now. |
| 50 | - if ( null === self::$instance ) { |
|
| 50 | + if (null === self::$instance) { |
|
| 51 | 51 | self::$instance = new self(); |
| 52 | 52 | } |
| 53 | 53 | return self::$instance; |
@@ -57,21 +57,21 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function register_post_type() { |
| 59 | 59 | $labels = array( |
| 60 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
| 61 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
| 62 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 63 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 64 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 65 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 66 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
| 67 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 68 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 69 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 70 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 60 | + 'name' => esc_html__('Meals', 'lsx-health-plan'), |
|
| 61 | + 'singular_name' => esc_html__('Meal', 'lsx-health-plan'), |
|
| 62 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
| 63 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 64 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 65 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
| 66 | + 'all_items' => esc_html__('All Meals', 'lsx-health-plan'), |
|
| 67 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
| 68 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 69 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
| 70 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
| 71 | 71 | 'parent_item_colon' => '', |
| 72 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
| 72 | + 'menu_name' => esc_html__('Meals', 'lsx-health-plan'), |
|
| 73 | 73 | ); |
| 74 | - $args = array( |
|
| 74 | + $args = array( |
|
| 75 | 75 | 'labels' => $labels, |
| 76 | 76 | 'public' => true, |
| 77 | 77 | 'publicly_queryable' => true, |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | 'menu_icon' => 'dashicons-carrot', |
| 82 | 82 | 'query_var' => true, |
| 83 | 83 | 'rewrite' => array( |
| 84 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
| 84 | + 'slug' => \lsx_health_plan\functions\get_option('meal_single_slug', 'meal'), |
|
| 85 | 85 | ), |
| 86 | 86 | 'capability_type' => 'post', |
| 87 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
| 87 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'), |
|
| 88 | 88 | 'hierarchical' => true, |
| 89 | 89 | 'menu_position' => null, |
| 90 | 90 | 'supports' => array( |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'custom-fields', |
| 96 | 96 | ), |
| 97 | 97 | ); |
| 98 | - register_post_type( 'meal', $args ); |
|
| 98 | + register_post_type('meal', $args); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,19 +103,19 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function taxonomy_setup() { |
| 105 | 105 | $labels = array( |
| 106 | - 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 107 | - 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 108 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 109 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 110 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 111 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 112 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 113 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 114 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 115 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 116 | - 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
| 106 | + 'name' => esc_html_x('Meal Type', 'taxonomy general name', 'lsx-health-plan'), |
|
| 107 | + 'singular_name' => esc_html_x('Meal Types', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 108 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 109 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 110 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 111 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 112 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 113 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 114 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 115 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 116 | + 'menu_name' => esc_html__('Meal Types', 'lsx-health-plan'), |
|
| 117 | 117 | ); |
| 118 | - $args = array( |
|
| 118 | + $args = array( |
|
| 119 | 119 | 'hierarchical' => true, |
| 120 | 120 | 'labels' => $labels, |
| 121 | 121 | 'show_ui' => true, |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 'slug' => 'meal-type', |
| 127 | 127 | ), |
| 128 | 128 | ); |
| 129 | - register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
| 129 | + register_taxonomy('meal-type', array($this->slug), $args); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param array $post_types |
| 136 | 136 | * @return array |
| 137 | 137 | */ |
| 138 | - public function enable_post_type( $post_types = array() ) { |
|
| 138 | + public function enable_post_type($post_types = array()) { |
|
| 139 | 139 | $post_types[] = $this->slug; |
| 140 | 140 | return $post_types; |
| 141 | 141 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param array $connections |
| 147 | 147 | * @return void |
| 148 | 148 | */ |
| 149 | - public function enable_connections( $connections = array() ) { |
|
| 149 | + public function enable_connections($connections = array()) { |
|
| 150 | 150 | $connections['meal']['connected_plans'] = 'connected_meals'; |
| 151 | 151 | $connections['plan']['connected_meals'] = 'connected_plans'; |
| 152 | 152 | return $connections; |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | $cmb = new_cmb2_box( |
| 160 | 160 | array( |
| 161 | 161 | 'id' => $this->slug . '_featured_metabox_meal', |
| 162 | - 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
| 163 | - 'object_types' => array( $this->slug ), // Post type |
|
| 162 | + 'title' => __('Featured Meal', 'lsx-health-plan'), |
|
| 163 | + 'object_types' => array($this->slug), // Post type |
|
| 164 | 164 | 'context' => 'side', |
| 165 | 165 | 'priority' => 'high', |
| 166 | 166 | 'show_names' => true, |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | ); |
| 169 | 169 | $cmb->add_field( |
| 170 | 170 | array( |
| 171 | - 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
| 172 | - 'desc' => __( 'Enable a featured meal' ), |
|
| 171 | + 'name' => __('Featured Meal', 'lsx-health-plan'), |
|
| 172 | + 'desc' => __('Enable a featured meal'), |
|
| 173 | 173 | 'id' => $this->slug . '_featured_meal', |
| 174 | 174 | 'type' => 'checkbox', |
| 175 | 175 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -181,66 +181,66 @@ discard block |
||
| 181 | 181 | * Define the metabox and field configurations. |
| 182 | 182 | */ |
| 183 | 183 | public function details_metaboxes() { |
| 184 | - $cmb = new_cmb2_box( array( |
|
| 184 | + $cmb = new_cmb2_box(array( |
|
| 185 | 185 | 'id' => $this->slug . '_shopping_list_metabox', |
| 186 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
| 187 | - 'object_types' => array( $this->slug ), // Post type |
|
| 186 | + 'title' => __('Shopping List', 'lsx-health-plan'), |
|
| 187 | + 'object_types' => array($this->slug), // Post type |
|
| 188 | 188 | 'context' => 'normal', |
| 189 | 189 | 'priority' => 'high', |
| 190 | 190 | 'show_names' => true, |
| 191 | - ) ); |
|
| 192 | - $cmb->add_field( array( |
|
| 193 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
| 194 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
| 191 | + )); |
|
| 192 | + $cmb->add_field(array( |
|
| 193 | + 'name' => __('Shopping List', 'lsx-health-plan'), |
|
| 194 | + 'desc' => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'), |
|
| 195 | 195 | 'id' => $this->slug . '_shopping_list', |
| 196 | 196 | 'type' => 'post_search_ajax', |
| 197 | 197 | // Optional : |
| 198 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
| 198 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
| 199 | 199 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 200 | 200 | 'query_args' => array( |
| 201 | - 'post_type' => array( 'page' ), |
|
| 202 | - 'post_status' => array( 'publish' ), |
|
| 201 | + 'post_type' => array('page'), |
|
| 202 | + 'post_status' => array('publish'), |
|
| 203 | 203 | 'posts_per_page' => -1, |
| 204 | 204 | ), |
| 205 | - ) ); |
|
| 206 | - $cmb = new_cmb2_box( array( |
|
| 205 | + )); |
|
| 206 | + $cmb = new_cmb2_box(array( |
|
| 207 | 207 | 'id' => $this->slug . '_details_metabox', |
| 208 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
| 209 | - 'object_types' => array( $this->slug ), // Post type |
|
| 208 | + 'title' => __('Meal Details', 'lsx-health-plan'), |
|
| 209 | + 'object_types' => array($this->slug), // Post type |
|
| 210 | 210 | 'context' => 'normal', |
| 211 | 211 | 'priority' => 'high', |
| 212 | 212 | 'show_names' => true, |
| 213 | - ) ); |
|
| 213 | + )); |
|
| 214 | 214 | |
| 215 | - $cmb->add_field( array( |
|
| 216 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
| 215 | + $cmb->add_field(array( |
|
| 216 | + 'name' => __('Meal Short Description', 'lsx-health-plan'), |
|
| 217 | 217 | 'id' => $this->slug . '_short_description', |
| 218 | 218 | 'type' => 'textarea_small', |
| 219 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
| 220 | - ) ); |
|
| 219 | + 'desc' => __('Add a small description for this meal (optional)', 'lsx-health-plan'), |
|
| 220 | + )); |
|
| 221 | 221 | |
| 222 | - $cmb->add_field( array( |
|
| 223 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
| 222 | + $cmb->add_field(array( |
|
| 223 | + 'name' => __('Pre Breakfast Snack', 'lsx-health-plan'), |
|
| 224 | 224 | 'id' => $this->slug . '_pre_breakfast_snack', |
| 225 | 225 | 'type' => 'wysiwyg', |
| 226 | 226 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 227 | 227 | 'options' => array( |
| 228 | 228 | 'textarea_rows' => 5, |
| 229 | 229 | ), |
| 230 | - ) ); |
|
| 231 | - $cmb->add_field( array( |
|
| 232 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
| 230 | + )); |
|
| 231 | + $cmb->add_field(array( |
|
| 232 | + 'name' => __('Breakfast', 'lsx-health-plan'), |
|
| 233 | 233 | 'id' => $this->slug . '_breakfast', |
| 234 | 234 | 'type' => 'wysiwyg', |
| 235 | 235 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 236 | 236 | 'options' => array( |
| 237 | 237 | 'textarea_rows' => 5, |
| 238 | 238 | ), |
| 239 | - ) ); |
|
| 239 | + )); |
|
| 240 | 240 | |
| 241 | 241 | $cmb->add_field( |
| 242 | 242 | array( |
| 243 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
| 243 | + 'name' => __('Post Breakfast Snack', 'lsx-health-plan'), |
|
| 244 | 244 | 'id' => $this->slug . '_breakfast_snack', |
| 245 | 245 | 'type' => 'wysiwyg', |
| 246 | 246 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -250,19 +250,19 @@ discard block |
||
| 250 | 250 | ) |
| 251 | 251 | ); |
| 252 | 252 | |
| 253 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 253 | + if (post_type_exists('recipe')) { |
|
| 254 | 254 | $cmb->add_field( |
| 255 | 255 | array( |
| 256 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
| 257 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
| 256 | + 'name' => __('Breakfast Recipes', 'lsx-health-plan'), |
|
| 257 | + 'desc' => __('Connect additional recipes options for breakfast.', 'lsx-health-plan'), |
|
| 258 | 258 | 'id' => 'breakfast_recipes', |
| 259 | 259 | 'type' => 'post_search_ajax', |
| 260 | 260 | // Optional : |
| 261 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 261 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 262 | 262 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 263 | 263 | 'query_args' => array( |
| 264 | - 'post_type' => array( 'recipe' ), |
|
| 265 | - 'post_status' => array( 'publish' ), |
|
| 264 | + 'post_type' => array('recipe'), |
|
| 265 | + 'post_status' => array('publish'), |
|
| 266 | 266 | 'posts_per_page' => -1, |
| 267 | 267 | ), |
| 268 | 268 | ) |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | $cmb->add_field( |
| 273 | 273 | array( |
| 274 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
| 274 | + 'name' => __('Pre Lunch Snack', 'lsx-health-plan'), |
|
| 275 | 275 | 'id' => $this->slug . '_pre_lunch_snack', |
| 276 | 276 | 'type' => 'wysiwyg', |
| 277 | 277 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | ); |
| 283 | 283 | $cmb->add_field( |
| 284 | 284 | array( |
| 285 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
| 285 | + 'name' => __('Lunch', 'lsx-health-plan'), |
|
| 286 | 286 | 'id' => $this->slug . '_lunch', |
| 287 | 287 | 'type' => 'wysiwyg', |
| 288 | 288 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | ); |
| 294 | 294 | $cmb->add_field( |
| 295 | 295 | array( |
| 296 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
| 296 | + 'name' => __('Post Lunch Snack', 'lsx-health-plan'), |
|
| 297 | 297 | 'id' => $this->slug . '_lunch_snack', |
| 298 | 298 | 'type' => 'wysiwyg', |
| 299 | 299 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -303,19 +303,19 @@ discard block |
||
| 303 | 303 | ) |
| 304 | 304 | ); |
| 305 | 305 | |
| 306 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 306 | + if (post_type_exists('recipe')) { |
|
| 307 | 307 | $cmb->add_field( |
| 308 | 308 | array( |
| 309 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
| 310 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
| 309 | + 'name' => __('Lunch Recipes', 'lsx-health-plan'), |
|
| 310 | + 'desc' => __('Connect additional recipes options for lunch.', 'lsx-health-plan'), |
|
| 311 | 311 | 'id' => 'lunch_recipes', |
| 312 | 312 | 'type' => 'post_search_ajax', |
| 313 | 313 | // Optional : |
| 314 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 314 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 315 | 315 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 316 | 316 | 'query_args' => array( |
| 317 | - 'post_type' => array( 'recipe' ), |
|
| 318 | - 'post_status' => array( 'publish' ), |
|
| 317 | + 'post_type' => array('recipe'), |
|
| 318 | + 'post_status' => array('publish'), |
|
| 319 | 319 | 'posts_per_page' => -1, |
| 320 | 320 | ), |
| 321 | 321 | ) |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | $cmb->add_field( |
| 326 | 326 | array( |
| 327 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
| 327 | + 'name' => __('Pre Dinner Snack', 'lsx-health-plan'), |
|
| 328 | 328 | 'id' => $this->slug . '_pre_dinner_snack', |
| 329 | 329 | 'type' => 'wysiwyg', |
| 330 | 330 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | ); |
| 336 | 336 | $cmb->add_field( |
| 337 | 337 | array( |
| 338 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
| 338 | + 'name' => __('Dinner', 'lsx-health-plan'), |
|
| 339 | 339 | 'id' => $this->slug . '_dinner', |
| 340 | 340 | 'type' => 'wysiwyg', |
| 341 | 341 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | ); |
| 347 | 347 | $cmb->add_field( |
| 348 | 348 | array( |
| 349 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
| 349 | + 'name' => __('Post Dinner Snack', 'lsx-health-plan'), |
|
| 350 | 350 | 'id' => $this->slug . '_dinner_snack', |
| 351 | 351 | 'type' => 'wysiwyg', |
| 352 | 352 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -356,19 +356,19 @@ discard block |
||
| 356 | 356 | ) |
| 357 | 357 | ); |
| 358 | 358 | |
| 359 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 359 | + if (post_type_exists('recipe')) { |
|
| 360 | 360 | $cmb->add_field( |
| 361 | 361 | array( |
| 362 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
| 363 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
| 362 | + 'name' => __('Dinner Recipes', 'lsx-health-plan'), |
|
| 363 | + 'desc' => __('Connect additional recipes options for dinner.', 'lsx-health-plan'), |
|
| 364 | 364 | 'id' => 'dinner_recipes', |
| 365 | 365 | 'type' => 'post_search_ajax', |
| 366 | 366 | // Optional : |
| 367 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 367 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
| 368 | 368 | 'sortable' => true, // Allow selected items to be sortable (default false) |
| 369 | 369 | 'query_args' => array( |
| 370 | - 'post_type' => array( 'recipe' ), |
|
| 371 | - 'post_status' => array( 'publish' ), |
|
| 370 | + 'post_type' => array('recipe'), |
|
| 371 | + 'post_status' => array('publish'), |
|
| 372 | 372 | 'posts_per_page' => -1, |
| 373 | 373 | ), |
| 374 | 374 | ) |