diff --git a/assets/less/components/_gallery.less b/assets/less/components/_media.less
similarity index 58%
rename from assets/less/components/_gallery.less
rename to assets/less/components/_media.less
index 5d950af..78458a2 100644
--- a/assets/less/components/_gallery.less
+++ b/assets/less/components/_media.less
@@ -1,3 +1,8 @@
+// Captions
+.wp-caption {
+ &:extend(.thumbnail all);
+}
+
// Gallery shortcode
.gallery-row {
padding: (@line-height-computed / 2) 0;
diff --git a/assets/less/components/_wp-classes.less b/assets/less/components/_wp-classes.less
index 68df216..5597e47 100644
--- a/assets/less/components/_wp-classes.less
+++ b/assets/less/components/_wp-classes.less
@@ -12,6 +12,7 @@
figure.alignnone {
margin-left: 0;
margin-right: 0;
+ max-width: 100%;
}
@media (min-width: @screen-sm-min) {
diff --git a/assets/less/main.less b/assets/less/main.less
index 80c2e26..e300484 100644
--- a/assets/less/main.less
+++ b/assets/less/main.less
@@ -5,7 +5,7 @@
@import "_global"; // Base styling & custom mixins
@import "components/_buttons"; // Button tweaks
@import "components/_forms"; // Form tweaks
-@import "components/_gallery"; // WordPress galleries
+@import "components/_media"; // WordPress media
@import "components/_wp-classes"; // WordPress generated classes
@import "layouts/_general"; // General styling
@import "layouts/_header"; // Header styling
diff --git a/functions.php b/functions.php
index 179e3a2..b61a714 100644
--- a/functions.php
+++ b/functions.php
@@ -9,11 +9,8 @@ require_once locate_template('/lib/sidebar.php'); // Sidebar class
require_once locate_template('/lib/config.php'); // Configuration
require_once locate_template('/lib/activation.php'); // Theme activation
require_once locate_template('/lib/titles.php'); // Page titles
-require_once locate_template('/lib/cleanup.php'); // Cleanup
require_once locate_template('/lib/nav.php'); // Custom nav modifications
require_once locate_template('/lib/gallery.php'); // Custom [gallery] modifications
require_once locate_template('/lib/comments.php'); // Custom comments modifications
-require_once locate_template('/lib/relative-urls.php'); // Root relative URLs
-require_once locate_template('/lib/widgets.php'); // Sidebars and widgets
require_once locate_template('/lib/scripts.php'); // Scripts and stylesheets
require_once locate_template('/lib/custom.php'); // Custom functions
diff --git a/lib/cleanup.php b/lib/cleanup.php
deleted file mode 100644
index 5814131..0000000
--- a/lib/cleanup.php
+++ /dev/null
@@ -1,261 +0,0 @@
-'s
- * Remove inline CSS used by Recent Comments widget
- * Remove inline CSS used by posts with galleries
- * Remove self-closing tag and change ''s to "'s on rel_canonical()
- */
-function roots_head_cleanup() {
- // Originally from http://wpengineer.com/1438/wordpress-header/
- remove_action('wp_head', 'feed_links', 2);
- remove_action('wp_head', 'feed_links_extra', 3);
- remove_action('wp_head', 'rsd_link');
- remove_action('wp_head', 'wlwmanifest_link');
- remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
- remove_action('wp_head', 'wp_generator');
- remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
-
- global $wp_widget_factory;
- remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
-
- if (!class_exists('WPSEO_Frontend')) {
- remove_action('wp_head', 'rel_canonical');
- add_action('wp_head', 'roots_rel_canonical');
- }
-}
-
-function roots_rel_canonical() {
- global $wp_the_query;
-
- if (!is_singular()) {
- return;
- }
-
- if (!$id = $wp_the_query->get_queried_object_id()) {
- return;
- }
-
- $link = get_permalink($id);
- echo "\t\n";
-}
-add_action('init', 'roots_head_cleanup');
-
-/**
- * Remove the WordPress version from RSS feeds
- */
-add_filter('the_generator', '__return_false');
-
-/**
- * Clean up language_attributes() used in tag
- *
- * Remove dir="ltr"
- */
-function roots_language_attributes() {
- $attributes = array();
- $output = '';
-
- if (is_rtl()) {
- $attributes[] = 'dir="rtl"';
- }
-
- $lang = get_bloginfo('language');
-
- if ($lang) {
- $attributes[] = "lang=\"$lang\"";
- }
-
- $output = implode(' ', $attributes);
- $output = apply_filters('roots_language_attributes', $output);
-
- return $output;
-}
-add_filter('language_attributes', 'roots_language_attributes');
-
-/**
- * Manage output of wp_title()
- */
-function roots_wp_title($title) {
- if (is_feed()) {
- return $title;
- }
-
- $title .= get_bloginfo('name');
-
- return $title;
-}
-add_filter('wp_title', 'roots_wp_title', 10);
-
-/**
- * Clean up output of stylesheet tags
- */
-function roots_clean_style_tag($input) {
- preg_match_all("!!", $input, $matches);
- // Only display media if it is meaningful
- $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : '';
- return '' . "\n";
-}
-add_filter('style_loader_tag', 'roots_clean_style_tag');
-
-/**
- * Add and remove body_class() classes
- */
-function roots_body_class($classes) {
- // Add post/page slug
- if (is_single() || is_page() && !is_front_page()) {
- $classes[] = basename(get_permalink());
- }
-
- // Remove unnecessary classes
- $home_id_class = 'page-id-' . get_option('page_on_front');
- $remove_classes = array(
- 'page-template-default',
- $home_id_class
- );
- $classes = array_diff($classes, $remove_classes);
-
- return $classes;
-}
-add_filter('body_class', 'roots_body_class');
-
-/**
- * Wrap embedded media as suggested by Readability
- *
- * @link https://gist.github.com/965956
- * @link http://www.readability.com/publishers/guidelines#publisher
- */
-function roots_embed_wrap($cache, $url, $attr = '', $post_ID = '') {
- return '
' . $cache . '
';
-}
-add_filter('embed_oembed_html', 'roots_embed_wrap', 10, 4);
-
-/**
- * Add Bootstrap thumbnail styling to images with captions
- * Use and
- *
- * @link http://justintadlock.com/archives/2011/07/01/captions-in-wordpress
- */
-function roots_caption($output, $attr, $content) {
- if (is_feed()) {
- return $output;
- }
-
- $defaults = array(
- 'id' => '',
- 'align' => 'alignnone',
- 'width' => '',
- 'caption' => ''
- );
-
- $attr = shortcode_atts($defaults, $attr);
-
- // If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags
- if ($attr['width'] < 1 || empty($attr['caption'])) {
- return $content;
- }
-
- // Set up the attributes for the caption
- $attributes = (!empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '' );
- $attributes .= ' class="thumbnail wp-caption ' . esc_attr($attr['align']) . '"';
- $attributes .= ' style="width: ' . (esc_attr($attr['width']) + 10) . 'px"';
-
- $output = '';
- $output .= do_shortcode($content);
- $output .= '' . $attr['caption'] . '';
- $output .= '';
-
- return $output;
-}
-add_filter('img_caption_shortcode', 'roots_caption', 10, 3);
-
-/**
- * Remove unnecessary dashboard widgets
- *
- * @link http://www.deluxeblogtips.com/2011/01/remove-dashboard-widgets-in-wordpress.html
- */
-function roots_remove_dashboard_widgets() {
- remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
- remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
- remove_meta_box('dashboard_primary', 'dashboard', 'normal');
- remove_meta_box('dashboard_secondary', 'dashboard', 'normal');
-}
-add_action('admin_init', 'roots_remove_dashboard_widgets');
-
-/**
- * Clean up the_excerpt()
- */
-function roots_excerpt_length($length) {
- return POST_EXCERPT_LENGTH;
-}
-
-function roots_excerpt_more($more) {
- return ' … ' . __('Continued', 'roots') . '';
-}
-add_filter('excerpt_length', 'roots_excerpt_length');
-add_filter('excerpt_more', 'roots_excerpt_more');
-
-/**
- * Remove unnecessary self-closing tags
- */
-function roots_remove_self_closing_tags($input) {
- return str_replace(' />', '>', $input);
-}
-add_filter('get_avatar', 'roots_remove_self_closing_tags'); //
-add_filter('comment_id_fields', 'roots_remove_self_closing_tags'); //
-add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags'); //
-
-/**
- * Don't return the default description in the RSS feed if it hasn't been changed
- */
-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');
-
-/**
- * Redirects search results from /?s=query to /search/query/, converts %20 to +
- *
- * @link http://txfx.net/wordpress-plugins/nice-search/
- */
-function roots_nice_search_redirect() {
- global $wp_rewrite;
- if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) {
- return;
- }
-
- $search_base = $wp_rewrite->search_base;
- if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) {
- wp_redirect(home_url("/{$search_base}/" . urlencode(get_query_var('s'))));
- exit();
- }
-}
-if (current_theme_supports('nice-search')) {
- add_action('template_redirect', 'roots_nice_search_redirect');
-}
-
-/**
- * Fix for empty search queries redirecting to home page
- *
- * @link http://wordpress.org/support/topic/blank-search-sends-you-to-the-homepage#post-1772565
- * @link http://core.trac.wordpress.org/ticket/11330
- */
-function roots_request_filter($query_vars) {
- if (isset($_GET['s']) && empty($_GET['s'])) {
- $query_vars['s'] = ' ';
- }
-
- return $query_vars;
-}
-add_filter('request', 'roots_request_filter');
-
-/**
- * Tell WordPress to use searchform.php from the templates/ directory
- */
-function roots_get_search_form($form) {
- $form = '';
- locate_template('/templates/searchform.php', true, false);
- return $form;
-}
-add_filter('get_search_form', 'roots_get_search_form');
diff --git a/lib/config.php b/lib/config.php
index 0e76eb3..930eb7b 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -2,17 +2,17 @@
/**
* Enable theme features
*/
-add_theme_support('root-relative-urls'); // Enable relative URLs
+add_theme_support('soil-clean-up'); // Enable clean up from Soil
+add_theme_support('soil-relative-urls'); // Enable relative URLs from Soil
+add_theme_support('soil-nice-search'); // Enable /?s= to /search/ redirect from Soil
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
add_theme_support('jquery-cdn'); // Enable to load jQuery from the Google CDN
/**
* Configuration values
*/
define('GOOGLE_ANALYTICS_ID', ''); // UA-XXXXX-Y (Note: Universal Analytics only, not Classic Analytics)
-define('POST_EXCERPT_LENGTH', 40); // Length in words for excerpt_length filter (http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length)
/**
* .main classes
diff --git a/lib/init.php b/lib/init.php
index 26d642f..bb5f581 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -23,3 +23,27 @@ function roots_setup() {
add_editor_style('/assets/css/editor-style.css');
}
add_action('after_setup_theme', 'roots_setup');
+
+/**
+ * Register sidebars
+ */
+function roots_widgets_init() {
+ register_sidebar(array(
+ 'name' => __('Primary', 'roots'),
+ 'id' => 'sidebar-primary',
+ 'before_widget' => '',
+ 'before_title' => '',
+ 'after_title' => '
',
+ ));
+
+ register_sidebar(array(
+ 'name' => __('Footer', 'roots'),
+ 'id' => 'sidebar-footer',
+ 'before_widget' => '',
+ 'before_title' => '',
+ 'after_title' => '
',
+ ));
+}
+add_action('widgets_init', 'roots_widgets_init');
diff --git a/lib/relative-urls.php b/lib/relative-urls.php
deleted file mode 100644
index d8ba272..0000000
--- a/lib/relative-urls.php
+++ /dev/null
@@ -1,50 +0,0 @@
-
- */
-function roots_root_relative_url($input) {
- preg_match('|https?://([^/]+)(/.*)|i', $input, $matches);
-
- if (!isset($matches[1]) || !isset($matches[2])) {
- return $input;
- } elseif (($matches[1] === $_SERVER['SERVER_NAME']) || $matches[1] === $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']) {
- return wp_make_link_relative($input);
- } else {
- return $input;
- }
-}
-
-function roots_enable_root_relative_urls() {
- return !(is_admin() || in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) && current_theme_supports('root-relative-urls');
-}
-
-if (roots_enable_root_relative_urls()) {
- $root_rel_filters = array(
- 'bloginfo_url',
- 'the_permalink',
- 'wp_list_pages',
- 'wp_list_categories',
- 'roots_wp_nav_menu_item',
- 'the_content_more_link',
- 'the_tags',
- 'get_pagenum_link',
- 'get_comment_link',
- 'month_link',
- 'day_link',
- 'year_link',
- 'tag_link',
- 'the_author_posts_link',
- 'script_loader_src',
- 'style_loader_src'
- );
-
- add_filters($root_rel_filters, 'roots_root_relative_url');
-}
diff --git a/lib/utils.php b/lib/utils.php
index 0b25bf7..bec9f28 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -2,13 +2,15 @@
/**
* Utility functions
*/
-function add_filters($tags, $function) {
- foreach($tags as $tag) {
- add_filter($tag, $function);
- }
-}
-
function is_element_empty($element) {
$element = trim($element);
return empty($element) ? false : true;
}
+
+// Tell WordPress to use searchform.php from the templates/ directory
+function roots_get_search_form($form) {
+ $form = '';
+ locate_template('/templates/searchform.php', true, false);
+ return $form;
+}
+add_filter('get_search_form', 'roots_get_search_form');
diff --git a/lib/widgets.php b/lib/widgets.php
deleted file mode 100644
index 377b1ab..0000000
--- a/lib/widgets.php
+++ /dev/null
@@ -1,133 +0,0 @@
- __('Primary', 'roots'),
- 'id' => 'sidebar-primary',
- 'before_widget' => '',
- 'before_title' => '',
- 'after_title' => '
',
- ));
-
- register_sidebar(array(
- 'name' => __('Footer', 'roots'),
- 'id' => 'sidebar-footer',
- 'before_widget' => '',
- 'before_title' => '',
- 'after_title' => '
',
- ));
-
- // Widgets
- register_widget('Roots_Vcard_Widget');
-}
-add_action('widgets_init', 'roots_widgets_init');
-
-/**
- * Example vCard widget
- */
-class Roots_Vcard_Widget extends WP_Widget {
- private $fields = array(
- 'title' => 'Title (optional)',
- 'street_address' => 'Street Address',
- 'locality' => 'City/Locality',
- 'region' => 'State/Region',
- 'postal_code' => 'Zipcode/Postal Code',
- 'tel' => 'Telephone',
- 'email' => 'Email'
- );
-
- function __construct() {
- $widget_ops = array('classname' => 'widget_roots_vcard', 'description' => __('Use this widget to add a vCard', 'roots'));
-
- $this->WP_Widget('widget_roots_vcard', __('Roots: vCard', 'roots'), $widget_ops);
- $this->alt_option_name = 'widget_roots_vcard';
-
- add_action('save_post', array(&$this, 'flush_widget_cache'));
- add_action('deleted_post', array(&$this, 'flush_widget_cache'));
- add_action('switch_theme', array(&$this, 'flush_widget_cache'));
- }
-
- function widget($args, $instance) {
- $cache = wp_cache_get('widget_roots_vcard', 'widget');
-
- if (!is_array($cache)) {
- $cache = array();
- }
-
- if (!isset($args['widget_id'])) {
- $args['widget_id'] = null;
- }
-
- if (isset($cache[$args['widget_id']])) {
- echo $cache[$args['widget_id']];
- return;
- }
-
- ob_start();
- extract($args, EXTR_SKIP);
-
- $title = apply_filters('widget_title', empty($instance['title']) ? __('vCard', 'roots') : $instance['title'], $instance, $this->id_base);
-
- foreach($this->fields as $name => $label) {
- if (!isset($instance[$name])) { $instance[$name] = ''; }
- }
-
- echo $before_widget;
-
- if ($title) {
- echo $before_title, $title, $after_title;
- }
- ?>
-
-
-
-
- ,
-
-
-
-
-
-
- flush_widget_cache();
-
- $alloptions = wp_cache_get('alloptions', 'options');
-
- if (isset($alloptions['widget_roots_vcard'])) {
- delete_option('widget_roots_vcard');
- }
-
- return $instance;
- }
-
- function flush_widget_cache() {
- wp_cache_delete('widget_roots_vcard', 'widget');
- }
-
- function form($instance) {
- foreach($this->fields as $name => $label) {
- ${$name} = isset($instance[$name]) ? esc_attr($instance[$name]) : '';
- ?>
-
-
-
-
-