-
Notifications
You must be signed in to change notification settings - Fork 34
/
functions.php
191 lines (146 loc) · 6.31 KB
/
functions.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php
/**
* JBST functions and definitions
*
* Set up the theme and provides some helper functions, which are used in the
* theme as custom template tags. Others are attached to action and filter
* hooks in WordPress to change core functionality.
*
* When using a child theme you can override certain functions (those wrapped
* in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before
* the parent theme's file, so the child theme functions would be used.
*
* @link http://codex.wordpress.org/Theme_Development
* @link http://codex.wordpress.org/Child_Themes
*
* Functions that are not pluggable (not wrapped in function_exists()) are
* instead attached to a filter or action hook.
*
* For more information on hooks, actions, and filters,
* @link http://codex.wordpress.org/Plugin_API
*
* @package WordPress
* @subpackage JBST
* @since 2.0.6
*/
/*
==========================================================
THEME DEFAULTS
==========================================================
*/
/**
* Set up the content width value based on the theme's design.
*
* @see jbst_content_width()
*
* @since JBST 1.0
*/
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
/* Load jbst functions on 'after_setup_theme'. */
add_action( 'after_setup_theme', 'jbst_default_settings' );
add_action( 'after_setup_theme', 'jbst_theme_setup');
if ( ! function_exists( 'jbst_theme_setup' ) ):
/*
Sets up theme defaults and registers support for various WordPress features. Note that this function is hooked into the after_setup_theme hook, which runs before the init hook. The init hook is too late for some features, such as indicating support post thumbnails.@since jbst 1.0
*/
/* Load custom jbst functions. */
require( get_template_directory() . '/functions/options-functions.php' );
require_once( trailingslashit( get_template_directory() ) . 'library/core.php' );
function jbst_theme_setup() {
/* Load custom jbst functions. */
require( get_template_directory() . '/functions/template-functions.php' );
/* Load custom jbst header functions. */
require( get_template_directory() . '/functions/jbst-header-functions.php' );
/* Load custom jbst header functions. */
require( get_template_directory() . '/functions/jbst-footer-functions.php' );
/* Load custom jbst Theme widgets. */
require( get_template_directory() . '/functions/template-widgets.php' );
/* Load custom jbst Comment functions. */
require( get_template_directory() . '/functions/template-comments.php' );
/* Load custom jbst Tag functions. */
require( get_template_directory() . '/functions/template-tags.php' );
/* Load custom jbst Comment form functions. */
require( get_template_directory() . '/functions/comments-functions.php' );
/* Load custom jbst Theme Customizer options. */
if(jbst_customizer)require( get_template_directory() . '/functions/template-customizer.php' );
/* Load custom jbst Theme functions. */
require( get_template_directory() . '/functions/template-ecommerce.php' );
/* Load BuddyPress functions after checking if it's active. */
if ( in_array( 'buddypress/bp-loader.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
require( get_template_directory() . '/functions/template-buddypress.php' );
}
require( get_template_directory() . '/functions/template-sidebars.php' );
/* Load basic styles to the editor */
//add_editor_style('library/assets/wptoless/wp2less.css');
/* Load basic styles to the editor */
add_editor_style('library/assets/css/wpless2css.css');
/* Add default posts and comments RSS feed links to head */
add_theme_support( 'automatic-feed-links' );
/* Enable support for Post Thumbnails */
add_theme_support( 'post-thumbnails' );
/* Enable support for Theme Menus */
add_theme_support( 'menus' );
/* Identify support for WooCommerce */
add_theme_support('woocommerce');
// Add theme support for Semantic Markup
$markup = array( 'search-form', 'comment-form', 'comment-list', );
add_theme_support( 'html5', $markup );
/*
==========================================================
Internationalizing And Localizing
==========================================================
*/
/* Make theme available for translation. Translations can be filed in the /languages/ directory. You can load a theme text domain in the theme's functions file. */
load_theme_textdomain( 'jamedo-bootstrap-start-theme', get_template_directory() . '/languages' );
if(jbst_less)require( get_template_directory() . '/functions/jbst-less-functions.php' );
/*
==========================================================
Loads Options
==========================================================
*/
if(jbst_options)require_once dirname( __FILE__ ) . '/options.php';
}
endif; // jbst_setup
/*
==========================================================
Call stylesheets and scripts from Core
==========================================================
*/
/* Put the call to this theme's css into a function */
function jbst_styles_css() {
wp_enqueue_style( 'jbst-style', get_stylesheet_uri() );
}
/* Load stylesheets */
add_action( 'wp_enqueue_scripts', 'jbst_styles_css',99 );
/* Load Scripts */
add_action( 'wp_enqueue_scripts', 'jbst_jquery_js' );
add_action( 'wp_enqueue_scripts', 'jbst_bootstrap_js' );
add_action( 'wp_enqueue_scripts', 'jbst_comments_js' );
add_action( 'wp_enqueue_scripts', 'jbst_js' );
/*
==========================================================
TEMPLATES
==========================================================
*/
add_action( 'jbst_header','jbst_open_content_wrappers',100);
add_action( 'jbst_footer','jbst_close_content_wrappers',1);
/*
==========================================================
CUSTOMIZER PREVIEW
==========================================================
*/
add_action( 'customize_preview_init', 'jbst_custom_style',99);
function my_styles_method() {
ob_start();
//require_once( get_template_directory() . '/functions/custom-style.php' );
//do_action('jbst_add_to_custom_style');
require_once( get_template_directory() . '/functions/custom-style-css.php' );
$return = ob_get_contents ();
ob_clean();
wp_add_inline_style( 'wpless2css', $return );
}
function jbst_custom_style() {
add_action( 'wp_enqueue_scripts', 'my_styles_method' );
}