|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Custom functions that act independently of the theme templates. |
|
4
|
|
|
* |
|
5
|
|
|
* Eventually, some of the functionality here could be replaced by core features. |
|
6
|
|
|
* |
|
7
|
|
|
* @package bitsy |
|
8
|
|
|
*/ |
|
9
|
|
|
/** |
|
10
|
|
|
* Adds custom classes to the array of header classes. |
|
11
|
|
|
* |
|
12
|
|
|
* @param array $classes Classes for the body element. |
|
13
|
|
|
* |
|
14
|
|
|
* @return array |
|
15
|
|
|
*/ |
|
16
|
|
|
add_action( 'bitsy_header_class', 'bitsy_output_header_class' ); |
|
|
|
|
|
|
17
|
|
|
function bitsy_output_header_class() { |
|
18
|
|
|
// Adds a class of alt to home and landing pages. |
|
19
|
|
|
if ( is_front_page() ) { |
|
|
|
|
|
|
20
|
|
|
echo 'alt'; |
|
21
|
|
|
} |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Adds custom classes to the array of body classes. |
|
26
|
|
|
* |
|
27
|
|
|
* @param array $classes Classes for the body element. |
|
28
|
|
|
* |
|
29
|
|
|
* @return array |
|
30
|
|
|
*/ |
|
31
|
|
|
function bitsy_body_classes( $classes ) { |
|
32
|
|
|
// Adds a class of group-blog to blogs with more than 1 published author. |
|
33
|
|
|
if ( is_multi_author() ) { |
|
|
|
|
|
|
34
|
|
|
$classes[] = 'group-blog'; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
// Adds a class of hfeed to non-singular pages. |
|
38
|
|
|
if ( ! is_singular() ) { |
|
|
|
|
|
|
39
|
|
|
$classes[] = 'hfeed'; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
return $classes; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
add_filter( 'body_class', 'bitsy_body_classes' ); |
|
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Adds custom classes to the array of footer classes. |
|
49
|
|
|
* |
|
50
|
|
|
* @param array $classes Classes for the footer element. |
|
51
|
|
|
* |
|
52
|
|
|
* @return array |
|
53
|
|
|
*/ |
|
54
|
|
|
add_action( 'bitsy_footer_class', 'bitsy_output_footer_class' ); |
|
55
|
|
|
function bitsy_output_footer_class() { |
|
56
|
|
|
// Adds a class of alt to home and landing pages. |
|
57
|
|
|
if ( is_front_page() ) { |
|
|
|
|
|
|
58
|
|
|
echo 'alt'; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Add a pingback url auto-discovery header for singularly identifiable articles. |
|
64
|
|
|
*/ |
|
65
|
|
|
function bitsy_pingback_header() { |
|
66
|
|
|
if ( is_singular() && pings_open() ) { |
|
|
|
|
|
|
67
|
|
|
echo '<link rel="pingback" href="', bloginfo( 'pingback_url' ), '">'; |
|
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
add_action( 'wp_head', 'bitsy_pingback_header' ); |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Creating theme hooks |
|
75
|
|
|
*/ |
|
76
|
|
|
/** |
|
77
|
|
|
* Create header class hook |
|
78
|
|
|
*/ |
|
79
|
|
|
function bitsy_header_class() { |
|
80
|
|
|
do_action( 'bitsy_header_class' ); |
|
|
|
|
|
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Create content class hook |
|
85
|
|
|
*/ |
|
86
|
|
|
function bitsy_content_class() { |
|
87
|
|
|
do_action( 'bitsy_content_class' ); |
|
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Create footer class hook |
|
92
|
|
|
*/ |
|
93
|
|
|
function bitsy_footer_class() { |
|
94
|
|
|
do_action( 'bitsy_footer_class' ); |
|
|
|
|
|
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Declare Woo Support |
|
99
|
|
|
*/ |
|
100
|
|
|
add_action( 'after_setup_theme', 'woocommerce_support' ); |
|
101
|
|
|
function woocommerce_support() { |
|
102
|
|
|
add_theme_support( 'woocommerce' ); |
|
|
|
|
|
|
103
|
|
|
} |