forked from felixdorner/kouki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
166 lines (138 loc) · 5.67 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
<?php
/**
* Functions
*
* @package kouki
*/
/**
* Set the content width based on the theme's design and stylesheet
*/
if ( ! isset( $content_width ) ) {
$content_width = 740; /* pixels */
}
/*-----------------------------------------------------------------------------------*/
/* Setup
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'kouki_setup' ) ) :
/**
* Sets up kouki's defaults and registers support for various WordPress features
*/
function kouki_setup() {
/*
* Admin functionality
*/
if( is_admin() ) {
/**
* Add styles to post editor (editor-style.css)
*/
add_editor_style();
}
/*
* Make theme available for translation
*/
load_theme_textdomain( 'kouki', get_template_directory() . '/languages' );
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'kouki_thumb_large', 1200 );
add_image_size( 'kouki_thumb_regular', 600 );
/**
* Register main navigation
*/
register_nav_menu( 'main', 'Top-Bar' );
/**
* Enable HTML5 markup
*/
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery'
) );
} endif;
add_action( 'after_setup_theme', 'kouki_setup' );
/*-----------------------------------------------------------------------------------*/
/* Widgets
/*-----------------------------------------------------------------------------------*/
/**
* Register widget area
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function kouki_widgets_init() {
register_sidebar( array(
'name' => __( 'Footer', 'kouki' ),
'id' => 'footer-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'kouki_widgets_init' );
/*-----------------------------------------------------------------------------------*/
/* Scripts & Styles
/*-----------------------------------------------------------------------------------*/
function kouki_scripts() {
wp_enqueue_style( 'kouki-font-awesome-css', get_template_directory_uri() . "/assets/fonts/font-awesome/font-awesome.min.css", array(), '4.1.0', 'screen' );
wp_enqueue_style( 'kouki-style', get_stylesheet_uri(), array(), '20150917' );
wp_enqueue_script( 'kouki-lightbox', get_template_directory_uri() . '/assets/js/imagelightbox.min.js', array('jquery'), '1', true );
wp_enqueue_script( 'kouki-js', get_template_directory_uri().'/assets/js/theme.js', array( 'jquery', 'jquery-masonry' ), '20150209', true );
if ( is_singular() && comments_open() ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'kouki_scripts' );
/*-----------------------------------------------------------------------------------*/
/* Google Fonts
/*-----------------------------------------------------------------------------------*/
function kouki_fonts() {
$primary_font = of_get_option( 'kouki_primary_font' );
$secondary_font = of_get_option( 'kouki_secondary_font' );
$primary_name = urlencode( $primary_font );
$secondary_name = urlencode( $secondary_font );
$protocol = is_ssl() ? 'https' : 'http';
wp_enqueue_style( 'kouki-primary', "$protocol://fonts.googleapis.com/css?family=$primary_name:400,900italic,900,700italic,700,500italic,500,400italic,300italic,300,100italic,100 rel='stylesheet' type='text/css" );
wp_enqueue_style( 'kouki-secondary', "$protocol://fonts.googleapis.com/css?family=$secondary_name::400,900italic,900,700italic,700,500italic,500,400italic,300italic,300,100italic,100 rel='stylesheet' type='text/css" );
}
function kouki_base_fonts() {
$protocol = is_ssl() ? 'https' : 'http';
wp_enqueue_style( 'kouki-open-sans', "$protocol://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css" );
wp_enqueue_style( 'kouki-julius-sans-one', "$protocol://fonts.googleapis.com/css?family=Julius+Sans+One:400' rel='stylesheet' type='text/css" );
}
if ( function_exists( 'of_get_option' ) ) :
add_action( 'wp_enqueue_scripts', 'kouki_fonts' );
else :
add_action( 'wp_enqueue_scripts', 'kouki_base_fonts' );
endif;
/*-----------------------------------------------------------------------------------*/
/* Includes
/*-----------------------------------------------------------------------------------*/
require get_template_directory() . '/inc/back-compat.php';
require get_template_directory() . '/inc/admin/welcome-screen/welcome-screen.php';
require get_template_directory() . '/inc/comments.php';
require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/extras.php';
require get_template_directory() . '/inc/plugins/plugin-activation.php';
require get_template_directory() . '/inc/plugins/options-framework.php';
require get_template_directory() . '/inc/plugins/jetpack.php';
/**
* IMPORTANT NOTE:
* Do not add any custom code here. Please use a child theme so that your
* customizations aren't lost during updates.
* http://codex.wordpress.org/Child_Themes
*/