Comments clean up, consistent formatting

This commit is contained in:
Ben Word
2013-02-15 12:13:18 -06:00
parent 601d66f9a1
commit 260fc4c353
14 changed files with 31 additions and 65 deletions

View File

@@ -1,5 +1,7 @@
<?php
/**
* Theme activation
*/
if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
wp_redirect(admin_url('themes.php?page=theme_activation_options'));
exit;

View File

@@ -1,5 +1,4 @@
<?php
/**
* Clean up wp_head()
*
@@ -43,7 +42,6 @@ function roots_rel_canonical() {
$link = get_permalink($id);
echo "\t<link rel=\"canonical\" href=\"$link\">\n";
}
add_action('init', 'roots_head_cleanup');
/**
@@ -80,7 +78,6 @@ function roots_language_attributes() {
return $output;
}
add_filter('language_attributes', 'roots_language_attributes');
/**
@@ -92,7 +89,6 @@ function roots_clean_style_tag($input) {
$media = $matches[3][0] === 'print' ? ' media="print"' : '';
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
}
add_filter('style_loader_tag', 'roots_clean_style_tag');
/**
@@ -114,7 +110,6 @@ function roots_body_class($classes) {
return $classes;
}
add_filter('body_class', 'roots_body_class');
/**
@@ -204,7 +199,6 @@ if (roots_enable_root_relative_urls()) {
function roots_embed_wrap($cache, $url, $attr = '', $post_ID = '') {
return '<div class="entry-content-asset">' . $cache . '</div>';
}
add_filter('embed_oembed_html', 'roots_embed_wrap', 10, 4);
add_filter('embed_googlevideo', 'roots_embed_wrap', 10, 2);
@@ -216,7 +210,6 @@ function roots_attachment_link_class($html) {
$html = str_replace('<a', '<a class="thumbnail"', $html);
return $html;
}
add_filter('wp_get_attachment_link', 'roots_attachment_link_class', 10, 1);
/**
@@ -256,7 +249,6 @@ function roots_caption($output, $attr, $content) {
return $output;
}
add_filter('img_caption_shortcode', 'roots_caption', 10, 3);
/**
@@ -353,7 +345,6 @@ function roots_gallery($attr) {
return $output;
}
if (current_theme_supports('bootstrap-gallery')) {
remove_shortcode('gallery');
add_shortcode('gallery', 'roots_gallery');
@@ -370,7 +361,6 @@ function roots_remove_dashboard_widgets() {
remove_meta_box('dashboard_primary', 'dashboard', 'normal');
remove_meta_box('dashboard_secondary', 'dashboard', 'normal');
}
add_action('admin_init', 'roots_remove_dashboard_widgets');
/**
@@ -383,7 +373,6 @@ function roots_excerpt_length($length) {
function roots_excerpt_more($more) {
return ' &hellip; <a href="' . get_permalink() . '">' . __('Continued', 'roots') . '</a>';
}
add_filter('excerpt_length', 'roots_excerpt_length');
add_filter('excerpt_more', 'roots_excerpt_more');
@@ -393,7 +382,6 @@ add_filter('excerpt_more', 'roots_excerpt_more');
function roots_remove_self_closing_tags($input) {
return str_replace(' />', '>', $input);
}
add_filter('get_avatar', 'roots_remove_self_closing_tags'); // <img />
add_filter('comment_id_fields', 'roots_remove_self_closing_tags'); // <input />
add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags'); // <img />
@@ -403,10 +391,8 @@ add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags'); // <img />
*/
function roots_remove_default_description($bloginfo) {
$default_tagline = 'Just another WordPress site';
return ($bloginfo === $default_tagline) ? '' : $bloginfo;
}
add_filter('get_bloginfo_rss', 'roots_remove_default_description');
/**
@@ -423,7 +409,6 @@ function roots_change_mce_options($options) {
return $options;
}
add_filter('tiny_mce_before_init', 'roots_change_mce_options');
/**
@@ -463,7 +448,6 @@ function roots_widget_first_last_classes($params) {
return $params;
}
add_filter('dynamic_sidebar_params', 'roots_widget_first_last_classes');
/**
@@ -483,7 +467,6 @@ function roots_nice_search_redirect() {
exit();
}
}
if (current_theme_supports('nice-search')) {
add_action('template_redirect', 'roots_nice_search_redirect');
}
@@ -501,7 +484,6 @@ function roots_request_filter($query_vars) {
return $query_vars;
}
add_filter('request', 'roots_request_filter');
/**
@@ -512,5 +494,4 @@ function roots_get_search_form($argument) {
locate_template('/templates/searchform.php', true, false);
}
}
add_filter('get_search_form', 'roots_get_search_form');

View File

@@ -1,11 +1,4 @@
<?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
*
@@ -61,3 +54,9 @@ class Roots_Walker_Comment extends Walker_Comment {
echo "</li>\n";
}
}
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');

View File

@@ -1,5 +1,4 @@
<?php
/**
* Enable theme features
*/

View File

@@ -1,3 +1,4 @@
<?php
// Custom functions
/**
* Custom functions
*/

View File

