Merge branch 'master' into grunt
This commit is contained in:
@@ -99,12 +99,6 @@ add_filter('style_loader_tag', 'roots_clean_style_tag');
|
||||
* Add and remove body_class() classes
|
||||
*/
|
||||
function roots_body_class($classes) {
|
||||
// Add 'top-navbar' class if using Bootstrap's Navbar
|
||||
// Used to add styling to account for the WordPress admin bar
|
||||
if (current_theme_supports('bootstrap-top-navbar')) {
|
||||
$classes[] = 'top-navbar';
|
||||
}
|
||||
|
||||
// Add post/page slug
|
||||
if (is_single() || is_page() && !is_front_page()) {
|
||||
$classes[] = basename(get_permalink());
|
||||
|
||||
63
lib/comments.php
Normal file
63
lib/comments.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
function roots_get_avatar($avatar) {
|
||||
$avatar = str_replace("class='avatar", "class='avatar pull-left media-object", $avatar);
|
||||
return $avatar;
|
||||
}
|
||||
add_filter('get_avatar', 'roots_get_avatar');
|
||||
|
||||
/**
|
||||
* Use Bootstrap's media object for listing comments
|
||||
*
|
||||
* @link http://twitter.github.com/bootstrap/components.html#media
|
||||
*/
|
||||
class Roots_Walker_Comment extends Walker_Comment {
|
||||
function start_lvl(&$output, $depth = 0, $args = array()) {
|
||||
$GLOBALS['comment_depth'] = $depth + 1; ?>
|
||||
<ul <?php comment_class('media unstyled comment-' . get_comment_ID()); ?>>
|
||||
<?php
|
||||
}
|
||||
|
||||
function end_lvl(&$output, $depth = 0, $args = array()) {
|
||||
$GLOBALS['comment_depth'] = $depth + 1;
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
function start_el(&$output, $comment, $depth, $args, $id = 0) {
|
||||
$depth++;
|
||||
$GLOBALS['comment_depth'] = $depth;
|
||||
$GLOBALS['comment'] = $comment;
|
||||
|
||||
if (!empty($args['callback'])) {
|
||||
call_user_func($args['callback'], $comment, $args, $depth);
|
||||
return;
|
||||
}
|
||||
|
||||
extract($args, EXTR_SKIP); ?>
|
||||
|
||||
<li <?php comment_class('media comment-' . get_comment_ID()); ?>>
|
||||
<?php echo get_avatar($comment, $size = '64'); ?>
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading"><?php echo get_comment_author_link(); ?></h4>
|
||||
<time datetime="<?php echo comment_date('c'); ?>"><a href="<?php echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?>"><?php printf(__('%1$s', 'roots'), get_comment_date(), get_comment_time()); ?></a></time>
|
||||
<?php edit_comment_link(__('(Edit)', 'roots'), '', ''); ?>
|
||||
|
||||
<?php if ($comment->comment_approved == '0') : ?>
|
||||
<div class="alert">
|
||||
<?php _e('Your comment is awaiting moderation.', 'roots'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php comment_text(); ?>
|
||||
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
function end_el(&$output, $comment, $depth = 0, $args = array()) {
|
||||
if (!empty($args['end-callback'])) {
|
||||
call_user_func($args['end-callback'], $comment, $args, $depth);
|
||||
return;
|
||||
}
|
||||
echo "</li>\n";
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
add_theme_support('root-relative-urls'); // Enable relative URLs
|
||||
add_theme_support('rewrites'); // Enable URL rewrites
|
||||
add_theme_support('h5bp-htaccess'); // Enable HTML5 Boilerplate's .htaccess
|
||||
add_theme_support('bootstrap-top-navbar'); // Enable Bootstrap's fixed navbar
|
||||
add_theme_support('bootstrap-top-navbar'); // Enable Bootstrap's top navbar
|
||||
add_theme_support('bootstrap-gallery'); // Enable Bootstrap's thumbnails component on [gallery]
|
||||
add_theme_support('nice-search'); // Enable /?s= to /search/ redirect
|
||||
|
||||
|
||||
@@ -59,3 +59,16 @@ function roots_jquery_local_fallback($src, $handle) {
|
||||
if (!is_admin()) {
|
||||
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
||||
}
|
||||
|
||||
function roots_google_analytics() { ?>
|
||||
<script>
|
||||
var _gaq=[['_setAccount','<?php echo GOOGLE_ANALYTICS_ID; ?>'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
<?php }
|
||||
|
||||
if (GOOGLE_ANALYTICS_ID) {
|
||||
add_action('wp_footer', 'roots_google_analytics', 20);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user