Merge master

This commit is contained in:
Ben Word
2014-10-24 17:56:17 -05:00
17 changed files with 62 additions and 197 deletions

View File

@@ -1,52 +0,0 @@
<?php
/**
* Use Bootstrap's media object for listing comments
*
* @link http://getbootstrap.com/components/#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 list-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 = 0, $args = array(), $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 id="comment-<?php comment_ID(); ?>" <?php comment_class('media comment-' . get_comment_ID()); ?>>
<?php include(locate_template('templates/comment.php')); ?>
<?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;
}
// Close ".media-body" <div> located in templates/comment.php, and then the comment's <li>
echo "</div></li>\n";
}
}
function roots_get_avatar($avatar, $type) {
if (!is_object($type)) { return $avatar; }
$avatar = str_replace("class='avatar", "class='avatar pull-left media-object", $avatar);
return $avatar;
}
add_filter('get_avatar', 'roots_get_avatar', 10, 2);

View File

@@ -25,7 +25,7 @@ function roots_setup() {
// Add HTML5 markup for captions
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
add_theme_support('html5', array('caption'));
add_theme_support('html5', array('caption', 'comment-form', 'comment-list'));
// Tell the TinyMCE editor to use a custom stylesheet
add_editor_style('/assets/css/editor-style.css');

View File

@@ -8,7 +8,7 @@
* Enqueue scripts in the following order:
* 1. jquery-1.11.1.min.js via Google CDN
* 2. /theme/assets/js/vendor/modernizr.min.js
* 3. /theme/assets/js/scripts.js (in footer)
* 3. /theme/assets/js/scripts.js
*
* Google Analytics is loaded after enqueued scripts if:
* - An ID has been defined in config.php
@@ -46,7 +46,7 @@ function roots_scripts() {
*/
if (!is_admin() && current_theme_supports('jquery-cdn')) {
wp_deregister_script('jquery');
wp_register_script('jquery', $assets['jquery'], array(), null, false);
wp_register_script('jquery', $assets['jquery'], array(), null, true);
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
}
@@ -54,7 +54,7 @@ function roots_scripts() {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false);
wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, true);
wp_enqueue_script('jquery');
wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true);
}

View File

@@ -14,3 +14,17 @@ function roots_get_search_form($form) {
return $form;
}
add_filter('get_search_form', 'roots_get_search_form');
/**
* Add page slug to body_class() classes if it doesn't exist
*/
function roots_body_class($classes) {
// Add post/page slug
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
}
}
return $classes;
}
add_filter('body_class', 'roots_body_class');