@@ -8,86 +8,86 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Setup { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Setup() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\Setup() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var object \lsx_health_plan\classes\Post_Type(); |
|
| 22 | - */ |
|
| 23 | - public $post_types; |
|
| 20 | + /** |
|
| 21 | + * @var object \lsx_health_plan\classes\Post_Type(); |
|
| 22 | + */ |
|
| 23 | + public $post_types; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Constructor |
|
| 27 | - */ |
|
| 28 | - public function __construct() { |
|
| 29 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 30 | - add_action( 'wp_head', array( $this, 'load_shortcodes' ) ); |
|
| 31 | - $this->load_classes(); |
|
| 32 | - } |
|
| 25 | + /** |
|
| 26 | + * Constructor |
|
| 27 | + */ |
|
| 28 | + public function __construct() { |
|
| 29 | + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 30 | + add_action( 'wp_head', array( $this, 'load_shortcodes' ) ); |
|
| 31 | + $this->load_classes(); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Return an instance of this class. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * |
|
| 39 | - * @return object \lsx_health_plan\classes\Setup() A single instance of this class. |
|
| 40 | - */ |
|
| 41 | - public static function get_instance() { |
|
| 34 | + /** |
|
| 35 | + * Return an instance of this class. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * |
|
| 39 | + * @return object \lsx_health_plan\classes\Setup() A single instance of this class. |
|
| 40 | + */ |
|
| 41 | + public static function get_instance() { |
|
| 42 | 42 | |
| 43 | - // If the single instance hasn't been set, set it now. |
|
| 44 | - if ( null === self::$instance ) { |
|
| 45 | - self::$instance = new self(); |
|
| 46 | - } |
|
| 43 | + // If the single instance hasn't been set, set it now. |
|
| 44 | + if ( null === self::$instance ) { |
|
| 45 | + self::$instance = new self(); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - return self::$instance; |
|
| 48 | + return self::$instance; |
|
| 49 | 49 | |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Adds text domain. |
|
| 54 | - */ |
|
| 55 | - public function load_plugin_textdomain() { |
|
| 56 | - load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' ); |
|
| 57 | - } |
|
| 52 | + /** |
|
| 53 | + * Adds text domain. |
|
| 54 | + */ |
|
| 55 | + public function load_plugin_textdomain() { |
|
| 56 | + load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' ); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Registers our shortcodes. |
|
| 61 | - * |
|
| 62 | - * @return void |
|
| 63 | - */ |
|
| 64 | - public function load_classes() { |
|
| 65 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php'; |
|
| 66 | - $this->post_types = Post_Type::get_instance(); |
|
| 67 | - } |
|
| 59 | + /** |
|
| 60 | + * Registers our shortcodes. |
|
| 61 | + * |
|
| 62 | + * @return void |
|
| 63 | + */ |
|
| 64 | + public function load_classes() { |
|
| 65 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php'; |
|
| 66 | + $this->post_types = Post_Type::get_instance(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Registers our shortcodes. |
|
| 71 | - * |
|
| 72 | - * @return void |
|
| 73 | - */ |
|
| 74 | - public function load_shortcodes() { |
|
| 75 | - add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' ); |
|
| 76 | - add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' ); |
|
| 77 | - add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' ); |
|
| 78 | - add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' ); |
|
| 79 | - add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' ); |
|
| 80 | - add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' ); |
|
| 69 | + /** |
|
| 70 | + * Registers our shortcodes. |
|
| 71 | + * |
|
| 72 | + * @return void |
|
| 73 | + */ |
|
| 74 | + public function load_shortcodes() { |
|
| 75 | + add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' ); |
|
| 76 | + add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' ); |
|
| 77 | + add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' ); |
|
| 78 | + add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' ); |
|
| 79 | + add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' ); |
|
| 80 | + add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' ); |
|
| 81 | 81 | |
| 82 | - if ( post_type_exists( 'video' ) ) { |
|
| 83 | - add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' ); |
|
| 84 | - } |
|
| 85 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 86 | - add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' ); |
|
| 87 | - } |
|
| 88 | - if ( post_type_exists( 'tip' ) ) { |
|
| 89 | - add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' ); |
|
| 90 | - } |
|
| 91 | - add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' ); |
|
| 92 | - } |
|
| 82 | + if ( post_type_exists( 'video' ) ) { |
|
| 83 | + add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' ); |
|
| 84 | + } |
|
| 85 | + if ( post_type_exists( 'recipe' ) ) { |
|
| 86 | + add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' ); |
|
| 87 | + } |
|
| 88 | + if ( post_type_exists( 'tip' ) ) { |
|
| 89 | + add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' ); |
|
| 90 | + } |
|
| 91 | + add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' ); |
|
| 92 | + } |
|
| 93 | 93 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * Constructor |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 30 | - add_action( 'wp_head', array( $this, 'load_shortcodes' ) ); |
|
| 29 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
| 30 | + add_action('wp_head', array($this, 'load_shortcodes')); |
|
| 31 | 31 | $this->load_classes(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public static function get_instance() { |
| 42 | 42 | |
| 43 | 43 | // If the single instance hasn't been set, set it now. |
| 44 | - if ( null === self::$instance ) { |
|
| 44 | + if (null === self::$instance) { |
|
| 45 | 45 | self::$instance = new self(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * Adds text domain. |
| 54 | 54 | */ |
| 55 | 55 | public function load_plugin_textdomain() { |
| 56 | - load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' ); |
|
| 56 | + load_plugin_textdomain('lsx-health-plan', false, basename(LSX_HEALTH_PLAN_PATH) . '/languages'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -72,22 +72,22 @@ discard block |
||
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | 74 | public function load_shortcodes() { |
| 75 | - add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' ); |
|
| 76 | - add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' ); |
|
| 77 | - add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' ); |
|
| 78 | - add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' ); |
|
| 79 | - add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' ); |
|
| 80 | - add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' ); |
|
| 75 | + add_shortcode('lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content'); |
|
| 76 | + add_shortcode('lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs'); |
|
| 77 | + add_shortcode('lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box'); |
|
| 78 | + add_shortcode('lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box'); |
|
| 79 | + add_shortcode('lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box'); |
|
| 80 | + add_shortcode('lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices'); |
|
| 81 | 81 | |
| 82 | - if ( post_type_exists( 'video' ) ) { |
|
| 83 | - add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' ); |
|
| 82 | + if (post_type_exists('video')) { |
|
| 83 | + add_shortcode('lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box'); |
|
| 84 | 84 | } |
| 85 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 86 | - add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' ); |
|
| 85 | + if (post_type_exists('recipe')) { |
|
| 86 | + add_shortcode('lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box'); |
|
| 87 | 87 | } |
| 88 | - if ( post_type_exists( 'tip' ) ) { |
|
| 89 | - add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' ); |
|
| 88 | + if (post_type_exists('tip')) { |
|
| 89 | + add_shortcode('lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box'); |
|
| 90 | 90 | } |
| 91 | - add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' ); |
|
| 91 | + add_shortcode('lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box'); |
|
| 92 | 92 | } |
| 93 | 93 | } |
@@ -8,142 +8,142 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class LSX_Team { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @var object \lsx_health_plan\classes\LSX_Team() |
|
| 15 | - */ |
|
| 16 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @var object \lsx_health_plan\classes\LSX_Team() |
|
| 15 | + */ |
|
| 16 | + protected static $instance = null; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructor. |
|
| 20 | - */ |
|
| 21 | - public function __construct() { |
|
| 22 | - $this->default_types = array( |
|
| 23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 28 | - ); |
|
| 29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
| 32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
| 33 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructor. |
|
| 20 | + */ |
|
| 21 | + public function __construct() { |
|
| 22 | + $this->default_types = array( |
|
| 23 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 28 | + ); |
|
| 29 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | + add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | + add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
| 32 | + add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Return an instance of this class. |
|
| 37 | - * |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * |
|
| 40 | - * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
| 41 | - */ |
|
| 42 | - public static function get_instance() { |
|
| 43 | - // If the single instance hasn't been set, set it now. |
|
| 44 | - if ( null === self::$instance ) { |
|
| 45 | - self::$instance = new self(); |
|
| 46 | - } |
|
| 47 | - return self::$instance; |
|
| 48 | - } |
|
| 35 | + /** |
|
| 36 | + * Return an instance of this class. |
|
| 37 | + * |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * |
|
| 40 | + * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
| 41 | + */ |
|
| 42 | + public static function get_instance() { |
|
| 43 | + // If the single instance hasn't been set, set it now. |
|
| 44 | + if ( null === self::$instance ) { |
|
| 45 | + self::$instance = new self(); |
|
| 46 | + } |
|
| 47 | + return self::$instance; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Load lsx team related css. |
|
| 52 | - * |
|
| 53 | - * @package lsx |
|
| 54 | - * @subpackage lsx-health-plan |
|
| 55 | - * |
|
| 56 | - */ |
|
| 57 | - public function assets() { |
|
| 58 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 59 | - } |
|
| 50 | + /** |
|
| 51 | + * Load lsx team related css. |
|
| 52 | + * |
|
| 53 | + * @package lsx |
|
| 54 | + * @subpackage lsx-health-plan |
|
| 55 | + * |
|
| 56 | + */ |
|
| 57 | + public function assets() { |
|
| 58 | + wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Define the related team member metabox and field configurations. |
|
| 63 | - */ |
|
| 64 | - public function related_team_metabox() { |
|
| 65 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 66 | - $cmb = new_cmb2_box( |
|
| 67 | - array( |
|
| 68 | - 'id' => $default_type . '_related_team_member__metabox', |
|
| 69 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 70 | - 'object_types' => array( $default_type ), // Post type. |
|
| 71 | - 'context' => 'normal', |
|
| 72 | - 'priority' => 'low', |
|
| 73 | - 'show_names' => true, |
|
| 74 | - ) |
|
| 75 | - ); |
|
| 61 | + /** |
|
| 62 | + * Define the related team member metabox and field configurations. |
|
| 63 | + */ |
|
| 64 | + public function related_team_metabox() { |
|
| 65 | + foreach ( $this->default_types as $type => $default_type ) { |
|
| 66 | + $cmb = new_cmb2_box( |
|
| 67 | + array( |
|
| 68 | + 'id' => $default_type . '_related_team_member__metabox', |
|
| 69 | + 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 70 | + 'object_types' => array( $default_type ), // Post type. |
|
| 71 | + 'context' => 'normal', |
|
| 72 | + 'priority' => 'low', |
|
| 73 | + 'show_names' => true, |
|
| 74 | + ) |
|
| 75 | + ); |
|
| 76 | 76 | |
| 77 | - $cmb->add_field( |
|
| 78 | - array( |
|
| 79 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 80 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 81 | - 'id' => $default_type . '_connected_team_member', |
|
| 82 | - 'type' => 'post_search_ajax', |
|
| 83 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 84 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
| 85 | - 'query_args' => array( |
|
| 86 | - 'post_type' => array( 'team' ), |
|
| 87 | - 'post_status' => array( 'publish' ), |
|
| 88 | - 'posts_per_page' => -1, |
|
| 89 | - ), |
|
| 90 | - ) |
|
| 91 | - ); |
|
| 92 | - } |
|
| 77 | + $cmb->add_field( |
|
| 78 | + array( |
|
| 79 | + 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 80 | + 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 81 | + 'id' => $default_type . '_connected_team_member', |
|
| 82 | + 'type' => 'post_search_ajax', |
|
| 83 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 84 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
| 85 | + 'query_args' => array( |
|
| 86 | + 'post_type' => array( 'team' ), |
|
| 87 | + 'post_status' => array( 'publish' ), |
|
| 88 | + 'posts_per_page' => -1, |
|
| 89 | + ), |
|
| 90 | + ) |
|
| 91 | + ); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Adding additional custom fields to the single members, related with Health Plan. |
|
| 98 | - */ |
|
| 99 | - public function additional_single_team_metabox() { |
|
| 100 | - $cmb = new_cmb2_box( |
|
| 101 | - array( |
|
| 102 | - 'id' => 'lsx__team', |
|
| 103 | - 'title' => '', |
|
| 104 | - 'object_types' => array( 'team' ), // Post type. |
|
| 105 | - 'context' => 'normal', |
|
| 106 | - 'priority' => 'high', |
|
| 107 | - 'show_names' => true, |
|
| 108 | - ) |
|
| 109 | - ); |
|
| 96 | + /** |
|
| 97 | + * Adding additional custom fields to the single members, related with Health Plan. |
|
| 98 | + */ |
|
| 99 | + public function additional_single_team_metabox() { |
|
| 100 | + $cmb = new_cmb2_box( |
|
| 101 | + array( |
|
| 102 | + 'id' => 'lsx__team', |
|
| 103 | + 'title' => '', |
|
| 104 | + 'object_types' => array( 'team' ), // Post type. |
|
| 105 | + 'context' => 'normal', |
|
| 106 | + 'priority' => 'high', |
|
| 107 | + 'show_names' => true, |
|
| 108 | + ) |
|
| 109 | + ); |
|
| 110 | 110 | |
| 111 | - $cmb->add_field( |
|
| 112 | - array( |
|
| 113 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
| 114 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
| 115 | - 'id' => 'team_member_experience', |
|
| 116 | - 'type' => 'wysiwyg', |
|
| 117 | - ) |
|
| 118 | - ); |
|
| 111 | + $cmb->add_field( |
|
| 112 | + array( |
|
| 113 | + 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
| 114 | + 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
| 115 | + 'id' => 'team_member_experience', |
|
| 116 | + 'type' => 'wysiwyg', |
|
| 117 | + ) |
|
| 118 | + ); |
|
| 119 | 119 | |
| 120 | - $cmb->add_field( |
|
| 121 | - array( |
|
| 122 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
| 123 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
| 124 | - 'id' => 'connected_team_member_plan', |
|
| 125 | - 'type' => 'post_search_ajax', |
|
| 126 | - 'limit' => 3, |
|
| 127 | - 'sortable' => true, |
|
| 128 | - 'query_args' => array( |
|
| 129 | - 'post_type' => array( 'plan' ), |
|
| 130 | - 'post_status' => array( 'publish' ), |
|
| 131 | - 'posts_per_page' => -1, |
|
| 132 | - ), |
|
| 133 | - ) |
|
| 134 | - ); |
|
| 120 | + $cmb->add_field( |
|
| 121 | + array( |
|
| 122 | + 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
| 123 | + 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
| 124 | + 'id' => 'connected_team_member_plan', |
|
| 125 | + 'type' => 'post_search_ajax', |
|
| 126 | + 'limit' => 3, |
|
| 127 | + 'sortable' => true, |
|
| 128 | + 'query_args' => array( |
|
| 129 | + 'post_type' => array( 'plan' ), |
|
| 130 | + 'post_status' => array( 'publish' ), |
|
| 131 | + 'posts_per_page' => -1, |
|
| 132 | + ), |
|
| 133 | + ) |
|
| 134 | + ); |
|
| 135 | 135 | |
| 136 | - } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * Adds custom tabs to the team member single pages. |
|
| 140 | - * |
|
| 141 | - * @return void |
|
| 142 | - */ |
|
| 143 | - public function hp_team_member_tabs() { |
|
| 144 | - if ( is_single() && is_singular( 'team' ) ) { |
|
| 145 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
| 146 | - } |
|
| 147 | - } |
|
| 138 | + /** |
|
| 139 | + * Adds custom tabs to the team member single pages. |
|
| 140 | + * |
|
| 141 | + * @return void |
|
| 142 | + */ |
|
| 143 | + public function hp_team_member_tabs() { |
|
| 144 | + if ( is_single() && is_singular( 'team' ) ) { |
|
| 145 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | 149 | } |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | $this->default_types = array( |
| 23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 23 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
| 24 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
| 25 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
| 26 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
| 27 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
| 28 | 28 | ); |
| 29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
| 32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
| 29 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
| 30 | + add_action('cmb2_admin_init', array($this, 'related_team_metabox')); |
|
| 31 | + add_action('cmb2_admin_init', array($this, 'additional_single_team_metabox')); |
|
| 32 | + add_action('lsx_entry_bottom', array($this, 'hp_team_member_tabs')); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public static function get_instance() { |
| 43 | 43 | // If the single instance hasn't been set, set it now. |
| 44 | - if ( null === self::$instance ) { |
|
| 44 | + if (null === self::$instance) { |
|
| 45 | 45 | self::$instance = new self(); |
| 46 | 46 | } |
| 47 | 47 | return self::$instance; |
@@ -55,19 +55,19 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | */ |
| 57 | 57 | public function assets() { |
| 58 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 58 | + wp_enqueue_style('lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Define the related team member metabox and field configurations. |
| 63 | 63 | */ |
| 64 | 64 | public function related_team_metabox() { |
| 65 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 65 | + foreach ($this->default_types as $type => $default_type) { |
|
| 66 | 66 | $cmb = new_cmb2_box( |
| 67 | 67 | array( |
| 68 | 68 | 'id' => $default_type . '_related_team_member__metabox', |
| 69 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 70 | - 'object_types' => array( $default_type ), // Post type. |
|
| 69 | + 'title' => __('Related Team Member', 'lsx-health-plan'), |
|
| 70 | + 'object_types' => array($default_type), // Post type. |
|
| 71 | 71 | 'context' => 'normal', |
| 72 | 72 | 'priority' => 'low', |
| 73 | 73 | 'show_names' => true, |
@@ -76,15 +76,15 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $cmb->add_field( |
| 78 | 78 | array( |
| 79 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 80 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 79 | + 'name' => __('Related Team Member', 'lsx-health-plan'), |
|
| 80 | + 'desc' => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type, |
|
| 81 | 81 | 'id' => $default_type . '_connected_team_member', |
| 82 | 82 | 'type' => 'post_search_ajax', |
| 83 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 83 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 84 | 84 | 'sortable' => true, // Allow selected items to be sortable (default false). |
| 85 | 85 | 'query_args' => array( |
| 86 | - 'post_type' => array( 'team' ), |
|
| 87 | - 'post_status' => array( 'publish' ), |
|
| 86 | + 'post_type' => array('team'), |
|
| 87 | + 'post_status' => array('publish'), |
|
| 88 | 88 | 'posts_per_page' => -1, |
| 89 | 89 | ), |
| 90 | 90 | ) |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | array( |
| 102 | 102 | 'id' => 'lsx__team', |
| 103 | 103 | 'title' => '', |
| 104 | - 'object_types' => array( 'team' ), // Post type. |
|
| 104 | + 'object_types' => array('team'), // Post type. |
|
| 105 | 105 | 'context' => 'normal', |
| 106 | 106 | 'priority' => 'high', |
| 107 | 107 | 'show_names' => true, |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $cmb->add_field( |
| 112 | 112 | array( |
| 113 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
| 114 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
| 113 | + 'name' => __('Team Member Experience', 'lsx-health-plan'), |
|
| 114 | + 'desc' => __('Add additional experience to this team member', 'lsx-health-plan'), |
|
| 115 | 115 | 'id' => 'team_member_experience', |
| 116 | 116 | 'type' => 'wysiwyg', |
| 117 | 117 | ) |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $cmb->add_field( |
| 121 | 121 | array( |
| 122 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
| 123 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
| 122 | + 'name' => __('Featured Plans', 'lsx-health-plan'), |
|
| 123 | + 'desc' => __('Connect the related plans to this team member', 'lsx-health-plan'), |
|
| 124 | 124 | 'id' => 'connected_team_member_plan', |
| 125 | 125 | 'type' => 'post_search_ajax', |
| 126 | 126 | 'limit' => 3, |
| 127 | 127 | 'sortable' => true, |
| 128 | 128 | 'query_args' => array( |
| 129 | - 'post_type' => array( 'plan' ), |
|
| 130 | - 'post_status' => array( 'publish' ), |
|
| 129 | + 'post_type' => array('plan'), |
|
| 130 | + 'post_status' => array('publish'), |
|
| 131 | 131 | 'posts_per_page' => -1, |
| 132 | 132 | ), |
| 133 | 133 | ) |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | 143 | public function hp_team_member_tabs() { |
| 144 | - if ( is_single() && is_singular( 'team' ) ) { |
|
| 144 | + if (is_single() && is_singular('team')) { |
|
| 145 | 145 | require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -34,13 +34,19 @@ |
||
| 34 | 34 | <div class="entry-tabs hp-entry-tabs"> |
| 35 | 35 | <ul class="nav nav-tabs"> |
| 36 | 36 | <?php foreach ( $tabs as $i => $tab ) : ?> |
| 37 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
| 37 | + <li<?php if ( 0 === $i ) { |
|
| 38 | + echo ' class="active"'; |
|
| 39 | +} |
|
| 40 | +?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
| 38 | 41 | <?php endforeach; ?> |
| 39 | 42 | </ul> |
| 40 | 43 | |
| 41 | 44 | <div class="tab-content"> |
| 42 | 45 | <?php foreach ( $tabs as $i => $tab ) : ?> |
| 43 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
| 46 | + <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) { |
|
| 47 | + echo ' in active'; |
|
| 48 | +} |
|
| 49 | +?>"> |
|
| 44 | 50 | <?php echo do_shortcode( $tab['shortcode'] ); ?> |
| 45 | 51 | <?php echo $tab['content']; ?> |
| 46 | 52 | </div> |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | $tab_experience['content'] = get_post_meta( get_the_ID(), 'team_member_experience', true ); |
| 8 | 8 | $tab_experience['shortcode'] = ''; |
| 9 | 9 | if ( ! empty( $tab_experience['content'] ) ) { |
| 10 | - $tabs[] = $tab_experience; |
|
| 10 | + $tabs[] = $tab_experience; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // Tab Featured plan |
@@ -18,75 +18,75 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | if ( ! empty( $tab_plans['posts'] ) ) { |
| 20 | 20 | |
| 21 | - $plan_content = ''; |
|
| 21 | + $plan_content = ''; |
|
| 22 | 22 | |
| 23 | - $include = implode( ',', $tab_plans['posts'] ); |
|
| 24 | - $args = array( |
|
| 25 | - 'orderby' => 'menu_order', |
|
| 26 | - 'order' => 'ASC', |
|
| 27 | - 'post_type' => 'plan', |
|
| 28 | - 'post__in' => $tab_plans['posts'], |
|
| 29 | - ); |
|
| 30 | - //$the_query = new WP_Query( $args ); |
|
| 23 | + $include = implode( ',', $tab_plans['posts'] ); |
|
| 24 | + $args = array( |
|
| 25 | + 'orderby' => 'menu_order', |
|
| 26 | + 'order' => 'ASC', |
|
| 27 | + 'post_type' => 'plan', |
|
| 28 | + 'post__in' => $tab_plans['posts'], |
|
| 29 | + ); |
|
| 30 | + //$the_query = new WP_Query( $args ); |
|
| 31 | 31 | |
| 32 | - $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"> |
|
| 32 | + $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"> |
|
| 33 | 33 | <div class="row">'; |
| 34 | 34 | |
| 35 | - foreach ( $tab_plans['posts'] as $index => $post ) { |
|
| 36 | - |
|
| 37 | - $plan_content .= '<div class="col-xs-12 col-sm-6 col-md-4">'; |
|
| 38 | - $plan_content .= '<article class="lsx-slot lsx-hp-shadow">'; |
|
| 39 | - $plan_content .= '<div class="plan-feature-img">'; |
|
| 40 | - $plan_content .= '<a href="' . get_permalink( $post ) . '">'; |
|
| 41 | - |
|
| 42 | - $linked_product = false; |
|
| 43 | - $restricted = false; |
|
| 44 | - $product = null; |
|
| 45 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products( $post ) ) { |
|
| 46 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products( $post ); |
|
| 47 | - $linked_product = wc_get_product( $products[0] ); |
|
| 48 | - $product = $linked_product; |
|
| 49 | - } |
|
| 50 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 51 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - $featured_image = get_the_post_thumbnail( $post ); |
|
| 55 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 56 | - $plan_content .= $featured_image; |
|
| 57 | - } else { |
|
| 58 | - $plan_content .= '<img loading="lazy" class="placeholder" src="' . plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' . '">'; |
|
| 59 | - } |
|
| 60 | - $plan_content .= '</a>'; |
|
| 61 | - $plan_content .= '</div>'; |
|
| 62 | - |
|
| 63 | - $plan_content .= '<div class="content-box plan-content-box">'; |
|
| 64 | - $plan_content .= '<h3 class="plan"><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . '</a></h3>'; |
|
| 65 | - |
|
| 66 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 67 | - $plan_content .= $linked_product->get_price_html(); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - $plan_content .= '<div class="excerpt">'; |
|
| 71 | - if ( ! has_excerpt( $post ) ) { |
|
| 72 | - $content = wp_trim_words( get_the_content( $post ), 20 ); |
|
| 73 | - $plan_content .= '<p>' . $content . '</p>'; |
|
| 74 | - } else { |
|
| 75 | - $plan_content .= apply_filters( 'the_excerpt', get_the_excerpt( $post ) ); |
|
| 76 | - } |
|
| 77 | - $plan_content .= '</div>'; |
|
| 78 | - |
|
| 79 | - $plan_content .= '</div>'; |
|
| 80 | - $plan_content .= '</article>'; |
|
| 81 | - $plan_content .= '</div>'; |
|
| 82 | - |
|
| 83 | - } |
|
| 84 | - $plan_content .= '</div></div>'; |
|
| 85 | - |
|
| 86 | - $tab_plans['content'] = $plan_content; |
|
| 35 | + foreach ( $tab_plans['posts'] as $index => $post ) { |
|
| 36 | + |
|
| 37 | + $plan_content .= '<div class="col-xs-12 col-sm-6 col-md-4">'; |
|
| 38 | + $plan_content .= '<article class="lsx-slot lsx-hp-shadow">'; |
|
| 39 | + $plan_content .= '<div class="plan-feature-img">'; |
|
| 40 | + $plan_content .= '<a href="' . get_permalink( $post ) . '">'; |
|
| 41 | + |
|
| 42 | + $linked_product = false; |
|
| 43 | + $restricted = false; |
|
| 44 | + $product = null; |
|
| 45 | + if ( \lsx_health_plan\functions\woocommerce\plan_has_products( $post ) ) { |
|
| 46 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products( $post ); |
|
| 47 | + $linked_product = wc_get_product( $products[0] ); |
|
| 48 | + $product = $linked_product; |
|
| 49 | + } |
|
| 50 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 51 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + $featured_image = get_the_post_thumbnail( $post ); |
|
| 55 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 56 | + $plan_content .= $featured_image; |
|
| 57 | + } else { |
|
| 58 | + $plan_content .= '<img loading="lazy" class="placeholder" src="' . plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' . '">'; |
|
| 59 | + } |
|
| 60 | + $plan_content .= '</a>'; |
|
| 61 | + $plan_content .= '</div>'; |
|
| 62 | + |
|
| 63 | + $plan_content .= '<div class="content-box plan-content-box">'; |
|
| 64 | + $plan_content .= '<h3 class="plan"><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . '</a></h3>'; |
|
| 65 | + |
|
| 66 | + if ( false !== $linked_product && false !== $restricted ) { |
|
| 67 | + $plan_content .= $linked_product->get_price_html(); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + $plan_content .= '<div class="excerpt">'; |
|
| 71 | + if ( ! has_excerpt( $post ) ) { |
|
| 72 | + $content = wp_trim_words( get_the_content( $post ), 20 ); |
|
| 73 | + $plan_content .= '<p>' . $content . '</p>'; |
|
| 74 | + } else { |
|
| 75 | + $plan_content .= apply_filters( 'the_excerpt', get_the_excerpt( $post ) ); |
|
| 76 | + } |
|
| 77 | + $plan_content .= '</div>'; |
|
| 78 | + |
|
| 79 | + $plan_content .= '</div>'; |
|
| 80 | + $plan_content .= '</article>'; |
|
| 81 | + $plan_content .= '</div>'; |
|
| 82 | + |
|
| 83 | + } |
|
| 84 | + $plan_content .= '</div></div>'; |
|
| 85 | + |
|
| 86 | + $tab_plans['content'] = $plan_content; |
|
| 87 | 87 | } |
| 88 | 88 | if ( ! empty( $tab_plans['content'] ) ) { |
| 89 | - $tabs[] = $tab_plans; |
|
| 89 | + $tabs[] = $tab_plans; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | $tab_testimonial['content'] = ''; |
| 98 | 98 | |
| 99 | 99 | if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
| 100 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 101 | - $columns = count( $tab_testimonial['posts'] ); |
|
| 102 | - } else { |
|
| 103 | - $columns = 3; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 107 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
| 108 | - $tabs[] = $tab_testimonial; |
|
| 100 | + if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 101 | + $columns = count( $tab_testimonial['posts'] ); |
|
| 102 | + } else { |
|
| 103 | + $columns = 3; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 107 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
| 108 | + $tabs[] = $tab_testimonial; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if ( count( $tabs ) > 0 ) : ?> |
@@ -3,24 +3,24 @@ discard block |
||
| 3 | 3 | $tabs = array(); |
| 4 | 4 | |
| 5 | 5 | // Tab Experience |
| 6 | -$tab_experience['title'] = esc_html__( 'Experience', 'lsx-team' ); |
|
| 7 | -$tab_experience['content'] = get_post_meta( get_the_ID(), 'team_member_experience', true ); |
|
| 6 | +$tab_experience['title'] = esc_html__('Experience', 'lsx-team'); |
|
| 7 | +$tab_experience['content'] = get_post_meta(get_the_ID(), 'team_member_experience', true); |
|
| 8 | 8 | $tab_experience['shortcode'] = ''; |
| 9 | -if ( ! empty( $tab_experience['content'] ) ) { |
|
| 9 | +if ( ! empty($tab_experience['content'])) { |
|
| 10 | 10 | $tabs[] = $tab_experience; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // Tab Featured plan |
| 14 | -$tab_plans['title'] = esc_html__( 'Featured Plans', 'lsx-team' ); |
|
| 15 | -$tab_plans['posts'] = get_post_meta( get_the_ID(), 'connected_team_member_plan', true ); |
|
| 14 | +$tab_plans['title'] = esc_html__('Featured Plans', 'lsx-team'); |
|
| 15 | +$tab_plans['posts'] = get_post_meta(get_the_ID(), 'connected_team_member_plan', true); |
|
| 16 | 16 | $tab_plans['content'] = ''; |
| 17 | 17 | $tab_plans['shortcode'] = ''; |
| 18 | 18 | |
| 19 | -if ( ! empty( $tab_plans['posts'] ) ) { |
|
| 19 | +if ( ! empty($tab_plans['posts'])) { |
|
| 20 | 20 | |
| 21 | 21 | $plan_content = ''; |
| 22 | 22 | |
| 23 | - $include = implode( ',', $tab_plans['posts'] ); |
|
| 23 | + $include = implode(',', $tab_plans['posts']); |
|
| 24 | 24 | $args = array( |
| 25 | 25 | 'orderby' => 'menu_order', |
| 26 | 26 | 'order' => 'ASC', |
@@ -32,47 +32,47 @@ discard block |
||
| 32 | 32 | $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"> |
| 33 | 33 | <div class="row">'; |
| 34 | 34 | |
| 35 | - foreach ( $tab_plans['posts'] as $index => $post ) { |
|
| 35 | + foreach ($tab_plans['posts'] as $index => $post) { |
|
| 36 | 36 | |
| 37 | 37 | $plan_content .= '<div class="col-xs-12 col-sm-6 col-md-4">'; |
| 38 | 38 | $plan_content .= '<article class="lsx-slot lsx-hp-shadow">'; |
| 39 | 39 | $plan_content .= '<div class="plan-feature-img">'; |
| 40 | - $plan_content .= '<a href="' . get_permalink( $post ) . '">'; |
|
| 40 | + $plan_content .= '<a href="' . get_permalink($post) . '">'; |
|
| 41 | 41 | |
| 42 | 42 | $linked_product = false; |
| 43 | 43 | $restricted = false; |
| 44 | 44 | $product = null; |
| 45 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products( $post ) ) { |
|
| 46 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products( $post ); |
|
| 47 | - $linked_product = wc_get_product( $products[0] ); |
|
| 45 | + if (\lsx_health_plan\functions\woocommerce\plan_has_products($post)) { |
|
| 46 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products($post); |
|
| 47 | + $linked_product = wc_get_product($products[0]); |
|
| 48 | 48 | $product = $linked_product; |
| 49 | 49 | } |
| 50 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 51 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 50 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
| 51 | + $restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $featured_image = get_the_post_thumbnail( $post ); |
|
| 55 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 54 | + $featured_image = get_the_post_thumbnail($post); |
|
| 55 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 56 | 56 | $plan_content .= $featured_image; |
| 57 | 57 | } else { |
| 58 | - $plan_content .= '<img loading="lazy" class="placeholder" src="' . plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' . '">'; |
|
| 58 | + $plan_content .= '<img loading="lazy" class="placeholder" src="' . plugin_dir_url(__DIR__) . '../assets/images/placeholder.jpg' . '">'; |
|
| 59 | 59 | } |
| 60 | 60 | $plan_content .= '</a>'; |
| 61 | 61 | $plan_content .= '</div>'; |
| 62 | 62 | |
| 63 | 63 | $plan_content .= '<div class="content-box plan-content-box">'; |
| 64 | - $plan_content .= '<h3 class="plan"><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . '</a></h3>'; |
|
| 64 | + $plan_content .= '<h3 class="plan"><a href="' . get_permalink($post) . '">' . get_the_title($post) . '</a></h3>'; |
|
| 65 | 65 | |
| 66 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 66 | + if (false !== $linked_product && false !== $restricted) { |
|
| 67 | 67 | $plan_content .= $linked_product->get_price_html(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $plan_content .= '<div class="excerpt">'; |
| 71 | - if ( ! has_excerpt( $post ) ) { |
|
| 72 | - $content = wp_trim_words( get_the_content( $post ), 20 ); |
|
| 71 | + if ( ! has_excerpt($post)) { |
|
| 72 | + $content = wp_trim_words(get_the_content($post), 20); |
|
| 73 | 73 | $plan_content .= '<p>' . $content . '</p>'; |
| 74 | 74 | } else { |
| 75 | - $plan_content .= apply_filters( 'the_excerpt', get_the_excerpt( $post ) ); |
|
| 75 | + $plan_content .= apply_filters('the_excerpt', get_the_excerpt($post)); |
|
| 76 | 76 | } |
| 77 | 77 | $plan_content .= '</div>'; |
| 78 | 78 | |
@@ -85,41 +85,41 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $tab_plans['content'] = $plan_content; |
| 87 | 87 | } |
| 88 | -if ( ! empty( $tab_plans['content'] ) ) { |
|
| 88 | +if ( ! empty($tab_plans['content'])) { |
|
| 89 | 89 | $tabs[] = $tab_plans; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | // Tab Testimonials |
| 94 | 94 | $tab_testimonial['post_type'] = 'testimonial'; |
| 95 | -$tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
| 96 | -$tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
| 95 | +$tab_testimonial['title'] = esc_html__('Testimonials', 'lsx-team'); |
|
| 96 | +$tab_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_team', true); |
|
| 97 | 97 | $tab_testimonial['content'] = ''; |
| 98 | 98 | |
| 99 | -if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
| 100 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 101 | - $columns = count( $tab_testimonial['posts'] ); |
|
| 99 | +if (is_plugin_active('lsx-testimonials/lsx-testimonials.php') && ( ! empty($tab_testimonial['posts']))) { |
|
| 100 | + if (count($tab_testimonial['posts']) <= 2) { |
|
| 101 | + $columns = count($tab_testimonial['posts']); |
|
| 102 | 102 | } else { |
| 103 | 103 | $columns = 3; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 106 | + $post_ids = join(',', $tab_testimonial['posts']); |
|
| 107 | 107 | $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
| 108 | 108 | $tabs[] = $tab_testimonial; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if ( count( $tabs ) > 0 ) : ?> |
|
| 111 | +if (count($tabs) > 0) : ?> |
|
| 112 | 112 | <div class="entry-tabs hp-entry-tabs"> |
| 113 | 113 | <ul class="nav nav-tabs"> |
| 114 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
| 115 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
| 114 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
| 115 | + <li<?php if (0 === $i) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr(sanitize_title($tab['title'])); ?>"><?php echo esc_html($tab['title']); ?></a></li> |
|
| 116 | 116 | <?php endforeach; ?> |
| 117 | 117 | </ul> |
| 118 | 118 | |
| 119 | 119 | <div class="tab-content"> |
| 120 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
| 121 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
| 122 | - <?php echo do_shortcode( $tab['shortcode'] ); ?> |
|
| 120 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
| 121 | + <div id="<?php echo esc_attr(sanitize_title($tab['title'])); ?>" class="tab-pane fade<?php if (0 === $i) echo ' in active'; ?>"> |
|
| 122 | + <?php echo do_shortcode($tab['shortcode']); ?> |
|
| 123 | 123 | <?php echo $tab['content']; ?> |
| 124 | 124 | </div> |
| 125 | 125 | <?php endforeach; ?> |
@@ -8,169 +8,169 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class General { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\frontend\General() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Constructor |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 24 | - // Before Output. |
|
| 25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
| 27 | - |
|
| 28 | - // Output. |
|
| 29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
| 30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
| 31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
| 32 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 ); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Return an instance of this class. |
|
| 37 | - * |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * |
|
| 40 | - * @return object \lsx_health_plan\classes\frontend\General() A single instance of this class. |
|
| 41 | - */ |
|
| 42 | - public static function get_instance() { |
|
| 43 | - // If the single instance hasn't been set, set it now. |
|
| 44 | - if ( null === self::$instance ) { |
|
| 45 | - self::$instance = new self(); |
|
| 46 | - } |
|
| 47 | - return self::$instance; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Registers the plugin frontend assets |
|
| 52 | - * |
|
| 53 | - * @return void |
|
| 54 | - */ |
|
| 55 | - public function assets() { |
|
| 56 | - |
|
| 57 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
| 58 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 62 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
| 63 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
| 64 | - |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
|
| 69 | - */ |
|
| 70 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
| 71 | - if ( 'post' === $context ) { |
|
| 72 | - $tags['iframe'] = array( |
|
| 73 | - 'src' => true, |
|
| 74 | - 'height' => true, |
|
| 75 | - 'width' => true, |
|
| 76 | - 'frameborder' => true, |
|
| 77 | - 'allowfullscreen' => true, |
|
| 78 | - ); |
|
| 79 | - } |
|
| 80 | - $tags['progress'] = array( |
|
| 81 | - 'id' => true, |
|
| 82 | - 'value' => true, |
|
| 83 | - 'max' => true, |
|
| 84 | - ); |
|
| 85 | - return $tags; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Add body classes to body. |
|
| 90 | - * |
|
| 91 | - * @param array $classes |
|
| 92 | - * @return void |
|
| 93 | - */ |
|
| 94 | - public function body_classes( $classes = array() ) { |
|
| 95 | - global $post; |
|
| 96 | - |
|
| 97 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
| 98 | - $classes[] = 'my-plan-shortcode'; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
| 102 | - $args = array( |
|
| 103 | - 'post_parent' => get_the_ID(), |
|
| 104 | - 'post_type' => 'plan', |
|
| 105 | - ); |
|
| 106 | - |
|
| 107 | - $post_id = get_the_ID(); |
|
| 108 | - $has_children = get_children( $args ); |
|
| 109 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
| 110 | - |
|
| 111 | - if ( ! empty( $has_children ) ) { |
|
| 112 | - $plan_type_class = 'parent-plan-page'; |
|
| 113 | - if ( 0 !== $has_parent ) { |
|
| 114 | - $plan_type_class = 'parent-sub-plan-page'; |
|
| 115 | - } |
|
| 116 | - } else { |
|
| 117 | - $plan_type_class = 'unique-plan-page'; |
|
| 118 | - if ( 0 !== $has_parent ) { |
|
| 119 | - $plan_type_class = 'child-plan-page'; |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - $classes[] = $plan_type_class; |
|
| 123 | - } |
|
| 124 | - return $classes; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Remove the single recipe and exercise title |
|
| 129 | - */ |
|
| 130 | - public function single_title( $title ) { |
|
| 131 | - |
|
| 132 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
| 133 | - |
|
| 134 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
| 138 | - |
|
| 139 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - return $title; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Removing footer for HP single pages. |
|
| 147 | - * |
|
| 148 | - * @return void |
|
| 149 | - */ |
|
| 150 | - public function remove_single_footer() { |
|
| 151 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
| 152 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - /** |
|
| 156 | - * Remove the "Archives:" from the post type recipes. |
|
| 157 | - * |
|
| 158 | - * @param string $title the term title. |
|
| 159 | - * @return string |
|
| 160 | - */ |
|
| 161 | - public function get_the_archive_title( $title ) { |
|
| 162 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 163 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 164 | - } |
|
| 165 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
| 166 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 167 | - } |
|
| 168 | - if ( is_tax() ) { |
|
| 169 | - $queried_object = get_queried_object(); |
|
| 170 | - if ( isset( $queried_object->name ) ) { |
|
| 171 | - $title = $queried_object->name; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - return $title; |
|
| 175 | - } |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\frontend\General() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Constructor |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | + // Before Output. |
|
| 25 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 26 | + add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
| 27 | + |
|
| 28 | + // Output. |
|
| 29 | + add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
| 30 | + add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
| 31 | + add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
| 32 | + add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 ); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Return an instance of this class. |
|
| 37 | + * |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * |
|
| 40 | + * @return object \lsx_health_plan\classes\frontend\General() A single instance of this class. |
|
| 41 | + */ |
|
| 42 | + public static function get_instance() { |
|
| 43 | + // If the single instance hasn't been set, set it now. |
|
| 44 | + if ( null === self::$instance ) { |
|
| 45 | + self::$instance = new self(); |
|
| 46 | + } |
|
| 47 | + return self::$instance; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Registers the plugin frontend assets |
|
| 52 | + * |
|
| 53 | + * @return void |
|
| 54 | + */ |
|
| 55 | + public function assets() { |
|
| 56 | + |
|
| 57 | + if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
| 58 | + wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 62 | + wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
| 63 | + wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
| 64 | + |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
|
| 69 | + */ |
|
| 70 | + public function allow_html_tags_attributes( $tags, $context ) { |
|
| 71 | + if ( 'post' === $context ) { |
|
| 72 | + $tags['iframe'] = array( |
|
| 73 | + 'src' => true, |
|
| 74 | + 'height' => true, |
|
| 75 | + 'width' => true, |
|
| 76 | + 'frameborder' => true, |
|
| 77 | + 'allowfullscreen' => true, |
|
| 78 | + ); |
|
| 79 | + } |
|
| 80 | + $tags['progress'] = array( |
|
| 81 | + 'id' => true, |
|
| 82 | + 'value' => true, |
|
| 83 | + 'max' => true, |
|
| 84 | + ); |
|
| 85 | + return $tags; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Add body classes to body. |
|
| 90 | + * |
|
| 91 | + * @param array $classes |
|
| 92 | + * @return void |
|
| 93 | + */ |
|
| 94 | + public function body_classes( $classes = array() ) { |
|
| 95 | + global $post; |
|
| 96 | + |
|
| 97 | + if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
| 98 | + $classes[] = 'my-plan-shortcode'; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + if ( is_single() && is_singular( 'plan' ) ) { |
|
| 102 | + $args = array( |
|
| 103 | + 'post_parent' => get_the_ID(), |
|
| 104 | + 'post_type' => 'plan', |
|
| 105 | + ); |
|
| 106 | + |
|
| 107 | + $post_id = get_the_ID(); |
|
| 108 | + $has_children = get_children( $args ); |
|
| 109 | + $has_parent = wp_get_post_parent_id( $post_id ); |
|
| 110 | + |
|
| 111 | + if ( ! empty( $has_children ) ) { |
|
| 112 | + $plan_type_class = 'parent-plan-page'; |
|
| 113 | + if ( 0 !== $has_parent ) { |
|
| 114 | + $plan_type_class = 'parent-sub-plan-page'; |
|
| 115 | + } |
|
| 116 | + } else { |
|
| 117 | + $plan_type_class = 'unique-plan-page'; |
|
| 118 | + if ( 0 !== $has_parent ) { |
|
| 119 | + $plan_type_class = 'child-plan-page'; |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + $classes[] = $plan_type_class; |
|
| 123 | + } |
|
| 124 | + return $classes; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Remove the single recipe and exercise title |
|
| 129 | + */ |
|
| 130 | + public function single_title( $title ) { |
|
| 131 | + |
|
| 132 | + if ( is_single() && is_singular( 'recipe' ) ) { |
|
| 133 | + |
|
| 134 | + $title = __( 'Recipe', 'lsx-health-plan' ); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + if ( is_single() && is_singular( 'exercise' ) ) { |
|
| 138 | + |
|
| 139 | + $title = __( 'Exercise', 'lsx-health-plan' ); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + return $title; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Removing footer for HP single pages. |
|
| 147 | + * |
|
| 148 | + * @return void |
|
| 149 | + */ |
|
| 150 | + public function remove_single_footer() { |
|
| 151 | + if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
| 152 | + remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + /** |
|
| 156 | + * Remove the "Archives:" from the post type recipes. |
|
| 157 | + * |
|
| 158 | + * @param string $title the term title. |
|
| 159 | + * @return string |
|
| 160 | + */ |
|
| 161 | + public function get_the_archive_title( $title ) { |
|
| 162 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
| 163 | + $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 164 | + } |
|
| 165 | + if ( is_post_type_archive( 'exercise' ) ) { |
|
| 166 | + $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 167 | + } |
|
| 168 | + if ( is_tax() ) { |
|
| 169 | + $queried_object = get_queried_object(); |
|
| 170 | + if ( isset( $queried_object->name ) ) { |
|
| 171 | + $title = $queried_object->name; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + return $title; |
|
| 175 | + } |
|
| 176 | 176 | } |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | 24 | // Before Output. |
| 25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
| 25 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
| 26 | + add_filter('wp_kses_allowed_html', array($this, 'allow_html_tags_attributes'), 100, 2); |
|
| 27 | 27 | |
| 28 | 28 | // Output. |
| 29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
| 30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
| 31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
| 32 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 ); |
|
| 29 | + add_action('body_class', array($this, 'body_classes')); |
|
| 30 | + add_filter('lsx_global_header_title', array($this, 'single_title'), 200, 1); |
|
| 31 | + add_action('wp_head', array($this, 'remove_single_footer'), 99); |
|
| 32 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 9); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public static function get_instance() { |
| 43 | 43 | // If the single instance hasn't been set, set it now. |
| 44 | - if ( null === self::$instance ) { |
|
| 44 | + if (null === self::$instance) { |
|
| 45 | 45 | self::$instance = new self(); |
| 46 | 46 | } |
| 47 | 47 | return self::$instance; |
@@ -54,21 +54,21 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function assets() { |
| 56 | 56 | |
| 57 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
| 58 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
| 57 | + if (is_post_type_archive('plan') && false === \lsx_health_plan\functions\plan\is_filters_disabled()) { |
|
| 58 | + wp_enqueue_script('isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_HEALTH_PLAN_URL, true); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 62 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
| 63 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
| 61 | + wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER); |
|
| 62 | + wp_style_add_data('lsx-health-plan', 'rtl', 'replace'); |
|
| 63 | + wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery')); |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
| 69 | 69 | */ |
| 70 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
| 71 | - if ( 'post' === $context ) { |
|
| 70 | + public function allow_html_tags_attributes($tags, $context) { |
|
| 71 | + if ('post' === $context) { |
|
| 72 | 72 | $tags['iframe'] = array( |
| 73 | 73 | 'src' => true, |
| 74 | 74 | 'height' => true, |
@@ -91,31 +91,31 @@ discard block |
||
| 91 | 91 | * @param array $classes |
| 92 | 92 | * @return void |
| 93 | 93 | */ |
| 94 | - public function body_classes( $classes = array() ) { |
|
| 94 | + public function body_classes($classes = array()) { |
|
| 95 | 95 | global $post; |
| 96 | 96 | |
| 97 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
| 97 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'lsx_health_plan_my_profile_block')) { |
|
| 98 | 98 | $classes[] = 'my-plan-shortcode'; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
| 101 | + if (is_single() && is_singular('plan')) { |
|
| 102 | 102 | $args = array( |
| 103 | 103 | 'post_parent' => get_the_ID(), |
| 104 | 104 | 'post_type' => 'plan', |
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | $post_id = get_the_ID(); |
| 108 | - $has_children = get_children( $args ); |
|
| 109 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
| 108 | + $has_children = get_children($args); |
|
| 109 | + $has_parent = wp_get_post_parent_id($post_id); |
|
| 110 | 110 | |
| 111 | - if ( ! empty( $has_children ) ) { |
|
| 111 | + if ( ! empty($has_children)) { |
|
| 112 | 112 | $plan_type_class = 'parent-plan-page'; |
| 113 | - if ( 0 !== $has_parent ) { |
|
| 113 | + if (0 !== $has_parent) { |
|
| 114 | 114 | $plan_type_class = 'parent-sub-plan-page'; |
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | $plan_type_class = 'unique-plan-page'; |
| 118 | - if ( 0 !== $has_parent ) { |
|
| 118 | + if (0 !== $has_parent) { |
|
| 119 | 119 | $plan_type_class = 'child-plan-page'; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -127,16 +127,16 @@ discard block |
||
| 127 | 127 | /** |
| 128 | 128 | * Remove the single recipe and exercise title |
| 129 | 129 | */ |
| 130 | - public function single_title( $title ) { |
|
| 130 | + public function single_title($title) { |
|
| 131 | 131 | |
| 132 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
| 132 | + if (is_single() && is_singular('recipe')) { |
|
| 133 | 133 | |
| 134 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
| 134 | + $title = __('Recipe', 'lsx-health-plan'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
| 137 | + if (is_single() && is_singular('exercise')) { |
|
| 138 | 138 | |
| 139 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
| 139 | + $title = __('Exercise', 'lsx-health-plan'); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return $title; |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | 150 | public function remove_single_footer() { |
| 151 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
| 152 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
| 151 | + if (is_single() && is_singular(array('exercise', 'recipe', 'workout', 'meal'))) { |
|
| 152 | + remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | /** |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | * @param string $title the term title. |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - public function get_the_archive_title( $title ) { |
|
| 162 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 163 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 161 | + public function get_the_archive_title($title) { |
|
| 162 | + if (is_post_type_archive('recipe')) { |
|
| 163 | + $title = __('Recipes', 'lsx-health-plan'); |
|
| 164 | 164 | } |
| 165 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
| 166 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 165 | + if (is_post_type_archive('exercise')) { |
|
| 166 | + $title = __('Exercises', 'lsx-health-plan'); |
|
| 167 | 167 | } |
| 168 | - if ( is_tax() ) { |
|
| 168 | + if (is_tax()) { |
|
| 169 | 169 | $queried_object = get_queried_object(); |
| 170 | - if ( isset( $queried_object->name ) ) { |
|
| 170 | + if (isset($queried_object->name)) { |
|
| 171 | 171 | $title = $queried_object->name; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | 13 | function lsx_hp_plan_archive_filters() { |
| 14 | - if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
| 15 | - ?> |
|
| 14 | + if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
| 15 | + ?> |
|
| 16 | 16 | <div id="type-nav"> |
| 17 | 17 | <ul class="nav nav-pills lsx-type-nav-filter"> |
| 18 | 18 | <li class="active"><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-health-plan' ); ?></a></li> |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | </ul> |
| 23 | 23 | </div> |
| 24 | 24 | <?php |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -31,27 +31,27 @@ discard block |
||
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | 33 | function lsx_hp_plan_get_classes() { |
| 34 | - $classes = 'filter-free'; |
|
| 35 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 36 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 37 | - $linked_product = wc_get_product( $products[0] ); |
|
| 38 | - $price = $linked_product->get_price( 'raw' ); |
|
| 39 | - if ( empty( $price ) ) { |
|
| 40 | - $classes = 'filter-free'; |
|
| 41 | - } else { |
|
| 42 | - $classes = 'filter-paid'; |
|
| 43 | - } |
|
| 34 | + $classes = 'filter-free'; |
|
| 35 | + if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 36 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 37 | + $linked_product = wc_get_product( $products[0] ); |
|
| 38 | + $price = $linked_product->get_price( 'raw' ); |
|
| 39 | + if ( empty( $price ) ) { |
|
| 40 | + $classes = 'filter-free'; |
|
| 41 | + } else { |
|
| 42 | + $classes = 'filter-paid'; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
| 46 | - if ( false !== $featured && '' !== $featured ) { |
|
| 47 | - $classes .= ' filter-featured'; |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - return $classes; |
|
| 45 | + $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
| 46 | + if ( false !== $featured && '' !== $featured ) { |
|
| 47 | + $classes .= ' filter-featured'; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + return $classes; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function lsx_health_plan_back_to_plan_button() { |
| 54 | - ?> |
|
| 54 | + ?> |
|
| 55 | 55 | <div class="back-plan-btn"> |
| 56 | 56 | <a class="btn" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Back To Plan', 'lsx-health-plan' ); ?></a> |
| 57 | 57 | </div> |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | 13 | function lsx_hp_plan_archive_filters() { |
| 14 | - if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
| 14 | + if (is_post_type_archive('plan') && function_exists('wc_get_page_id') && false === apply_filters('lsx_hp_disable_plan_archive_filters', false)) { |
|
| 15 | 15 | ?> |
| 16 | 16 | <div id="type-nav"> |
| 17 | 17 | <ul class="nav nav-pills lsx-type-nav-filter"> |
| 18 | - <li class="active"><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-health-plan' ); ?></a></li> |
|
| 19 | - <li><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter=".filter-free"><?php esc_html_e( 'Free', 'lsx-health-plan' ); ?></a></li> |
|
| 20 | - <li><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter=".filter-paid"><?php esc_html_e( 'Paid', 'lsx-health-plan' ); ?></a></li> |
|
| 21 | - <li><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter=".filter-featured"><?php esc_html_e( 'Featured', 'lsx-health-plan' ); ?></a></li> |
|
| 18 | + <li class="active"><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_post_type_archive_link('plan')); ?>" data-filter="*"><?php esc_html_e('All', 'lsx-health-plan'); ?></a></li> |
|
| 19 | + <li><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_post_type_archive_link('plan')); ?>" data-filter=".filter-free"><?php esc_html_e('Free', 'lsx-health-plan'); ?></a></li> |
|
| 20 | + <li><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_post_type_archive_link('plan')); ?>" data-filter=".filter-paid"><?php esc_html_e('Paid', 'lsx-health-plan'); ?></a></li> |
|
| 21 | + <li><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_post_type_archive_link('plan')); ?>" data-filter=".filter-featured"><?php esc_html_e('Featured', 'lsx-health-plan'); ?></a></li> |
|
| 22 | 22 | </ul> |
| 23 | 23 | </div> |
| 24 | 24 | <?php |
@@ -32,18 +32,18 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function lsx_hp_plan_get_classes() { |
| 34 | 34 | $classes = 'filter-free'; |
| 35 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 35 | + if (\lsx_health_plan\functions\woocommerce\plan_has_products()) { |
|
| 36 | 36 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
| 37 | - $linked_product = wc_get_product( $products[0] ); |
|
| 38 | - $price = $linked_product->get_price( 'raw' ); |
|
| 39 | - if ( empty( $price ) ) { |
|
| 37 | + $linked_product = wc_get_product($products[0]); |
|
| 38 | + $price = $linked_product->get_price('raw'); |
|
| 39 | + if (empty($price)) { |
|
| 40 | 40 | $classes = 'filter-free'; |
| 41 | 41 | } else { |
| 42 | 42 | $classes = 'filter-paid'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
| 46 | - if ( false !== $featured && '' !== $featured ) { |
|
| 45 | + $featured = get_post_meta(get_the_ID(), 'plan_featured_plan', true); |
|
| 46 | + if (false !== $featured && '' !== $featured) { |
|
| 47 | 47 | $classes .= ' filter-featured'; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | function lsx_health_plan_back_to_plan_button() { |
| 54 | 54 | ?> |
| 55 | 55 | <div class="back-plan-btn"> |
| 56 | - <a class="btn" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Back To Plan', 'lsx-health-plan' ); ?></a> |
|
| 56 | + <a class="btn" href="<?php the_permalink(); ?>"><?php esc_html_e('Back To Plan', 'lsx-health-plan'); ?></a> |
|
| 57 | 57 | </div> |
| 58 | 58 | <?php |
| 59 | 59 | } |