-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfunctions.php
105 lines (90 loc) · 3.06 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
<?php
/**
* RED Starter Theme functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package RED_Starter_Theme
*/
if ( ! function_exists( 'red_starter_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function red_starter_setup() {
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
// Let WordPress manage the document title.
add_theme_support( 'title-tag' );
// Enable support for Post Thumbnails on posts and pages.
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html( 'Primary Menu' ),
) );
// Switch search form, comment form, and comments to output valid HTML5.
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
}
endif; // red_starter_setup
add_action( 'after_setup_theme', 'red_starter_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* @global int $content_width
*/
function red_starter_content_width() {
$GLOBALS['content_width'] = apply_filters( 'red_starter_content_width', 640 );
}
add_action( 'after_setup_theme', 'red_starter_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function red_starter_widgets_init() {
register_sidebar( array(
'name' => esc_html( 'Sidebar' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'red_starter_widgets_init' );
/**
* Filter the stylesheet_uri to output the minified CSS file.
*/
function red_starter_minified_css( $stylesheet_uri, $stylesheet_dir_uri ) {
if ( file_exists( get_template_directory() . '/build/css/style.min.css' ) ) {
$stylesheet_uri = $stylesheet_dir_uri . '/build/css/style.min.css';
}
return $stylesheet_uri;
}
add_filter( 'stylesheet_uri', 'red_starter_minified_css', 10, 2 );
/**
* Enqueue scripts and styles.
*/
function red_starter_scripts() {
wp_enqueue_style( 'red-starter-style', get_stylesheet_uri() );
wp_enqueue_script( 'red-starter-navigation', get_template_directory_uri() . '/build/js/navigation.min.js', array(), '20151215', true );
wp_enqueue_script( 'red-starter-skip-link-focus-fix', get_template_directory_uri() . '/build/js/skip-link-focus-fix.min.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'red_starter_scripts' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';