Re-organize theme configuration and setup

functions.php should not contain any Roots specific code. It's just used
to require files and bootstrap Roots. lib/init.php now handles initial
theme setup and defines helper constants which did not belong in
lib/config.php.

config.php should be limited to strictly configuration settings.
This commit is contained in:
Scott Walkinshaw
2012-09-21 16:20:03 -04:00
parent b2c340da05
commit ba56e0fa4d
6 changed files with 60 additions and 43 deletions

View File

@@ -1,12 +1,13 @@
<?php
/**
* Roots functions
* Required by WordPress.
*
* Keep this file clean and only use it for requires.
*/
if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
require_once locate_template('/lib/init.php'); // Initial theme setup and constants
require_once locate_template('/lib/utils.php'); // Utility functions
require_once locate_template('/lib/config.php'); // Configuration and constants
require_once locate_template('/lib/config.php'); // Configuration
require_once locate_template('/lib/activation.php'); // Theme activation
require_once locate_template('/lib/cleanup.php'); // Cleanup
require_once locate_template('/lib/htaccess.php'); // Rewrites for assets, H5BP .htaccess
@@ -15,28 +16,3 @@ require_once locate_template('/lib/scripts.php'); // Scripts and stylesh
require_once locate_template('/lib/post-types.php'); // Custom post types
require_once locate_template('/lib/metaboxes.php'); // Custom metaboxes
require_once locate_template('/lib/custom.php'); // Custom functions
function roots_setup() {
// Make theme available for translation
load_theme_textdomain('roots', get_template_directory() . '/lang');
// Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus)
register_nav_menus(array(
'primary_navigation' => __('Primary Navigation', 'roots'),
));
// Add post thumbnails (http://codex.wordpress.org/Post_Thumbnails)
add_theme_support('post-thumbnails');
// set_post_thumbnail_size(150, 150, false);
// add_image_size('category-thumb', 300, 9999); // 300px wide (and unlimited height)
// Add post formats (http://codex.wordpress.org/Post_Formats)
// add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));
// Tell the TinyMCE editor to use a custom stylesheet
add_editor_style('assets/css/editor-style.css');
}
add_action('after_setup_theme', 'roots_setup');