forked from WhimsyCreative/whimsy-plus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwhimsy-plus.php
161 lines (127 loc) · 5.64 KB
/
whimsy-plus.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
/*
* Plugin Name: Whimsy+
* Version: 1.0.0
* Plugin URI: http://www.whimsycreative.co/framework/plus
* Description: A plugin packed with awesome features for Whimsy Framework.
* Author: Whimsy Creative Co.
* Author URI: http://www.whimsycreative.co
* Requires at least: 4.0
* Tested up to: 4.7.2
*
* Text Domain: whimsy-plus
* Domain Path: /language/
*
* @package WordPress
* @author Natasha Cozad
* @since 1.0.0
*/
if ( !class_exists( 'WhimsyPlus' ) ) {
/**
* @since 1.0.0
* @access public
*/
class WhimsyPlus {
/**
* @since 1.0.0
* @access public
* @return void
*/
function __construct() {
global $extend;
/* Set up an empty class for the global $extend object. */
$extend = new stdClass;
/* Define framework, parent theme, and child theme constants. */
add_action( 'init', array( $this, 'constants' ), 1 );
/* Load the core functions/classes required by the rest of the framework. */
add_action( 'init', array( $this, 'includes' ), 2 );
/* Load the settings and controls for the Customizer. */
add_action( 'customize_register', array( $this, 'customize' ), 40 );
/* Load the core functions/classes required by the rest of the framework. */
add_action( 'after_setup_theme', array( $this, 'unhook' ), 400 );
/* Enqueue necessary scripts and CSS files for the skins . */
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ), 200 );
}
/**
* @since 1.0.0
* @access public
* @return void
*/
function constants() {
/* Sets the framework version number. */
define( 'WHIMSY_PLUS_VERSION', '1.0.0' );
/* Sets the path to the plugin directory. */
define( 'WHIMSY_PLUS_PATH', plugin_dir_path( __FILE__ ) );
/* Sets the url to the plugin directory. */
define( 'WHIMSY_PLUS_URI', plugin_dir_url( __FILE__ ) );
// Sets the pathS to the Whimsy library.
define( 'WHIMSY_PLUS_LIB_PATH', trailingslashit( WHIMSY_PLUS_PATH . 'library' ) );
define( 'WHIMSY_PLUS_LIB_URI', trailingslashit( WHIMSY_PLUS_URI . 'library' ) );
// Core framework directory paths.
define( 'WHIMSY_PLUS_ADMIN', trailingslashit( WHIMSY_PLUS_LIB_PATH . 'admin' ) );
define( 'WHIMSY_PLUS_CUSTOMIZE', trailingslashit( WHIMSY_PLUS_LIB_PATH . 'admin/customize' ) );
define( 'WHIMSY_PLUS_INC', trailingslashit( WHIMSY_PLUS_LIB_PATH . 'inc' ) );
define( 'WHIMSY_PLUS_EXT', trailingslashit( WHIMSY_PLUS_PATH . 'extensions' ) );
// Core framework directory URIs.
define( 'WHIMSY_PLUS_CSS', trailingslashit( WHIMSY_PLUS_LIB_URI . 'css' ) );
define( 'WHIMSY_PLUS_JS', trailingslashit( WHIMSY_PLUS_LIB_URI . 'js' ) );
}
/**
* @since 1.0.0
* @access public
* @return void
*/
function includes() {
// Include Whimsy Customizer extensions
include_once WHIMSY_PLUS_CUSTOMIZE . 'kirki/kirki.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'config.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'panels.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'sections.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'colors.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'fonts.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'layout.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'header.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'menu.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'content.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'sidebar.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'footer.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'mosaic.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'forms.php';
include_once WHIMSY_PLUS_CUSTOMIZE . 'advanced.php';
// Include Whimsy Framework modifications
include_once WHIMSY_PLUS_INC . 'whimsy-header.php';
include_once WHIMSY_PLUS_INC . 'whimsy-footer.php';
// Include advanced extensions
include_once WHIMSY_PLUS_INC . 'sharing.php';
include_once WHIMSY_PLUS_INC . 'twitter-mentions.php';
// Remove Whimsy Framework actions
remove_action( 'init', 'whimsy_customize_style_output', 5 );
}
/**
* Updates to Whimsy Framework functions.
*/
function unhook() {
remove_action( 'customize_preview_init', 'whimsy_customize_preview_js', 10 );
}
/**
* Updates to the Whimsy Framework Customizer.
*/
function customize ( $wp_customize ) {
// Clear out the original Whimsy Framework section to make way for new stuff.
$wp_customize->remove_section( 'colors' );
$wp_customize->remove_section( 'header_image' );
$wp_customize->remove_control( 'display_header_text' );
$wp_customize->remove_control( 'whimsy_framework_logo_center' );
}
/**
* Include additional styles when in admin.
*/
function enqueue() {
// Enqueue live preview js.
//wp_enqueue_script( 'whimsy-plus', WHIMSY_PLUS_JS . 'whimsy-plus.js', array( 'customize-preview' ), WHIMSY_PLUS_VERSION , true );
// Enqueue custom stylesheet
wp_enqueue_style( 'whimsy-plus', WHIMSY_PLUS_CSS . 'whimsy-plus.css', array('whimsy-style'), WHIMSY_PLUS_VERSION );
}
}
}
new WhimsyPlus();