forked from zencoder/html5-boilerplate-for-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
69 lines (58 loc) · 2.35 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
<?php
/**
* @package WordPress
* @subpackage HTML5_Boilerplate
*/
// 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
}
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;
}