-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
executable file
·103 lines (75 loc) · 3.01 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
<?php
class sorenThemeFunctions {
public function __construct(){
// Set some constants
define('SOREN_THEME_VERSION', '1.0.11');
define('SOREN_THEME_DIR', get_template_directory());
define('SOREN_THEME_URL', get_template_directory_uri());
define('SOREN_CHILD_DIR', get_stylesheet_directory());
define('SOREN_CHILD_URL', get_stylesheet_directory_uri());
// Includes]
require_once(SOREN_THEME_DIR.'/inc/sidebars.php');
require_once(SOREN_THEME_DIR.'/inc/scripts.php');
require_once(SOREN_THEME_DIR.'/inc/customize-extended.php');
require_once(SOREN_THEME_DIR.'/inc/options.php');
require_once(SOREN_THEME_DIR.'/inc/template-tags.php');
require_once(SOREN_THEME_DIR.'/inc/helpers.php');
require_once(SOREN_THEME_DIR.'/inc/style-automation.php');
require_once(SOREN_THEME_DIR.'/inc/editor.php');
// components
require_once(SOREN_THEME_DIR.'/inc/components/component-nav.php');
require_once(SOREN_THEME_DIR.'/inc/components/component-gallery.php');
require_once(SOREN_THEME_DIR.'/inc/components/component-post-shares.php');
require_once(SOREN_THEME_DIR.'/inc/components/component-post-author.php');
require_once(SOREN_THEME_DIR.'/inc/components/component-post-nav.php');
require_once(SOREN_THEME_DIR.'/inc/components/component-pagination.php');
require_once(SOREN_THEME_DIR.'/inc/components/component-get-posts.php');
if(!class_exists('wp_less')){
require_once( SOREN_THEME_DIR.'/inc/wp-less.php' );
}
if( !class_exists( 'CMB_Meta_Box' ) ) {
require_once(SOREN_THEME_DIR.'/libs/custom-meta-boxes/custom-meta-boxes.php' );
}
// Custom Nav Menus
if ( function_exists( 'register_nav_menus' ) ){
$this->nav();
}
// Run the rest
add_action('init', array($this,'theme_supports'));
add_action('init', array($this,'image_sizes'),2);
add_filter('body_class', array($this,'browser_body_class'));
add_action('after_setup_theme', array($this,'textdomain'));
}
public function nav(){
register_nav_menus(
array(
'main_nav' => 'Main Nav',
'footer_nav' => 'Footer Nav'
)
);
}
public function image_sizes() {
set_post_thumbnail_size( 300, 225, true ); // default post thumbnail size
add_image_size( 'product-image', 300, 225, true ); // product thumbnail
add_image_size( 'product-image-large', 800, 600, true ); // main product image
}
public function browser_body_class($classes) {
global $is_gecko, $is_IE, $is_opera, $is_safari, $is_chrome;
if($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) $classes[] = 'ie';
else $classes[] = 'ur-browsur-sucks';
$classes[] = 'soren-responsive';
return $classes;
}
public function theme_supports(){
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5' );
}
function textdomain() {
load_theme_textdomain( 'soren_translation', SOREN_THEME_DIR. '/languages' );
}
}
new sorenThemeFunctions;