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:
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Roots configuration and constants
|
||||
* Roots configuration
|
||||
*/
|
||||
|
||||
// Enable theme features
|
||||
add_theme_support('root-relative-urls'); // Enable relative URLs
|
||||
add_theme_support('rewrite-urls'); // Enable URL rewrites
|
||||
add_theme_support('h5bp-htaccess'); // Enable HTML5 Boilerplate's .htaccess
|
||||
@@ -30,15 +32,9 @@ function roots_sidebar_class() {
|
||||
echo 'span4';
|
||||
}
|
||||
|
||||
$get_theme_name = explode('/themes/', get_template_directory());
|
||||
define('GOOGLE_ANALYTICS_ID', ''); // UA-XXXXX-Y
|
||||
define('POST_EXCERPT_LENGTH', 40);
|
||||
define('WP_BASE', wp_base_dir());
|
||||
define('THEME_NAME', next($get_theme_name));
|
||||
define('RELATIVE_PLUGIN_PATH', str_replace(site_url() . '/', '', plugins_url()));
|
||||
define('FULL_RELATIVE_PLUGIN_PATH', WP_BASE . '/' . RELATIVE_PLUGIN_PATH);
|
||||
define('RELATIVE_CONTENT_PATH', str_replace(site_url() . '/', '', content_url()));
|
||||
define('THEME_PATH', RELATIVE_CONTENT_PATH . '/themes/' . THEME_NAME);
|
||||
// Configuration values
|
||||
define('GOOGLE_ANALYTICS_ID', ''); // UA-XXXXX-Y
|
||||
define('POST_EXCERPT_LENGTH', 40);
|
||||
|
||||
// Set the content width based on the theme's design and stylesheet
|
||||
if (!isset($content_width)) { $content_width = 940; }
|
||||
|
||||
Reference in New Issue
Block a user