forked from benoitchantre/bourbonwp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
92 lines (76 loc) · 3.13 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
<?php
/**
* @package WordPress
* @subpackage BourbonWP
*/
// Custom HTML5 Comment Markup
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li>
<article <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<header class="comment-author vcard">
<?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
<time><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a></time>
<?php edit_comment_link(__('(Edit)'),' ','') ?>
</header>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Your comment is awaiting moderation.') ?></em>
<br />
<?php endif; ?>
<?php comment_text() ?>
<nav>
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</nav>
</article>
<!-- </li> is added by wordpress automatically -->
<?php
}
add_theme_support( 'automatic-feed-links' );
// Widgetized Sidebar HTML5 Markup
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'before_widget' => '<section>',
'after_widget' => '</section>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
}
// Custom Functions for CSS/Javascript Versioning
$GLOBALS["TEMPLATE_URL"] = get_bloginfo('template_url')."/";
$GLOBALS["TEMPLATE_RELATIVE_URL"] = wp_make_link_relative($GLOBALS["TEMPLATE_URL"]);
// Add ?v=[last modified time] to style sheets
function versioned_stylesheet($relative_url, $add_attributes=""){
echo '<link rel="stylesheet" href="'.versioned_resource($relative_url).'" '.$add_attributes.'>'."\n";
}
// Add ?v=[last modified time] to javascripts
function versioned_javascript($relative_url, $add_attributes=""){
echo '<script src="'.versioned_resource($relative_url).'" '.$add_attributes.'></script>'."\n";
}
// Add ?v=[last modified time] to a file url
function versioned_resource($relative_url){
$file = $_SERVER["DOCUMENT_ROOT"].$relative_url;
$file_version = "";
if(file_exists($file)) {
$file_version = "?v=".filemtime($file);
}
return $relative_url.$file_version;
}
add_theme_support( 'post-thumbnails' );
// add_image_size( 'medium-wide', 666, 238 ); //666x238
// Deregister jQuery and use the version you need instead - script from http://css-tricks.com/snippets/wordpress/include-jquery-in-wordpress-theme/
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
// Register multiple menus
function register_my_menus(){
register_nav_menus(array(
'header' => 'Main Nav',
'footer' => 'Footer Nav'
)
);
}
add_action( 'init', 'register_my_menus' );