-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
executable file
·279 lines (244 loc) · 9.42 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?php
/**
* Patus functions and definitions
*
* @package Patus
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 650; /* pixels */
}
if ( ! function_exists( 'patus_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function patus_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Patus, use a find and replace
* to change 'patus' to the name of your theme in all the template files
*/
load_theme_textdomain( 'patus', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
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( 'large-thumb', 650, 300, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'patus' ),
) );
// This theme styles the visual editor to resemble the theme style.
add_editor_style( 'assets/css/editor-style.css' );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'patus_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 65,
'width' => 180,
'flex-width' => true,
'flex-height' => true,
) );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
}
endif; // patus_setup
add_action( 'after_setup_theme', 'patus_setup' );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function patus_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'patus' ),
'id' => 'sidebar-1',
'description' => '',
'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', 'patus_widgets_init' );
/**
* Register Dosis Google font for Patus.
*
* @return string
*/
function patus_font_url() {
$font_url = '';
/*
* Translators: If there are characters in your language that are not supported
* by Dosis, translate this to 'off'. Do not translate into your own language.
*/
if ( 'off' !== _x( 'on', 'Dosis font: on or off', 'patus' ) ) {
$font_url = add_query_arg( 'family', urlencode( 'Dosis:300' ), "//fonts.googleapis.com/css" );
}
return $font_url;
}
/**
* Enqueue scripts and styles.
*/
function patus_scripts() {
// Add Dosis font, used in the main stylesheet.
wp_enqueue_style( 'patus-dosis', patus_font_url(), array(), null );
// Load our main stylesheet.
wp_enqueue_style( 'patus-style', get_stylesheet_uri() );
// Add extra styling to patus-style
$primary = get_theme_mod( 'ft_primary_color', '41b7d8' );
$secondary = get_theme_mod( 'ft_secondary_color', 'f55d2d' );
$custom_css = "
a {color: #{$primary};
}
input[type=\"reset\"],
input[type=\"submit\"],
input[type=\"submit\"] {
background: #{$primary};
}
#site-navigation.main-navigation .menu-toggle span,
#site-navigation .menu ul li a:hover,
#site-navigation .menu ul li a:focus,
#site-navigation .menu ul ul li a:hover,
#site-navigation .menu ul ul li a:focus,
#site-navigation .nav-menu ul li a:hover,
#site-navigation .nav-menu ul li a:focus,
#site-navigation .nav-menu ul ul li a:hover,
#site-navigation .nav-menu ul ul li a:focus,
#site-navigation .menu li a:hover,
#site-navigation .nav-menu li a:hover,
#site-navigation .menu li.current-menu-item a,
#site-navigation .menu li.current_page_item a,
#site-navigation .nav-menu li.current-menu-item a,
#site-navigation .nav-menu li.current_page_item a,
.more-link,.more-link:hover,
.loop-pagination a:hover,
.loop-pagination span:hover,
.loop-pagination a.current,
.loop-pagination span.current,
.entry-footer .post-categories li a:hover,
.entry-footer .post-tags li a:hover,
.post-navigation a:hover,
.post-categories li a:hover,
.post-tags li a:hover,
#comments .comment .comment-wrapper .comment-meta .comment-time:hover,
#comments .comment .comment-wrapper .comment-meta .comment-reply-link:hover,
#comments .comment .comment-wrapper .comment-meta .comment-edit-link:hover,
.widget a:hover,
.widget #calendar_wrap a {
color: #{$secondary};
}
input[type=\"reset\"]:hover,
input[type=\"submit\"]:hover,
input[type=\"submit\"]:hover,
.entry-meta {
background: #{$secondary};
}";
if ( get_header_image() ) :
$custom_css .= '.site-header { background-image: url('. esc_url( get_header_image() ) .'); background-repeat: no-repeat; background-size: cover; }';
endif;
wp_add_inline_style( 'patus-style', $custom_css );
// Enqueue jQuery
wp_enqueue_script( 'patus-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'patus-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'patus_scripts' );
/**
* Enqueue scripts for admin page only: Theme info page
*/
function patus_admin_scripts() {
wp_enqueue_style('ft_admincss', get_template_directory_uri() . '/assets/css/theme-info.css');
}
add_action('admin_enqueue_scripts', 'patus_admin_scripts');
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* 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';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Add theme info page
*/
require get_template_directory() . '/inc/dashboard.php';
/**
* Include the TGM_Plugin_Activation class.
*/
require_once get_template_directory() . '/inc/tgm.php';
add_action( 'tgmpa_register', 'patus_register_required_plugins' );
function patus_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
// This is an example of how to include a plugin from the WordPress Plugin Repository.
array(
'name' => 'Mega Menu plugin for WordPress',
'slug' => 'easymega',
'required' => false,
),
);
/*
* Array of configuration settings. Amend each line as needed.
*
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
* strings available, please help us make TGMPA even better by giving us access to these translations or by
* sending in a pull-request with .po file(s) with the translations.
*
* Only uncomment the strings in the config array if you want to customize the strings.
*/
$config = array(
'id' => 'patus', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa( $plugins, $config );
}