-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
115 lines (92 loc) · 3.12 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
<?php
if ( ! function_exists( 'shinyblog_setup' ) ) :
function shinyblog_setup() {
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_editor_style();
add_theme_support( 'custom-header', apply_filters( 'shinyblog_custom_header_args', array(
'default-image' => get_parent_theme_file_uri( '/assets/images/header.jpg' ),
'flex-width' => true,
'width' => 1920,
'flex-height' => true,
'height' => 480,
) ) );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
add_theme_support( 'custom-background', apply_filters( 'shinyblog_custom_background_args', array(
'default-color' => 'fff',
'default-image' => '',
) ) );
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
register_nav_menu( 'nl-header', __( 'Main', 'shiny-blog' ) );
}
endif;
add_action( 'after_setup_theme', 'shinyblog_setup' );
function shinyblog_menu_settings() {
wp_nav_menu( array(
'theme_location' => 'nl-header',
'depth' => 1,
));
}
function shinyblog_content_width() {
$GLOBALS['content_width'] = apply_filters( 'shinyblog_content_width', 640 );
}
add_action( 'after_setup_theme', 'shinyblog_content_width', 0 );
function shinyblog_scripts() {
$dir = get_template_directory_uri();
wp_enqueue_style(
'google-fonts', add_query_arg(
array(
'family' => ( 'Lato:300,400,700,900|Lora:400,400i,700,700i' ),
'subset' => ( 'latin,latin-ext,cyrillic' ),
), '//fonts.googleapis.com/css'
));
wp_enqueue_style( 'shinyblog-main-style', get_stylesheet_uri() );
wp_enqueue_script( 'shinyblog-main-script', $dir . '/assets/js/script.min.js', array(), null, true );
wp_register_script( 'fontawesome', $dir . '/assets/js/fontawesome.min.js', array(), null, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'shinyblog_scripts' );
function shinyblog_widgets() {
register_sidebar( array(
'name' => __( 'Sidebar', 'shiny-blog' ),
'id' => 'nl-sidebar',
'description' => __( 'Right sidebar of the template', 'shiny-blog' ),
));
}
add_action( 'widgets_init', 'shinyblog_widgets' );
function shinyblog() {
wp_nav_menu( array(
'theme_location' => 'nl-header',
'menu_id' => 'menu',
'depth' => 1,
'container' => 'div',
'container_id' => 'zero'
));
}
if ( ! is_admin() ) {
function shinyblog_excerpt_length( $length ) {
return 18;
}
add_filter( 'excerpt_length', 'shinyblog_excerpt_length', 999 );
}
function shinyblog_excerpt_more( $more ) {
return __('...', 'shiny-blog');
}
add_filter( 'excerpt_more', 'shinyblog_excerpt_more' );
require get_parent_theme_file_path( '/inc/widgets/nl-social.php' );
require get_parent_theme_file_path( '/inc/customizer.php' );