Merge branch 'master' into grunt
This commit is contained in:
@@ -5,7 +5,7 @@ table of contents](TOC.md)
|
|||||||
|
|
||||||
The HTML, CSS and JavaScript in Roots comes from a combination of HTML5 Boilerplate and Twitter Bootstrap.
|
The HTML, CSS and JavaScript in Roots comes from a combination of HTML5 Boilerplate and Twitter Bootstrap.
|
||||||
|
|
||||||
* [HTML5 Boilerplate documentation](https://github.com/h5bp/html5-boilerplate/blob/master/doc/README.md)
|
* [HTML5 Boilerplate documentation](https://github.com/h5bp/html5-boilerplate/blob/master/README.md)
|
||||||
* [Twitter Bootstrap documentation](http://twitter.github.com/bootstrap/getting-started.html)
|
* [Twitter Bootstrap documentation](http://twitter.github.com/bootstrap/getting-started.html)
|
||||||
|
|
||||||
## Basic structure
|
## Basic structure
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Required by WordPress.
|
* Roots includes
|
||||||
*
|
|
||||||
* Keep this file clean and only use it for requires.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once locate_template('/lib/utils.php'); // Utility functions
|
require_once locate_template('/lib/utils.php'); // Utility functions
|
||||||
require_once locate_template('/lib/init.php'); // Initial theme setup and constants
|
require_once locate_template('/lib/init.php'); // Initial theme setup and constants
|
||||||
require_once locate_template('/lib/sidebar.php'); // Sidebar class
|
require_once locate_template('/lib/sidebar.php'); // Sidebar class
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Theme activation
|
||||||
|
*/
|
||||||
if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
|
if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
|
||||||
wp_redirect(admin_url('themes.php?page=theme_activation_options'));
|
wp_redirect(admin_url('themes.php?page=theme_activation_options'));
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up wp_head()
|
* Clean up wp_head()
|
||||||
*
|
*
|
||||||
@@ -43,7 +42,6 @@ function roots_rel_canonical() {
|
|||||||
$link = get_permalink($id);
|
$link = get_permalink($id);
|
||||||
echo "\t<link rel=\"canonical\" href=\"$link\">\n";
|
echo "\t<link rel=\"canonical\" href=\"$link\">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('init', 'roots_head_cleanup');
|
add_action('init', 'roots_head_cleanup');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +78,6 @@ function roots_language_attributes() {
|
|||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('language_attributes', 'roots_language_attributes');
|
add_filter('language_attributes', 'roots_language_attributes');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,7 +89,6 @@ function roots_clean_style_tag($input) {
|
|||||||
$media = $matches[3][0] === 'print' ? ' media="print"' : '';
|
$media = $matches[3][0] === 'print' ? ' media="print"' : '';
|
||||||
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
|
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('style_loader_tag', 'roots_clean_style_tag');
|
add_filter('style_loader_tag', 'roots_clean_style_tag');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +110,6 @@ function roots_body_class($classes) {
|
|||||||
|
|
||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('body_class', 'roots_body_class');
|
add_filter('body_class', 'roots_body_class');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,6 +124,11 @@ add_filter('body_class', 'roots_body_class');
|
|||||||
* @author Scott Walkinshaw <scott.walkinshaw@gmail.com>
|
* @author Scott Walkinshaw <scott.walkinshaw@gmail.com>
|
||||||
*/
|
*/
|
||||||
function roots_root_relative_url($input) {
|
function roots_root_relative_url($input) {
|
||||||
|
// fix for site_url != home_url()
|
||||||
|
if(!is_admin() && site_url() != home_url()) {
|
||||||
|
$input = str_replace(site_url(), "", $input);
|
||||||
|
}
|
||||||
|
|
||||||
$output = preg_replace_callback(
|
$output = preg_replace_callback(
|
||||||
'!(https?://[^/|"]+)([^"]+)?!',
|
'!(https?://[^/|"]+)([^"]+)?!',
|
||||||
create_function(
|
create_function(
|
||||||
@@ -142,22 +142,12 @@ function roots_root_relative_url($input) {
|
|||||||
),
|
),
|
||||||
$input
|
$input
|
||||||
);
|
);
|
||||||
|
|
||||||
return $output;
|
// detect and correct for subdir installs
|
||||||
}
|
if($subdir = parse_url(home_url(), PHP_URL_PATH)) {
|
||||||
|
if(substr($output, 0, strlen($subdir)) == (substr($output, strlen($subdir), strlen($subdir)))) {
|
||||||
/**
|
$output = substr($output, strlen($subdir));
|
||||||
* Terrible workaround to remove the duplicate subfolder in the src of <script> and <link> tags
|
}
|
||||||
* Example: /subfolder/subfolder/css/style.css
|
|
||||||
*/
|
|
||||||
function roots_fix_duplicate_subfolder_urls($input) {
|
|
||||||
$output = roots_root_relative_url($input);
|
|
||||||
preg_match_all('!([^/]+)/([^/]+)!', $output, $matches);
|
|
||||||
|
|
||||||
if (isset($matches[1][0]) && isset($matches[2][0])) {
|
|
||||||
if ($matches[1][0] === $matches[2][0]) {
|
|
||||||
$output = substr($output, strlen($matches[1][0]) + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
@@ -186,13 +176,12 @@ if (roots_enable_root_relative_urls()) {
|
|||||||
'day_link',
|
'day_link',
|
||||||
'year_link',
|
'year_link',
|
||||||
'tag_link',
|
'tag_link',
|
||||||
'the_author_posts_link'
|
'the_author_posts_link',
|
||||||
|
'script_loader_src',
|
||||||
|
'style_loader_src'
|
||||||
);
|
);
|
||||||
|
|
||||||
add_filters($root_rel_filters, 'roots_root_relative_url');
|
add_filters($root_rel_filters, 'roots_root_relative_url');
|
||||||
|
|
||||||
add_filter('script_loader_src', 'roots_fix_duplicate_subfolder_urls');
|
|
||||||
add_filter('style_loader_src', 'roots_fix_duplicate_subfolder_urls');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,7 +193,6 @@ if (roots_enable_root_relative_urls()) {
|
|||||||
function roots_embed_wrap($cache, $url, $attr = '', $post_ID = '') {
|
function roots_embed_wrap($cache, $url, $attr = '', $post_ID = '') {
|
||||||
return '<div class="entry-content-asset">' . $cache . '</div>';
|
return '<div class="entry-content-asset">' . $cache . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('embed_oembed_html', 'roots_embed_wrap', 10, 4);
|
add_filter('embed_oembed_html', 'roots_embed_wrap', 10, 4);
|
||||||
add_filter('embed_googlevideo', 'roots_embed_wrap', 10, 2);
|
add_filter('embed_googlevideo', 'roots_embed_wrap', 10, 2);
|
||||||
|
|
||||||
@@ -216,7 +204,6 @@ function roots_attachment_link_class($html) {
|
|||||||
$html = str_replace('<a', '<a class="thumbnail"', $html);
|
$html = str_replace('<a', '<a class="thumbnail"', $html);
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('wp_get_attachment_link', 'roots_attachment_link_class', 10, 1);
|
add_filter('wp_get_attachment_link', 'roots_attachment_link_class', 10, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,7 +243,6 @@ function roots_caption($output, $attr, $content) {
|
|||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('img_caption_shortcode', 'roots_caption', 10, 3);
|
add_filter('img_caption_shortcode', 'roots_caption', 10, 3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -353,7 +339,6 @@ function roots_gallery($attr) {
|
|||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_theme_supports('bootstrap-gallery')) {
|
if (current_theme_supports('bootstrap-gallery')) {
|
||||||
remove_shortcode('gallery');
|
remove_shortcode('gallery');
|
||||||
add_shortcode('gallery', 'roots_gallery');
|
add_shortcode('gallery', 'roots_gallery');
|
||||||
@@ -370,7 +355,6 @@ function roots_remove_dashboard_widgets() {
|
|||||||
remove_meta_box('dashboard_primary', 'dashboard', 'normal');
|
remove_meta_box('dashboard_primary', 'dashboard', 'normal');
|
||||||
remove_meta_box('dashboard_secondary', 'dashboard', 'normal');
|
remove_meta_box('dashboard_secondary', 'dashboard', 'normal');
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('admin_init', 'roots_remove_dashboard_widgets');
|
add_action('admin_init', 'roots_remove_dashboard_widgets');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -383,7 +367,6 @@ function roots_excerpt_length($length) {
|
|||||||
function roots_excerpt_more($more) {
|
function roots_excerpt_more($more) {
|
||||||
return ' … <a href="' . get_permalink() . '">' . __('Continued', 'roots') . '</a>';
|
return ' … <a href="' . get_permalink() . '">' . __('Continued', 'roots') . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('excerpt_length', 'roots_excerpt_length');
|
add_filter('excerpt_length', 'roots_excerpt_length');
|
||||||
add_filter('excerpt_more', 'roots_excerpt_more');
|
add_filter('excerpt_more', 'roots_excerpt_more');
|
||||||
|
|
||||||
@@ -393,7 +376,6 @@ add_filter('excerpt_more', 'roots_excerpt_more');
|
|||||||
function roots_remove_self_closing_tags($input) {
|
function roots_remove_self_closing_tags($input) {
|
||||||
return str_replace(' />', '>', $input);
|
return str_replace(' />', '>', $input);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('get_avatar', 'roots_remove_self_closing_tags'); // <img />
|
add_filter('get_avatar', 'roots_remove_self_closing_tags'); // <img />
|
||||||
add_filter('comment_id_fields', 'roots_remove_self_closing_tags'); // <input />
|
add_filter('comment_id_fields', 'roots_remove_self_closing_tags'); // <input />
|
||||||
add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags'); // <img />
|
add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags'); // <img />
|
||||||
@@ -403,10 +385,8 @@ add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags'); // <img />
|
|||||||
*/
|
*/
|
||||||
function roots_remove_default_description($bloginfo) {
|
function roots_remove_default_description($bloginfo) {
|
||||||
$default_tagline = 'Just another WordPress site';
|
$default_tagline = 'Just another WordPress site';
|
||||||
|
|
||||||
return ($bloginfo === $default_tagline) ? '' : $bloginfo;
|
return ($bloginfo === $default_tagline) ? '' : $bloginfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('get_bloginfo_rss', 'roots_remove_default_description');
|
add_filter('get_bloginfo_rss', 'roots_remove_default_description');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -423,7 +403,6 @@ function roots_change_mce_options($options) {
|
|||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('tiny_mce_before_init', 'roots_change_mce_options');
|
add_filter('tiny_mce_before_init', 'roots_change_mce_options');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -463,7 +442,6 @@ function roots_widget_first_last_classes($params) {
|
|||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('dynamic_sidebar_params', 'roots_widget_first_last_classes');
|
add_filter('dynamic_sidebar_params', 'roots_widget_first_last_classes');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -483,7 +461,6 @@ function roots_nice_search_redirect() {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_theme_supports('nice-search')) {
|
if (current_theme_supports('nice-search')) {
|
||||||
add_action('template_redirect', 'roots_nice_search_redirect');
|
add_action('template_redirect', 'roots_nice_search_redirect');
|
||||||
}
|
}
|
||||||
@@ -501,7 +478,6 @@ function roots_request_filter($query_vars) {
|
|||||||
|
|
||||||
return $query_vars;
|
return $query_vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('request', 'roots_request_filter');
|
add_filter('request', 'roots_request_filter');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -512,5 +488,4 @@ function roots_get_search_form($argument) {
|
|||||||
locate_template('/templates/searchform.php', true, false);
|
locate_template('/templates/searchform.php', true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('get_search_form', 'roots_get_search_form');
|
add_filter('get_search_form', 'roots_get_search_form');
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
<?php
|
<?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
|
* Use Bootstrap's media object for listing comments
|
||||||
*
|
*
|
||||||
@@ -61,3 +54,9 @@ class Roots_Walker_Comment extends Walker_Comment {
|
|||||||
echo "</li>\n";
|
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');
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable theme features
|
* Enable theme features
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
// Custom functions
|
* Custom functions
|
||||||
|
*/
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
/**
|
/**
|
||||||
* Add HTML5 Boilerplate's .htaccess via WordPress
|
* Add HTML5 Boilerplate's .htaccess via WordPress
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Add the contents of h5bp-htaccess into .htaccess
|
|
||||||
function roots_add_h5bp_htaccess($content) {
|
function roots_add_h5bp_htaccess($content) {
|
||||||
global $wp_rewrite;
|
global $wp_rewrite;
|
||||||
$home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
|
$home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* Roots initial setup and constants
|
* Roots initial setup and constants
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function roots_setup() {
|
function roots_setup() {
|
||||||
|
|
||||||
// Make theme available for translation
|
// Make theme available for translation
|
||||||
load_theme_textdomain('roots', get_template_directory() . '/lang');
|
load_theme_textdomain('roots', get_template_directory() . '/lang');
|
||||||
|
|
||||||
@@ -23,9 +21,7 @@ function roots_setup() {
|
|||||||
|
|
||||||
// Tell the TinyMCE editor to use a custom stylesheet
|
// Tell the TinyMCE editor to use a custom stylesheet
|
||||||
add_editor_style('/assets/css/editor-style.css');
|
add_editor_style('/assets/css/editor-style.css');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('after_setup_theme', 'roots_setup');
|
add_action('after_setup_theme', 'roots_setup');
|
||||||
|
|
||||||
// Backwards compatibility for older than PHP 5.3.0
|
// Backwards compatibility for older than PHP 5.3.0
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleaner walker for wp_nav_menu()
|
* 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);
|
$item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html);
|
||||||
}
|
}
|
||||||
elseif (stristr($item_html, 'li class="divider')) {
|
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')) {
|
elseif (stristr($item_html, 'li class="nav-header')) {
|
||||||
$item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html);
|
$item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= $item_html;
|
$output .= $item_html;
|
||||||
}
|
}
|
||||||
@@ -68,7 +67,6 @@ function roots_nav_menu_css_class($classes, $item) {
|
|||||||
|
|
||||||
return array_filter($classes, 'is_element_empty');
|
return array_filter($classes, 'is_element_empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('nav_menu_css_class', 'roots_nav_menu_css_class', 10, 2);
|
add_filter('nav_menu_css_class', 'roots_nav_menu_css_class', 10, 2);
|
||||||
add_filter('nav_menu_item_id', '__return_null');
|
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);
|
return array_merge($args, $roots_nav_menu_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
|
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*
|
*
|
||||||
* @link https://github.com/retlehs/roots/blob/master/doc/rewrites.md
|
* @link https://github.com/retlehs/roots/blob/master/doc/rewrites.md
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function roots_add_rewrites($content) {
|
function roots_add_rewrites($content) {
|
||||||
global $wp_rewrite;
|
global $wp_rewrite;
|
||||||
$roots_new_non_wp_rules = array(
|
$roots_new_non_wp_rules = array(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Scripts and stylesheets
|
* Enqueue scripts and stylesheets
|
||||||
*
|
*
|
||||||
* Enqueue stylesheets in the following order:
|
* Enqueue stylesheets in the following order:
|
||||||
* 1. /theme/assets/css/main.min.css
|
* 1. /theme/assets/css/main.min.css
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
* 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js
|
* 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js
|
||||||
* 3. /theme/assets/js/scripts.min.js
|
* 3. /theme/assets/js/scripts.min.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function roots_scripts() {
|
function roots_scripts() {
|
||||||
wp_enqueue_style('roots_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '99a8db779c85fab09c1780951893470f');
|
wp_enqueue_style('roots_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '99a8db779c85fab09c1780951893470f');
|
||||||
|
|
||||||
@@ -37,7 +36,6 @@ function roots_scripts() {
|
|||||||
wp_enqueue_script('jquery');
|
wp_enqueue_script('jquery');
|
||||||
wp_enqueue_script('roots_scripts');
|
wp_enqueue_script('roots_scripts');
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('wp_enqueue_scripts', 'roots_scripts', 100);
|
add_action('wp_enqueue_scripts', 'roots_scripts', 100);
|
||||||
|
|
||||||
// http://wordpress.stackexchange.com/a/12450
|
// http://wordpress.stackexchange.com/a/12450
|
||||||
@@ -55,7 +53,6 @@ function roots_jquery_local_fallback($src, $handle) {
|
|||||||
|
|
||||||
return $src;
|
return $src;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_admin()) {
|
if (!is_admin()) {
|
||||||
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
||||||
}
|
}
|
||||||
@@ -68,7 +65,6 @@ function roots_google_analytics() { ?>
|
|||||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||||
</script>
|
</script>
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
if (GOOGLE_ANALYTICS_ID) {
|
if (GOOGLE_ANALYTICS_ID) {
|
||||||
add_action('wp_footer', 'roots_google_analytics', 20);
|
add_action('wp_footer', 'roots_google_analytics', 20);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,3 @@ class Roots_Sidebar {
|
|||||||
return is_page_template($page_template);
|
return is_page_template($page_template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme Wrapper
|
* Theme wrapper
|
||||||
*
|
*
|
||||||
* @link http://scribu.net/wordpress/theme-wrappers.html
|
* @link http://scribu.net/wordpress/theme-wrappers.html
|
||||||
*/
|
*/
|
||||||
@@ -48,10 +47,8 @@ class Roots_Wrapping {
|
|||||||
return locate_template($templates);
|
return locate_template($templates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('template_include', array('Roots_Wrapping', 'wrap'), 99);
|
add_filter('template_include', array('Roots_Wrapping', 'wrap'), 99);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page titles
|
* Page titles
|
||||||
*/
|
*/
|
||||||
@@ -98,10 +95,11 @@ function roots_htaccess_writable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('admin_init', 'roots_htaccess_writable');
|
add_action('admin_init', 'roots_htaccess_writable');
|
||||||
|
|
||||||
// returns WordPress subdirectory if applicable
|
/**
|
||||||
|
* Return WordPress subdirectory if applicable
|
||||||
|
*/
|
||||||
function wp_base_dir() {
|
function wp_base_dir() {
|
||||||
preg_match('!(https?://[^/|"]+)([^"]+)?!', site_url(), $matches);
|
preg_match('!(https?://[^/|"]+)([^"]+)?!', site_url(), $matches);
|
||||||
if (count($matches) === 3) {
|
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) {
|
function leadingslashit($string) {
|
||||||
return '/' . unleadingslashit($string);
|
return '/' . unleadingslashit($string);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Register sidebars and widgets
|
||||||
|
*/
|
||||||
function roots_widgets_init() {
|
function roots_widgets_init() {
|
||||||
// Register widgetized areas
|
// Sidebars
|
||||||
register_sidebar(array(
|
register_sidebar(array(
|
||||||
'name' => __('Primary Sidebar', 'roots'),
|
'name' => __('Primary Sidebar', 'roots'),
|
||||||
'id' => 'sidebar-primary',
|
'id' => 'sidebar-primary',
|
||||||
@@ -20,12 +22,14 @@ function roots_widgets_init() {
|
|||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
));
|
));
|
||||||
|
|
||||||
// Register widgets
|
// Widgets
|
||||||
register_widget('Roots_Vcard_Widget');
|
register_widget('Roots_Vcard_Widget');
|
||||||
}
|
}
|
||||||
add_action('widgets_init', 'roots_widgets_init');
|
add_action('widgets_init', 'roots_widgets_init');
|
||||||
|
|
||||||
// Example vCard widget
|
/**
|
||||||
|
* Example vCard widget
|
||||||
|
*/
|
||||||
class Roots_Vcard_Widget extends WP_Widget {
|
class Roots_Vcard_Widget extends WP_Widget {
|
||||||
private $fields = array(
|
private $fields = array(
|
||||||
'title' => 'Title (optional)',
|
'title' => 'Title (optional)',
|
||||||
|
|||||||
Reference in New Issue
Block a user