1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Theme basic setup. |
4
|
|
|
* |
5
|
|
|
* @package spurs |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
// Exit if accessed directly. |
9
|
|
|
defined( 'ABSPATH' ) || exit; |
10
|
|
|
|
11
|
|
|
// Set the content width based on the theme's design and stylesheet. |
12
|
|
|
if ( ! isset( $content_width ) ) { |
13
|
|
|
$content_width = 640; /* pixels */ |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
add_action( 'after_setup_theme', 'spurs_setup' ); |
17
|
|
|
if ( ! function_exists( 'spurs_setup' ) ) { |
18
|
|
|
/** |
19
|
|
|
* Sets up theme defaults and registers support for various WordPress features. |
20
|
|
|
* |
21
|
|
|
* Note that this function is hooked into the after_setup_theme hook, which |
22
|
|
|
* runs before the init hook. The init hook is too late for some features, such |
23
|
|
|
* as indicating support for post thumbnails. |
24
|
|
|
*/ |
25
|
|
|
function spurs_setup() { |
26
|
|
|
/* |
27
|
|
|
* Make theme available for translation. |
28
|
|
|
* Translations can be filed in the /languages/ directory. |
29
|
|
|
* If you're building a theme based on Spurs, use a find and replace |
30
|
|
|
* to change 'spurs' to the name of your theme in all the template files |
31
|
|
|
*/ |
32
|
|
|
load_theme_textdomain( 'spurs', get_template_directory() . '/languages' ); |
33
|
|
|
|
34
|
|
|
// Add default posts and comments RSS feed links to head. |
35
|
|
|
add_theme_support( 'automatic-feed-links' ); |
36
|
|
|
|
37
|
|
|
/* |
38
|
|
|
* Let WordPress manage the document title. |
39
|
|
|
* By adding theme support, we declare that this theme does not use a |
40
|
|
|
* hard-coded <title> tag in the document head, and expect WordPress to |
41
|
|
|
* provide it for us. |
42
|
|
|
*/ |
43
|
|
|
add_theme_support( 'title-tag' ); |
44
|
|
|
|
45
|
|
|
// This theme uses wp_nav_menu() in one location. |
46
|
|
|
register_nav_menus( array( |
47
|
|
|
'primary' => __( 'Primary Menu', 'spurs' ), |
48
|
|
|
) ); |
49
|
|
|
|
50
|
|
|
/* |
51
|
|
|
* Switch default core markup for search form, comment form, and comments |
52
|
|
|
* to output valid HTML5. |
53
|
|
|
*/ |
54
|
|
|
add_theme_support( 'html5', array( |
55
|
|
|
'search-form', |
56
|
|
|
'comment-form', |
57
|
|
|
'comment-list', |
58
|
|
|
'gallery', |
59
|
|
|
'caption', |
60
|
|
|
) ); |
61
|
|
|
|
62
|
|
|
/* |
63
|
|
|
* Adding Thumbnail basic support |
64
|
|
|
*/ |
65
|
|
|
add_theme_support( 'post-thumbnails' ); |
66
|
|
|
|
67
|
|
|
/* |
68
|
|
|
* Adding support for Widget edit icons in customizer |
69
|
|
|
*/ |
70
|
|
|
add_theme_support( 'customize-selective-refresh-widgets' ); |
71
|
|
|
|
72
|
|
|
/* |
73
|
|
|
* Enable support for Post Formats. |
74
|
|
|
* See http://codex.wordpress.org/Post_Formats |
75
|
|
|
*/ |
76
|
|
|
add_theme_support( 'post-formats', array( |
77
|
|
|
'aside', |
78
|
|
|
'image', |
79
|
|
|
'video', |
80
|
|
|
'quote', |
81
|
|
|
'link', |
82
|
|
|
) ); |
83
|
|
|
|
84
|
|
|
// Set up the WordPress core custom background feature. |
85
|
|
|
add_theme_support( 'custom-background', apply_filters( 'spurs_custom_background_args', array( |
86
|
|
|
'default-color' => 'ffffff', |
87
|
|
|
'default-image' => '', |
88
|
|
|
) ) ); |
89
|
|
|
|
90
|
|
|
// Set up the WordPress Theme logo feature. |
91
|
|
|
add_theme_support( 'custom-logo' ); |
92
|
|
|
|
93
|
|
|
// Add support for responsive embedded content. |
94
|
|
|
add_theme_support( 'responsive-embeds' ); |
95
|
|
|
|
96
|
|
|
// Add support for default styles. |
97
|
|
|
add_theme_support( 'wp-block-styles' ); |
98
|
|
|
|
99
|
|
|
// Add support for full width blocks. |
100
|
|
|
add_theme_support( 'align-wide' ); |
101
|
|
|
|
102
|
|
|
// Check and setup theme default settings. |
103
|
|
|
spurs_setup_theme_default_settings(); |
104
|
|
|
|
105
|
|
|
// Adds brand colors to Blocks color palette. |
106
|
|
|
add_theme_support( 'editor-color-palette', array( |
107
|
|
|
array( |
108
|
|
|
'name' => __( 'Green', 'spurs' ), |
109
|
|
|
'slug' => 'green', |
110
|
|
|
'color' => '#6aaf08', |
111
|
|
|
), |
112
|
|
|
array( |
113
|
|
|
'name' => __( 'Dark Green', 'spurs' ), |
114
|
|
|
'slug' => 'dark-green', |
115
|
|
|
'color' => '#548a06', |
116
|
|
|
), |
117
|
|
|
array( |
118
|
|
|
'name' => __( 'Blue', 'spurs' ), |
119
|
|
|
'slug' => 'blue', |
120
|
|
|
'color' => '#007ac3', |
121
|
|
|
), |
122
|
|
|
array( |
123
|
|
|
'name' => __( 'Black', 'spurs' ), |
124
|
|
|
'slug' => 'black', |
125
|
|
|
'color' => '#2b2b2b', |
126
|
|
|
), |
127
|
|
|
array( |
128
|
|
|
'name' => __( 'White', 'spurs' ), |
129
|
|
|
'slug' => 'white', |
130
|
|
|
'color' => '#FFFFFF', |
131
|
|
|
), |
132
|
|
|
|
133
|
|
|
) ); |
134
|
|
|
|
135
|
|
|
// Hard cropped featured images |
136
|
|
|
//add_image_size( 'featured-rounded', 230, 230, true ); |
137
|
|
|
} |
138
|
|
|
} // spurs_setup. |
139
|
|
|
|
140
|
|
|
add_filter( 'excerpt_more', 'spurs_custom_excerpt_more' ); |
141
|
|
|
if ( ! function_exists( 'spurs_custom_excerpt_more' ) ) { |
142
|
|
|
/** |
143
|
|
|
* Removes the ... from the excerpt read more link |
144
|
|
|
* |
145
|
|
|
* @param string $more The excerpt. |
146
|
|
|
* |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
function spurs_custom_excerpt_more( $more ) { |
150
|
|
|
if ( ! is_admin() ) { |
151
|
|
|
$more = ''; |
|
|
|
|
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
return $more; |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
// ACF Pro Options Page |
159
|
|
|
if ( function_exists( 'acf_add_options_page' ) ) { |
160
|
|
|
|
161
|
|
|
acf_add_options_page( array( |
162
|
|
|
'page_title' => 'Theme General Settings', |
163
|
|
|
'menu_title' => 'Theme Settings', |
164
|
|
|
'menu_slug' => 'theme-general-settings', |
165
|
|
|
'capability' => 'edit_posts', |
166
|
|
|
'redirect' => false |
167
|
|
|
) ); |
168
|
|
|
|
169
|
|
|
} |