Merge master

This commit is contained in:
Ben Word
2015-01-09 19:09:46 -06:00
19 changed files with 89 additions and 75 deletions

View File

@@ -15,7 +15,7 @@ function roots_theme_activation_options_init() {
}
add_action('admin_init', 'roots_theme_activation_options_init');
function roots_activation_options_page_capability($capability) {
function roots_activation_options_page_capability() {
return 'edit_theme_options';
}
add_filter('option_page_capability_roots_activation_options', 'roots_activation_options_page_capability');
@@ -24,7 +24,7 @@ function roots_theme_activation_options_add_page() {
$roots_activation_options = roots_get_theme_activation_options();
if (!$roots_activation_options) {
$theme_page = add_theme_page(
add_theme_page(
__('Theme Activation', 'roots'),
__('Theme Activation', 'roots'),
'edit_theme_options',
@@ -141,7 +141,7 @@ function roots_theme_activation_action() {
'post_type' => 'page'
);
$result = wp_insert_post($add_default_pages);
wp_insert_post($add_default_pages);
}
$home = get_page_by_title(__('Home', 'roots'));

View File

@@ -34,31 +34,36 @@ add_filter('body_class', 'roots_sidebar_body_class');
* See lib/sidebar.php for more details
*/
function roots_display_sidebar() {
$sidebar_config = new Roots_Sidebar(
/**
* Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
* Any of these conditional tags that return true won't show the sidebar
*
* To use a function that accepts arguments, use the following format:
*
* array('function_name', array('arg1', 'arg2'))
*
* The second element must be an array even if there's only 1 argument.
*/
array(
'is_404',
'is_front_page'
),
/**
* Page template checks (via is_page_template())
* Any of these page templates that return true won't show the sidebar
*/
array(
'template-custom.php'
)
);
static $display;
return apply_filters('roots/display_sidebar', $sidebar_config->display);
if (!isset($display)) {
$sidebar_config = new Roots_Sidebar(
/**
* Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
* Any of these conditional tags that return true won't show the sidebar
*
* To use a function that accepts arguments, use the following format:
*
* array('function_name', array('arg1', 'arg2'))
*
* The second element must be an array even if there's only 1 argument.
*/
array(
'is_404',
'is_front_page'
),
/**
* Page template checks (via is_page_template())
* Any of these page templates that return true won't show the sidebar
*/
array(
'template-custom.php'
)
);
$display = apply_filters('roots/display_sidebar', $sidebar_config->display);
}
return $display;
}
/**

View File

@@ -2,21 +2,7 @@
/**
* Clean up the_excerpt()
*/
function roots_excerpt_more($more) {
function roots_excerpt_more() {
return ' &hellip; <a href="' . get_permalink() . '">' . __('Continued', 'roots') . '</a>';
}
add_filter('excerpt_more', 'roots_excerpt_more');
/**
* 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);

View File

@@ -123,7 +123,6 @@ if (current_theme_supports('bootstrap-gallery')) {
* Add class="thumbnail img-thumbnail" to attachment items
*/
function roots_attachment_link_class($html) {
$postid = get_the_ID();
$html = str_replace('<a', '<a class="thumbnail img-thumbnail"', $html);
return $html;
}

View File

@@ -7,6 +7,10 @@ function roots_setup() {
// Community translations can be found at https://github.com/roots/roots-translations
load_theme_textdomain('roots', get_template_directory() . '/lang');
// Enable plugins to manage the document title
// http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag
add_theme_support('title-tag');
// Register wp_nav_menu() menus
// http://codex.wordpress.org/Function_Reference/register_nav_menus
register_nav_menus(array(

View File

@@ -74,6 +74,8 @@ add_filter('nav_menu_item_id', '__return_null');
* Use Roots_Nav_Walker() by default
*/
function roots_nav_menu_args($args = '') {
$roots_nav_menu_args = array();
$roots_nav_menu_args['container'] = false;
if (!$args['items_wrap']) {
@@ -84,10 +86,6 @@ function roots_nav_menu_args($args = '') {
$roots_nav_menu_args['depth'] = 2;
}
if (!$args['walker']) {
$roots_nav_menu_args['walker'] = new Roots_Nav_Walker();
}
return array_merge($args, $roots_nav_menu_args);
}
add_filter('wp_nav_menu_args', 'roots_nav_menu_args');

View File

@@ -10,23 +10,7 @@ function roots_title() {
return __('Latest Posts', 'roots');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
return apply_filters('single_term_title', $term->name);
} elseif (is_post_type_archive()) {
return apply_filters('the_title', get_queried_object()->labels->name);
} elseif (is_day()) {
return sprintf(__('Daily Archives: %s', 'roots'), get_the_date());
} elseif (is_month()) {
return sprintf(__('Monthly Archives: %s', 'roots'), get_the_date('F Y'));
} elseif (is_year()) {
return sprintf(__('Yearly Archives: %s', 'roots'), get_the_date('Y'));
} elseif (is_author()) {
$author = get_queried_object();
return sprintf(__('Author Archives: %s', 'roots'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
} else {
return single_cat_title('', false);
}
return get_the_archive_title();
} elseif (is_search()) {
return sprintf(__('Search Results for %s', 'roots'), get_search_query());
} elseif (is_404()) {

View File

@@ -8,7 +8,7 @@ function is_element_empty($element) {
}
// Tell WordPress to use searchform.php from the templates/ directory
function roots_get_search_form($form) {
function roots_get_search_form() {
$form = '';
locate_template('/templates/searchform.php', true, false);
return $form;

View File

@@ -15,7 +15,13 @@ function roots_sidebar_path() {
class Roots_Wrapping {
// Stores the full path to the main template file
static $main_template;
public static $main_template;
// basename of template file
public $slug;
// array of templates
public $templates;
// Stores the base name of the template file; e.g. 'page' for 'page.php' etc.
static $base;
@@ -36,6 +42,11 @@ class Roots_Wrapping {
}
static function wrap($main) {
// Check for other filters returning null
if (!is_string($main)) {
return $main;
}
self::$main_template = $main;
self::$base = basename(self::$main_template, '.php');