Merge master
This commit is contained in:
@@ -93,7 +93,7 @@ function roots_theme_activation_options_render_page() { ?>
|
||||
<option value="false"><?php echo _e('No', 'roots'); ?></option>
|
||||
</select>
|
||||
<br>
|
||||
<small class="description"><?php printf(__('Change uploads folder to /assets/ instead of /wp-content/uploads/', 'roots')); ?></small>
|
||||
<small class="description"><?php printf(__('Change uploads folder to /media/ instead of /wp-content/uploads/', 'roots')); ?></small>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -191,7 +191,7 @@ function roots_theme_activation_action() {
|
||||
|
||||
update_option('uploads_use_yearmonth_folders', 0);
|
||||
if (!is_multisite()) {
|
||||
update_option('upload_path', 'assets');
|
||||
update_option('upload_path', 'media');
|
||||
} else {
|
||||
update_option('upload_path', '');
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ add_filter('wp_title', 'roots_wp_title', 10);
|
||||
*/
|
||||
function roots_clean_style_tag($input) {
|
||||
preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!", $input, $matches);
|
||||
// Only display media if it's print
|
||||
$media = $matches[3][0] === 'print' ? ' media="print"' : '';
|
||||
// Only display media if it is meaningful
|
||||
$media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : '';
|
||||
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
|
||||
}
|
||||
add_filter('style_loader_tag', 'roots_clean_style_tag');
|
||||
@@ -184,7 +184,6 @@ 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);
|
||||
|
||||
/**
|
||||
* Add class="thumbnail" to attachment items
|
||||
@@ -379,61 +378,6 @@ function roots_remove_default_description($bloginfo) {
|
||||
}
|
||||
add_filter('get_bloginfo_rss', 'roots_remove_default_description');
|
||||
|
||||
/**
|
||||
* Allow more tags in TinyMCE including <iframe> and <script>
|
||||
*/
|
||||
function roots_change_mce_options($options) {
|
||||
$ext = 'pre[id|name|class|style],iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src],script[charset|defer|language|src|type]';
|
||||
|
||||
if (isset($initArray['extended_valid_elements'])) {
|
||||
$options['extended_valid_elements'] .= ',' . $ext;
|
||||
} else {
|
||||
$options['extended_valid_elements'] = $ext;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
add_filter('tiny_mce_before_init', 'roots_change_mce_options');
|
||||
|
||||
/**
|
||||
* Add additional classes onto widgets
|
||||
*
|
||||
* @link http://wordpress.org/support/topic/how-to-first-and-last-css-classes-for-sidebar-widgets
|
||||
*/
|
||||
function roots_widget_first_last_classes($params) {
|
||||
global $my_widget_num;
|
||||
|
||||
$this_id = $params[0]['id'];
|
||||
$arr_registered_widgets = wp_get_sidebars_widgets();
|
||||
|
||||
if (!$my_widget_num) {
|
||||
$my_widget_num = array();
|
||||
}
|
||||
|
||||
if (!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
if (isset($my_widget_num[$this_id])) {
|
||||
$my_widget_num[$this_id] ++;
|
||||
} else {
|
||||
$my_widget_num[$this_id] = 1;
|
||||
}
|
||||
|
||||
$class = 'class="widget-' . $my_widget_num[$this_id] . ' ';
|
||||
|
||||
if ($my_widget_num[$this_id] == 1) {
|
||||
$class .= 'widget-first ';
|
||||
} elseif ($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) {
|
||||
$class .= 'widget-last ';
|
||||
}
|
||||
|
||||
$params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1);
|
||||
|
||||
return $params;
|
||||
}
|
||||
add_filter('dynamic_sidebar_params', 'roots_widget_first_last_classes');
|
||||
|
||||
/**
|
||||
* Redirects search results from /?s=query to /search/query/, converts %20 to +
|
||||
*
|
||||
|
||||
@@ -67,7 +67,7 @@ function roots_display_sidebar() {
|
||||
)
|
||||
);
|
||||
|
||||
return $sidebar_config->display;
|
||||
return apply_filters('roots_display_sidebar', $sidebar_config->display);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
|
||||
// Define helper constants
|
||||
$get_theme_name = explode('/themes/', get_template_directory());
|
||||
|
||||
define('THEME_NAME', next($get_theme_name));
|
||||
define('RELATIVE_PLUGIN_PATH', str_replace(home_url() . '/', '', plugins_url()));
|
||||
define('RELATIVE_CONTENT_PATH', str_replace(home_url() . '/', '', content_url()));
|
||||
define('THEME_NAME', next($get_theme_name));
|
||||
define('THEME_PATH', RELATIVE_CONTENT_PATH . '/themes/' . THEME_NAME);
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* 2. /child-theme/style.css (if a child theme is activated)
|
||||
*
|
||||
* Enqueue scripts in the following order:
|
||||
* 1. jquery-1.9.1.min.js via Google CDN
|
||||
* 1. jquery-1.10.1.min.js via Google CDN
|
||||
* 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js
|
||||
* 3. /theme/assets/js/main.min.js (in footer)
|
||||
*/
|
||||
function roots_scripts() {
|
||||
wp_enqueue_style('roots_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '8a868df86cb5fe3b8e0e33b67e537f34');
|
||||
wp_enqueue_style('roots_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '642fb47e4d0c5276c3ad6084dae68f1a');
|
||||
|
||||
// Load style.css from child theme
|
||||
if (is_child_theme()) {
|
||||
@@ -24,7 +24,7 @@ function roots_scripts() {
|
||||
// It's kept in the header instead of footer to avoid conflicts with plugins.
|
||||
if (!is_admin() && current_theme_supports('jquery-cdn')) {
|
||||
wp_deregister_script('jquery');
|
||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', false, null, false);
|
||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js', false, null, false);
|
||||
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function roots_scripts() {
|
||||
}
|
||||
|
||||
wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.6.2.min.js', false, null, false);
|
||||
wp_register_script('roots_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '2889bb2f21e80b03b270797843bf4c2d', true);
|
||||
wp_register_script('roots_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '8b9f4205f4a36229fdc83067ea78e79e', true);
|
||||
wp_enqueue_script('modernizr');
|
||||
wp_enqueue_script('jquery');
|
||||
wp_enqueue_script('roots_scripts');
|
||||
@@ -45,7 +45,7 @@ function roots_jquery_local_fallback($src, $handle) {
|
||||
static $add_jquery_fallback = false;
|
||||
|
||||
if ($add_jquery_fallback) {
|
||||
echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . '/assets/js/vendor/jquery-1.9.1.min.js"><\/script>\')</script>' . "\n";
|
||||
echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . '/assets/js/vendor/jquery-1.10.1.min.js"><\/script>\')</script>' . "\n";
|
||||
$add_jquery_fallback = false;
|
||||
}
|
||||
|
||||
@@ -58,11 +58,14 @@ function roots_jquery_local_fallback($src, $handle) {
|
||||
|
||||
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'));
|
||||
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
|
||||
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
|
||||
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
|
||||
e.src='//www.google-analytics.com/analytics.js';
|
||||
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
|
||||
ga('create','<?php echo GOOGLE_ANALYTICS_ID; ?>');ga('send','pageview');
|
||||
</script>
|
||||
|
||||
<?php }
|
||||
if (GOOGLE_ANALYTICS_ID) {
|
||||
add_action('wp_footer', 'roots_google_analytics', 20);
|
||||
|
||||
@@ -34,6 +34,7 @@ class Roots_Wrapping {
|
||||
array_unshift($templates, sprintf('base-%s.php', self::$base));
|
||||
}
|
||||
|
||||
$templates = apply_filters('roots_wrap_base', $templates);
|
||||
return locate_template($templates);
|
||||
}
|
||||
|
||||
@@ -44,6 +45,7 @@ class Roots_Wrapping {
|
||||
array_unshift($templates, sprintf('templates/sidebar-%s.php', self::$base));
|
||||
}
|
||||
|
||||
$templates = apply_filters('roots_wrap_sidebar', $templates);
|
||||
return locate_template($templates);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +74,8 @@ function roots_title() {
|
||||
} elseif (is_year()) {
|
||||
printf(__('Yearly Archives: %s', 'roots'), get_the_date('Y'));
|
||||
} elseif (is_author()) {
|
||||
printf(__('Author Archives: %s', 'roots'), get_the_author());
|
||||
$author = get_queried_object();
|
||||
printf(__('Author Archives: %s', 'roots'), $author->display_name);
|
||||
} else {
|
||||
single_cat_title();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user