Passed
Push — add/multiplan ( 02e61e...7421db )
by Warwick
03:32
created
classes/class-setup.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,86 +8,86 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
classes/integrations/class-team.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -8,142 +8,142 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/template-tags/team.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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,76 +18,76 @@  discard block
 block discarded – undo
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 32
 	
33
-	$plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans">
33
+     $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans">
34 34
 	<div class="row">';
35 35
 
36
-	foreach( $tab_plans['posts'] as $index => $post ) {
37
-
38
-		$plan_content .= '<div class="col-xs-12 col-sm-6 col-md-4">';
39
-		$plan_content .= '<article class="lsx-slot lsx-hp-shadow">';
40
-		$plan_content .= '<div class="plan-feature-img">';
41
-		$plan_content .= '<a href="' . get_permalink( $post ) . '">';
42
-
43
-		$linked_product  = false;
44
-		$restricted      = false;
45
-		$product         = null;
46
-		if ( \lsx_health_plan\functions\woocommerce\plan_has_products($post) ) {
47
-			$products       = \lsx_health_plan\functions\woocommerce\get_plan_products($post);
48
-			$linked_product = wc_get_product( $products[0] );
49
-			$product        = $linked_product;
50
-		}
51
-		if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
52
-			$restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
53
-		}
54
-
55
-		$featured_image = get_the_post_thumbnail( $post );
56
-		if ( ! empty( $featured_image ) && '' !== $featured_image ) {
57
-			$plan_content .= $featured_image;
58
-		} else {
59
-			$plan_content .= '<img loading="lazy"  class="placeholder" src="' . plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' . '">';
60
-		}
61
-		$plan_content .= '</a>';
62
-		$plan_content .= '</div>';
63
-
64
-		$plan_content .= '<div class="content-box plan-content-box">';
65
-		$plan_content .= '<h3 class="plan"><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . '</a></h3>';
66
-
67
-		if ( false !== $linked_product && false !== $restricted ) {
68
-			$plan_content .= $linked_product->get_price_html();
69
-		}
70
-
71
-		$plan_content .= '<div class="excerpt">';
72
-		if ( ! has_excerpt( $post ) ) {
73
-			$content = wp_trim_words( get_the_content( $post ), 20 );
74
-			$plan_content .= '<p>' . $content . '</p>';
75
-		} else {
76
-			$plan_content .= apply_filters( 'the_excerpt', get_the_excerpt( $post ) );
77
-		}
78
-		$plan_content .= '</div>';
79
-
80
-		$plan_content .= '</div>';
81
-		$plan_content .= '</article>';
82
-		$plan_content .= '</div>';
83
-
84
-	}
85
-	$plan_content .= '</div></div>';
36
+     foreach( $tab_plans['posts'] as $index => $post ) {
37
+
38
+          $plan_content .= '<div class="col-xs-12 col-sm-6 col-md-4">';
39
+          $plan_content .= '<article class="lsx-slot lsx-hp-shadow">';
40
+          $plan_content .= '<div class="plan-feature-img">';
41
+          $plan_content .= '<a href="' . get_permalink( $post ) . '">';
42
+
43
+          $linked_product  = false;
44
+          $restricted      = false;
45
+          $product         = null;
46
+          if ( \lsx_health_plan\functions\woocommerce\plan_has_products($post) ) {
47
+               $products       = \lsx_health_plan\functions\woocommerce\get_plan_products($post);
48
+               $linked_product = wc_get_product( $products[0] );
49
+               $product        = $linked_product;
50
+          }
51
+          if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
52
+               $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
53
+          }
54
+
55
+          $featured_image = get_the_post_thumbnail( $post );
56
+          if ( ! empty( $featured_image ) && '' !== $featured_image ) {
57
+               $plan_content .= $featured_image;
58
+          } else {
59
+               $plan_content .= '<img loading="lazy"  class="placeholder" src="' . plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' . '">';
60
+          }
61
+          $plan_content .= '</a>';
62
+          $plan_content .= '</div>';
63
+
64
+          $plan_content .= '<div class="content-box plan-content-box">';
65
+          $plan_content .= '<h3 class="plan"><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . '</a></h3>';
66
+
67
+          if ( false !== $linked_product && false !== $restricted ) {
68
+               $plan_content .= $linked_product->get_price_html();
69
+          }
70
+
71
+          $plan_content .= '<div class="excerpt">';
72
+          if ( ! has_excerpt( $post ) ) {
73
+               $content = wp_trim_words( get_the_content( $post ), 20 );
74
+               $plan_content .= '<p>' . $content . '</p>';
75
+          } else {
76
+               $plan_content .= apply_filters( 'the_excerpt', get_the_excerpt( $post ) );
77
+          }
78
+          $plan_content .= '</div>';
79
+
80
+          $plan_content .= '</div>';
81
+          $plan_content .= '</article>';
82
+          $plan_content .= '</div>';
83
+
84
+     }
85
+     $plan_content .= '</div></div>';
86 86
 	
87
-	$tab_plans['content'] = $plan_content;
87
+     $tab_plans['content'] = $plan_content;
88 88
 }
89 89
 if ( ! empty( $tab_plans['content'] ) ) {
90
-	$tabs[] = $tab_plans;
90
+     $tabs[] = $tab_plans;
91 91
 }
92 92
 
93 93
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 $tab_testimonial['content']   = '';
99 99
 
100 100
 if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) {
101
-	if ( count( $tab_testimonial['posts'] ) <= 2 ) {
102
-		$columns = count( $tab_testimonial['posts'] );
103
-	} else {
104
-		$columns = 3;
105
-	}
106
-
107
-	$post_ids = join( ',', $tab_testimonial['posts'] );
108
-	$tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]';
109
-	$tabs[] = $tab_testimonial;
101
+     if ( count( $tab_testimonial['posts'] ) <= 2 ) {
102
+          $columns = count( $tab_testimonial['posts'] );
103
+     } else {
104
+          $columns = 3;
105
+     }
106
+
107
+     $post_ids = join( ',', $tab_testimonial['posts'] );
108
+     $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]';
109
+     $tabs[] = $tab_testimonial;
110 110
 }
111 111
 
112 112
 if ( count( $tabs ) > 0 ) : ?>
Please login to merge, or discard this patch.
classes/frontend/class-general.php 1 patch
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -8,169 +8,169 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/template-tags/plan.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
22 22
 			</ul>
23 23
 		</div>
24 24
 		<?php
25
-	}
25
+     }
26 26
 }
27 27
 
28 28
 /**
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
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>
Please login to merge, or discard this patch.