-
Notifications
You must be signed in to change notification settings - Fork 104
/
hooks.php
88 lines (78 loc) · 2.16 KB
/
hooks.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
<?php
/*
* b4st Hooks
* Designed to be used by a child theme.
*/
// Navbar (in `header.php`)
function b4st_navbar_before() {
do_action('navbar_before');
}
function b4st_navbar_after() {
do_action('navbar_after');
}
function b4st_navbar_brand() {
if ( ! has_action('navbar_brand') ) {
?>
<a class="navbar-brand" href="<?php echo esc_url( home_url('/') ); ?>"><?php bloginfo('name'); ?></a>
<?php
} else {
do_action('navbar_brand');
}
}
function b4st_navbar_search() {
if ( ! has_action('navbar_search') ) {
?>
<form class="form-inline ml-auto pt-2 pt-md-0" role="search" method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div class="input-group">
<input class="form-control border-secondary" type="text" value="<?php echo get_search_query(); ?>" placeholder="Search..." name="s" id="s">
<div class="input-group-append">
<button type="submit" id="searchsubmit" value="<?php esc_attr_x('Search', 'b4st') ?>" class="btn btn-outline-secondary">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</form>
<?php
} else {
do_action('navbar_search');
}
}
// Main
function b4st_main_before() {
do_action('main_before');
}
function b4st_main_after() {
do_action('main_after');
}
// Main Widgets
function b4st_main_widgets_before() {
do_action('sidebar_before');
}
function b4st_main_widgets_after() {
do_action('sidebar_after');
}
// Footer (in `footer.php`)
function b4st_footer_before() {
do_action('footer_before');
}
function b4st_footer_after() {
do_action('footer_after');
}
function b4st_bottomline() {
if ( ! has_action('bottomline') ) {
?>
<div class="container">
<div class="row pt-3">
<div class="col-sm">
<p class="text-center text-sm-left">© <?php echo date('Y'); ?> <a href="<?php echo home_url('/'); ?>"><?php bloginfo('name'); ?></a></p>
</div>
<div class="col-sm">
<p class="text-center text-sm-right"><a href="https://github.com/SimonPadbury/b4st">b4st</a> theme for WordPress</p>
</div>
</div>
</div>
<?php
} else {
do_action('bottomline');
}
}