forked from zoephilipps/scratch-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
executable file
·136 lines (83 loc) · 3.56 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
<?php
/* Do not remove this line. */
require_once('includes/scratch.php');
/*
* scratch_meta() adds all meta information to the <head> element for us.
*/
function scratch_meta() { ?>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="<?php bloginfo('description'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<?php }
add_action('wp_head', 'scratch_meta');
/* Theme CSS */
function theme_styles() {
wp_register_style( 'scratch-main', get_template_directory_uri() . '/assets/css/master.css', false, filemtime(dirname(__FILE__) . '/assets/css/master.css') );
wp_enqueue_style( 'scratch-main' );
wp_register_style( 'scratch-custom', get_template_directory_uri() . '/custom.css', false, filemtime(dirname(__FILE__) . '/custom.css') );
wp_enqueue_style( 'scratch-custom' );
}
add_action( 'wp_enqueue_scripts', 'theme_styles' );
/* Theme JavaScript */
function theme_js() {
wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.8.3.min.js', false, false, false );
wp_register_script( 'scratch-main-concat', get_template_directory_uri() . '/assets/js/concat/main.js', array('jquery'), filemtime(dirname(__FILE__) . '/assets/js/concat/main.js'), true );
wp_register_script( 'scratch-main-min', get_template_directory_uri() . '/assets/js/compiled/main.min.js', array('jquery'), filemtime(dirname(__FILE__) . '/assets/js/compiled/main.min.js'), true );
/* FOR DEVELOPMENT */
wp_enqueue_script( 'scratch-main-concat' );
/* FOR PRODUCTION */
/*wp_enqueue_script( 'scratch-main-min' );*/
}
add_action( 'wp_enqueue_scripts', 'theme_js' );
/* Enable ACF Options Pages */
if(function_exists('acf_add_options_page')) {
acf_add_options_page();
acf_add_options_sub_page('Header');
acf_add_options_sub_page('Sidebar');
acf_add_options_sub_page('Footer');
}
/* Enable Featured Image */
add_theme_support( 'post-thumbnails' );
/* Enable Custom Menus */
add_theme_support( 'menus' );
register_nav_menus(
array(
'scratch-main-nav' => __( 'Main Nav', 'scratch' ) // main nav in header
)
);
function scratch_main_nav() {
// display the wp3 menu if available
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container (should you choose to use it)
'menu' => __( 'Main Nav', 'scratch' ), // nav name
'menu_class' => 'main-nav', // adding custom nav class
'theme_location' => 'scratch-main-nav', // where it's located in the theme
'before' => '', // before the menu
'after' => '', // after the menu
'link_before' => '', // before each link
'link_after' => '', // after each link
'depth' => 0 // fallback function
));
} /* end scratch main nav */
function scratch_login_stylesheet() { ?>
<link rel="stylesheet"
id="custom_wp_admin_css"
href="<?php echo get_template_directory_uri() . '/assets/css/login.css?ver=' . filemtime(dirname(__FILE__) . '/assets/css/login.css'); ?>"
type="text/css"
media="all" />
<?php }
add_action( 'login_enqueue_scripts', 'scratch_login_stylesheet' );
function scratch_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'scratch_login_logo_url' );
function scratch_login_logo_url_title() {
return get_bloginfo('name');
}
add_filter( 'login_headertitle', 'scratch_login_logo_url_title' );
/* Place custom functions below here. */
/* Don't delete this closing tag. */
?>