-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
69 lines (63 loc) · 2.04 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
<?php
/* Stylesheets */
function load_stylesheets() {
$path = get_template_directory_uri() . "/css";
foreach ($GLOBALS['css'] as $sheet) {
echo "<link rel='stylesheet' href='$path/$sheet' type='text/css'>";
}
}
/* JavaScript files */
function load_javascript() {
$path = get_template_directory_uri() . "/js";
echo "<script type='text/javascript' src='$path/head.min.js'></script>";
echo "<script type='text/javascript'>";
echo 'head.js(';
$first = true;
foreach ($GLOBALS['javascript'] as $js) {
/* Comma if not the first script */
if (!($first)) { echo ","; }
if (strcasecmp(substr($js, 0, 4), "http") == 0) {
/* Remote URL */
echo '"' . $js . '"';
} else {
/* Local URL */
echo '"' . $path/$js . '"';
}
$first = false;
}
echo ');</script>';
}
/* Add actions to wp_head */
add_action('wp_head', 'load_stylesheets');
add_action('wp_head', 'load_javascript');
/* Register our three sidebars */
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Header Widgets',
'id' => 'header-widgets',
'description' => 'These are widgets for the header.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'Sidebar Widgets',
'id' => 'sidebar-widgets',
'description' => 'These are widgets for the sidebar.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'Footer Widgets',
'id' => 'footer-widgets',
'description' => 'These are widgets for the footer.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
}
?>