This repository was archived by the owner on Apr 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
334 lines (280 loc) · 9.31 KB
/
Copy pathfunctions.php
File metadata and controls
334 lines (280 loc) · 9.31 KB
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<?php
/**
* functions.php
*
* added theme functionalities
*
*/
/**
* setup theme defaults and WordPress supports
*/
if ( ! function_exists('tvs_theme_setup') ) {
function tvs_theme_setup() {
/**
* Add default posts and comments RSS feed links to <head>.
*/
add_theme_support( 'automatic-feed-links' );
/**
* Register two custom navigation menus.
*/
/*register_nav_menus( array(
'primary' => __( 'Primary Menu', 'myfirsttheme' ),
'secondary' => __('Secondary Menu', 'myfirsttheme' )
) );*/
add_action( 'init', 'tvs_register_nav_menus');
/**
* Enable support for the following post formats:
* aside, gallery, quote, image, and video
*/
add_theme_support( 'post-formats', array ( 'aside', 'gallery', 'quote', 'image', 'video' ) );
/**
* Enqueue theme styles and scripts.
*/
add_action('wp_enqueue_scripts', 'tvs_add_theme_scripts');
/**
* Register widgetized area aka 'sidebars'.
*/
add_action( 'widgets_init', 'tvs_widgets_init' );
}
}
add_action( 'after_setup_theme', 'tvs_theme_setup' );
/**
* theme styles and scripts
*/
if ( ! function_exists('tvs_add_theme_scripts') ) {
function tvs_add_theme_scripts() {
// theme's style.css ( required )
wp_enqueue_style( 'style-css', get_stylesheet_uri() );
// bootstrap css
wp_enqueue_style(
'bootstrap-css',
get_template_directory_uri() . '/css/bootstrap.min.css',
array(),
'1.0'
);
// bootstrap theme css
wp_enqueue_style(
'bootstrap-theme-css',
get_template_directory_uri() . '/css/bootstrap-theme.min.css',
array( 'bootstrap-css' ),
'1.0'
);
// blog styles
wp_enqueue_style(
'blog-css',
get_template_directory_uri() . '/css/blog.css',
array(
'bootstrap-css',
'bootstrap-theme-css',
),
'1.0'
);
// main styles
// wp_enqueue_style(
// 'main-css',
// get_template_directory_uri() . '/css/main.css',
// array(
// 'bootstrap-css',
// 'bootstrap-theme-css',
// 'blog-css',
// ),
// '1.0'
// );
/**
* Theme Scripts
*/
// modernizer script
wp_enqueue_script(
'modernizr-script',
get_template_directory_uri() . '/js/vendor/modernizr-2.8.3-respond-1.4.2.min.js',
array(),
'1.0',
false
);
// bootstrap script
wp_enqueue_script(
'bootstrap-script',
get_template_directory_uri() . '/js/vendor/bootstrap.min.js',
array( 'jquery' ),
'1.0',
true
);
// bootstrap script
wp_enqueue_script(
'plugins-script',
get_template_directory_uri() . '/js/plugins.js',
array( 'jquery', 'bootstrap-script' ),
'1.0',
true
);
// main script
wp_enqueue_script(
'main-script',
get_template_directory_uri() . '/js/main.js',
array( 'jquery', 'bootstrap-script', 'plugins-script' ),
'1.0',
true
);
}
}
/**
* Extras ( misc. )
*/
include( get_stylesheet_uri() . 'inc/extras.php' );
/**
* Widgets ( and sidebars )
*/
include( get_stylesheet_uri() . 'inc/widgets.php' );
/**
* Customizer
*/
// include( get_stylesheet_uri() . 'inc/customizer.php' );
/**
* Theme Hooks
*/
/*html head*/
function tvs_singlular_description_meta( $c ) {
if ( is_singular() ) {
// get the page description and output it here...
// $new_content = ;
return $c;
}
}
add_filter( 'tvs_description_meta', 'tvs_singlular_description_meta' );
/**
* Header Hooks
*/
// before header
if ( ! function_exists( 'tvs_before_header' ) ) {
function tvs_before_header(){ do_action('tvs_before_header'); }
}
// header
function tvs_header() { ?>
<div class="container">
<div class="row">
<div class="<?php echo apply_filters( 'tvs_blog_header_classes', esc_attr( 'blog-header col-sm-8' ) ); ?>">
<?php
if ( is_front_page() || is_home() ) { ?>
<h1 class="blog-title h3"><a href="<?php bloginfo('url') ?>" title="<?php echo esc_attr( apply_filters('tvs_blog_header_title', ucwords( get_bloginfo('title') ) ) ); ?>"><?php echo apply_filters('tvs_blog_header_title', ucwords( get_bloginfo('title') ) ); ?></a></h1><!-- /.blog-title -->
<?php } else { ?>
<p class="blog-title h3"><a href="<?php bloginfo('url') ?>" title="<?php echo esc_attr( apply_filters('tvs_blog_header_title', ucwords( get_bloginfo('title') ) ) ); ?>"><?php echo apply_filters('tvs_blog_header_title', ucwords( get_bloginfo('title') ) ); ?></a></p><!-- /.blog-title -->
<?php } ?>
<p class="lead blog-description"><?php bloginfo('description'); ?></p>
</div><!-- /.blog-header -->
<?php tvs_blog_header_right_side(); ?>
</div><!-- /.row -->
</div><!-- /.container -->
<?php
}
if ( ! function_exists( 'tvs_blog_header_right_side();' ) ) {
/**
* [tvs_blog_header_right_side description]
* @return [type] [description]
*/
function tvs_blog_header_right_side() { ?>
<aside class="blog-header-aside col-sm-4">
<?php if ( ! is_active_sidebar( 'header-sidebar' ) ): ?>
<p>You can add a widget here!</p>
<?php else:
dynamic_sidebar( 'header-sidebar' );
endif; ?>
</aside>
<?php
}
}
if ( ! function_exists('tvs_primary_nav') ) {
/**
* [tvs_primary_nav description]
* @return [type] [description]
*/
function tvs_primary_nav() { ?>
<nav class="navbar navbar-default">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- <a class="navbar-brand" href="#"></a> -->
</div><!-- /.navbar-header -->
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<?php
/**
* Displays a navigation menu
* @param array $args Arguments
*/
$tvs_header_nav_menu_args = array(
'theme_location' => 'header-menu',
'container' => null,
'menu_class' => 'nav navbar-nav',
'menu_id' => '',
'fallback_cb' => 'wp_page_menu',
'before' => null,
'after' => null,
'items_wrap' => '<ul id = "%1$s" class = "%2$s">%3$s</ul>',
);
// WP function to display menu that
// was defined with array of arguments
wp_nav_menu( $tvs_header_nav_menu_args );
?>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-->
</nav><!-- /.navbar navbar-default -->
<?php
}
}
// after header
if (! function_exists( 'tvs_after_header' ) ) {
function tvs_after_header(){ do_action('tvs_after_header'); }
}
/**
* container hooks
*/
function tvs_container_before(){ do_action('tvs_container_before'); }
function tvs_container_after(){ do_action('tvs_container_after'); }
function tvs_page_heading() {
if ( is_home() || is_front_page() ) {
?>
<div class="container">
<div class="row">
<div class="page-header">
<h2><?php echo apply_filters( 'tvs_page_heading_title', 'Lastest Articles' ); ?></h2>
</div><!-- /.page-header -->
</div><!-- /.row -->
</div><!-- /.container -->
<?php
} // end if statement
}
add_action( 'tvs_container_before', 'tvs_page_heading' );
// sample function for ammending a filter
function change_page_heading_title( $c ) {
$new_content = $c . ':';
return $new_content;
}
add_filter( 'tvs_page_heading_title', 'change_page_heading_title' );
/**
* Footer Hooks
*/
if ( ! function_exists( 'tvs_before_footer' ) ) {
function tvs_before_footer(){ do_action( 'tvs_before_footer' ); }
}
if ( ! function_exists( 'tvs_after_footer' ) ) {
function tvs_after_footer(){ do_action( 'tvs_after_footer' ); }
}
if ( ! function_exists( 'tvs_footer_colophone' ) ) {
function tvs_footer_colophone() { ?>
<p>Blog template built for <a href="http://getbootstrap.com">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>. Running on <a href="https://wordpress.org/" title="WordPress">WordPress <?php bloginfo('version'); ?></a>. © Copyrighted <?php echo apply_filters( 'tvs_colophone_copyright_date', date( 'Y' ) ); ?></p>
<p><a href="#">Back to top</a></p>
<?php
}
} // end if
// demo of using filters to override the default filter
function change_footer_date() {
$new_date = '2014 - ' . date( 'Y' ) . '.';
return $new_date;
}
add_filter( 'tvs_colophone_copyright_date', 'change_footer_date' );