-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathfunctions.php
169 lines (116 loc) · 5.46 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
<?php
/**
* Bootstrap on Wordpress functions and definitions
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
* @package WordPress
* @subpackage Bootstrap 3.3.7
* @autor Babobski
*/
/* ========================================================================================================================
Add language support to theme
======================================================================================================================== */
add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
load_theme_textdomain('wp_babobski', get_template_directory() . '/language');
}
/* ========================================================================================================================
Required external files
======================================================================================================================== */
require_once( 'external/bootstrap-utilities.php' );
require_once( 'external/wp_bootstrap_navwalker.php' );
/* ========================================================================================================================
Add html 5 support to wordpress elements
======================================================================================================================== */
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
'caption',
) );
/* ========================================================================================================================
Theme specific settings
Uncomment register_nav_menus to enable a single menu with the title of "Primary Navigation" in your theme
======================================================================================================================== */
add_theme_support('post-thumbnails');
register_nav_menus(array('primary' => 'Primary Navigation'));
/* ========================================================================================================================
Actions and Filters
======================================================================================================================== */
add_action( 'wp_enqueue_scripts', 'bootstrap_script_init' );
add_filter( 'body_class', array( 'BsWp', 'add_slug_to_body_class' ) );
/* ========================================================================================================================
Custom Post Types - include custom post types and taxonomies here e.g.
e.g. require_once( 'custom-post-types/your-custom-post-type.php' );
======================================================================================================================== */
/* ========================================================================================================================
Scripts
======================================================================================================================== */
/**
* Add scripts via wp_head()
*
* @return void
* @author Keir Whitaker
*/
function bootstrap_script_init() {
wp_register_script('bootstrap', get_template_directory_uri(). '/js/bootstrap.min.js', array( 'jquery' ), '3.3.7', true);
wp_enqueue_script('bootstrap');
wp_register_script( 'site', get_template_directory_uri().'/js/site.js', array( 'jquery', 'bootstrap' ), '0.0.1', true );
wp_enqueue_script( 'site' );
wp_register_style( 'bootstrap', get_stylesheet_directory_uri().'/css/bootstrap.min.css', '', '3.3.7', 'all' );
wp_enqueue_style( 'bootstrap' );
wp_register_style( 'screen', get_stylesheet_directory_uri().'/style.css', '', array(), 'screen' );
wp_enqueue_style( 'screen' );
}
/* ========================================================================================================================
Security & cleanup wp admin
======================================================================================================================== */
//remove wp version
function theme_remove_version() {
return '';
}
add_filter('the_generator', 'theme_remove_version');
//remove default footer text
function remove_footer_admin () {
echo "";
}
add_filter('admin_footer_text', 'remove_footer_admin');
//remove wordpress logo from adminbar
function wp_logo_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'wp_logo_admin_bar_remove', 0);
/* ========================================================================================================================
Comments
======================================================================================================================== */
/**
* Custom callback for outputting comments
*
* @return void
* @author Keir Whitaker
*/
function bootstrap_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
?>
<?php if ( $comment->comment_approved == '1' ): ?>
<li class="media">
<div class="media-left">
<?php echo get_avatar( $comment ); ?>
</div>
<div class="media-body">
<h4 class="media-heading">
<?php comment_author_link() ?>
</h4>
<time>
<a href="#comment-<?php comment_ID() ?>" pubdate>
<?php comment_date() ?> at <?php comment_time() ?>
</a>
</time>
<?php comment_text() ?>
</div>
<?php endif;
}