@@ -2,8 +2,6 @@
/**
* Add HTML5 Boilerplate's .htaccess via WordPress
*/
// Add the contents of h5bp-htaccess into .htaccess
function roots_add_h5bp_htaccess($content) {
global $wp_rewrite;
$home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;

View File

@@ -2,9 +2,7 @@
/**
* Roots initial setup and constants
*/
function roots_setup() {
// Make theme available for translation
load_theme_textdomain('roots', get_template_directory() . '/lang');
@@ -23,9 +21,7 @@ function roots_setup() {
// Tell the TinyMCE editor to use a custom stylesheet
add_editor_style('/assets/css/editor-style.css');
}
add_action('after_setup_theme', 'roots_setup');
// Backwards compatibility for older than PHP 5.3.0

View File

@@ -1,5 +1,4 @@
<?php
/**
* Cleaner walker for wp_nav_menu()
*
@@ -29,11 +28,11 @@ class Roots_Nav_Walker extends Walker_Nav_Menu {
$item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
}
elseif (stristr($item_html, 'li class="divider')) {
$item_html = preg_replace('/<a[^>]*>.*?<\/a>/iU', '', $item_html);
$item_html = preg_replace('/<a[^>]*>.*?<\/a>/iU', '', $item_html);
}
elseif (stristr($item_html, 'li class="nav-header')) {
$item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html);
}
}
$output .= $item_html;
}
@@ -68,7 +67,6 @@ function roots_nav_menu_css_class($classes, $item) {
return array_filter($classes, 'is_element_empty');
}
add_filter('nav_menu_css_class', 'roots_nav_menu_css_class', 10, 2);
add_filter('nav_menu_item_id', '__return_null');
@@ -95,7 +93,4 @@ function roots_nav_menu_args($args = '') {
return array_merge($args, $roots_nav_menu_args);
}
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');

View File

@@ -15,7 +15,6 @@
*
* @link https://github.com/retlehs/roots/blob/master/doc/rewrites.md
*/
function roots_add_rewrites($content) {
global $wp_rewrite;
$roots_new_non_wp_rules = array(

View File

@@ -1,6 +1,6 @@
<?php
/**
* Scripts and stylesheets
* Enqueue scripts and stylesheets
*
* Enqueue stylesheets in the following order:
* 1. /theme/assets/css/bootstrap.css
@@ -14,7 +14,6 @@
* 3. /theme/assets/js/plugins.js (in footer)
* 4. /theme/assets/js/main.js (in footer)
*/
function roots_scripts() {
wp_enqueue_style('roots_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css', false, null);
wp_enqueue_style('roots_bootstrap_responsive', get_template_directory_uri() . '/assets/css/bootstrap-responsive.css', array('roots_bootstrap'), null);
@@ -45,7 +44,6 @@ function roots_scripts() {
wp_enqueue_script('roots_plugins');
wp_enqueue_script('roots_main');
}
add_action('wp_enqueue_scripts', 'roots_scripts', 100);
// http://wordpress.stackexchange.com/a/12450
@@ -63,7 +61,6 @@ function roots_jquery_local_fallback($src, $handle) {
return $src;
}
if (!is_admin()) {
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
}
@@ -76,7 +73,6 @@ function roots_google_analytics() { ?>
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<?php }
if (GOOGLE_ANALYTICS_ID) {
add_action('wp_footer', 'roots_google_analytics', 20);
}

View File

@@ -40,4 +40,3 @@ class Roots_Sidebar {
return is_page_template($page_template);
}
}
?>

View File

@@ -1,7 +1,6 @@
<?php
/**
* Theme Wrapper
* Theme wrapper
*
* @link http://scribu.net/wordpress/theme-wrappers.html
*/
@@ -48,10 +47,8 @@ class Roots_Wrapping {
return locate_template($templates);
}
}
add_filter('template_include', array('Roots_Wrapping', 'wrap'), 99);
/**
* Page titles
*/
@@ -98,10 +95,11 @@ function roots_htaccess_writable() {
}
}
}
add_action('admin_init', 'roots_htaccess_writable');
// returns WordPress subdirectory if applicable
/**
* Return WordPress subdirectory if applicable
*/
function wp_base_dir() {
preg_match('!(https?://[^/|"]+)([^"]+)?!', site_url(), $matches);
if (count($matches) === 3) {
@@ -111,7 +109,9 @@ function wp_base_dir() {
}
}
// opposite of built in WP functions for trailing slashes
/**
* Opposite of built in WP functions for trailing slashes
*/
function leadingslashit($string) {
return '/' . unleadingslashit($string);
}

View File

@@ -1,7 +1,9 @@
<?php
/**
* Register sidebars and widgets
*/
function roots_widgets_init() {
// Register widgetized areas
// Sidebars
register_sidebar(array(
'name' => __('Primary Sidebar', 'roots'),
'id' => 'sidebar-primary',
@@ -20,12 +22,14 @@ function roots_widgets_init() {
'after_title' => '</h3>',
));
// Register widgets
// Widgets
register_widget('Roots_Vcard_Widget');
}
add_action('widgets_init', 'roots_widgets_init');
// Example vCard widget
/**
* Example vCard widget
*/
class Roots_Vcard_Widget extends WP_Widget {
private $fields = array(
'title' => 'Title (optional)',