-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlsx-health-plan.php
81 lines (72 loc) · 2.19 KB
/
lsx-health-plan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* Plugin Name: LSX Health
* Plugin URI: https://github.com/lightspeeddevelopment/lsx-health-plan
* Description: LSX Health Plan extension adds a meal and workout plan, with recipes.
* Author: LightSpeed
* Version: 2.0.2
* Author URI: https://www.lsdev.biz/
* License: GPL3
* Text Domain: lsx-health-plan
* Domain Path: /languages/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) );
define( 'LSX_HEALTH_PLAN_CORE', __FILE__ );
define( 'LSX_HEALTH_PLAN_URL', plugin_dir_url( __FILE__ ) );
define( 'LSX_HEALTH_PLAN_VER', '2.0.2' );
/* ======================= Below is the Plugin Class init ========================= */
require_once LSX_HEALTH_PLAN_PATH . '/classes/class-core.php';
/**
* Remove unnecessary custom post types
*
* @return void
*/
function lsx_remove_extra_meta_box() {
global $wp_meta_boxes;
$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
}
add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 );
/**
* Redirect user after login or redirect
*
* @return void
*/
function lsx_login_redirect() {
$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
if ( false === $plan_slug ) {
$plan_slug = 'my-plan';
}
return home_url( $plan_slug );
}
add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' );
/**
* Undocumented function
*
* @return object lsx_health_plan\classes\Core::get_instance();
*/
function lsx_health_plan() {
return \lsx_health_plan\classes\Core::get_instance();
}
lsx_health_plan();
/**
* Creates the svg path
*
* @return void
*/
function lsx_get_svg_icon( $icon ) {
$path = '/assets/images/';
if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
// Load and return the contents of the file
return file_get_contents(LSX_HEALTH_PLAN_PATH . $path . $icon);
}
// Return a blank string if we can't find the file.
return '';
}