Re-organization
This commit is contained in:
@@ -1,76 +1,43 @@
|
||||
<?php // https://github.com/retlehs/roots/wiki
|
||||
<?php
|
||||
/**
|
||||
* Roots functions
|
||||
*/
|
||||
|
||||
if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
|
||||
|
||||
require_once locate_template('/inc/roots-config.php'); // config
|
||||
require_once locate_template('/inc/roots-utils.php'); // utility functions
|
||||
|
||||
define('WP_BASE', wp_base_dir());
|
||||
define('THEME_NAME', next(explode('/themes/', get_template_directory())));
|
||||
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);
|
||||
|
||||
require_once locate_template('/inc/roots-activation.php'); // activation
|
||||
require_once locate_template('/inc/roots-cleanup.php'); // cleanup
|
||||
require_once locate_template('/inc/roots-scripts.php'); // modified scripts output
|
||||
require_once locate_template('/inc/roots-htaccess.php'); // rewrites for assets, h5bp htaccess
|
||||
require_once locate_template('/inc/roots-hooks.php'); // hooks
|
||||
require_once locate_template('/inc/roots-actions.php'); // actions
|
||||
require_once locate_template('/inc/roots-widgets.php'); // widgets
|
||||
require_once locate_template('/inc/roots-custom.php'); // custom functions
|
||||
|
||||
// set the maximum 'Large' image width to the maximum grid width
|
||||
// http://wordpress.stackexchange.com/q/11766
|
||||
if (!isset($content_width)) { $content_width = 940; }
|
||||
require_once locate_template('/inc/util.php'); // Utility functions
|
||||
require_once locate_template('/inc/config.php'); // Configuration and constants
|
||||
require_once locate_template('/inc/activation.php'); // Theme activation
|
||||
require_once locate_template('/inc/template-tags.php'); // Template tags
|
||||
require_once locate_template('/inc/cleanup.php'); // Cleanup
|
||||
require_once locate_template('/inc/scripts.php'); // Scripts and stylesheets
|
||||
require_once locate_template('/inc/htaccess.php'); // Rewrites for assets, H5BP .htaccess
|
||||
require_once locate_template('/inc/hooks.php'); // Hooks
|
||||
require_once locate_template('/inc/actions.php'); // Actions
|
||||
require_once locate_template('/inc/widgets.php'); // Sidebars and widgets
|
||||
require_once locate_template('/inc/custom.php'); // Custom functions
|
||||
|
||||
function roots_setup() {
|
||||
|
||||
// Make theme available for translation
|
||||
load_theme_textdomain('roots', get_template_directory() . '/lang');
|
||||
|
||||
// tell the TinyMCE editor to use editor-style.css
|
||||
// if you have issues with getting the editor to show your changes then
|
||||
// use this instead: add_editor_style('editor-style.css?' . time());
|
||||
add_editor_style('editor-style.css');
|
||||
// Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus)
|
||||
register_nav_menus(array(
|
||||
'primary_navigation' => __('Primary Navigation', 'roots'),
|
||||
));
|
||||
|
||||
// http://codex.wordpress.org/Post_Thumbnails
|
||||
// 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)
|
||||
|
||||
// http://codex.wordpress.org/Post_Formats
|
||||
// Add post formats (http://codex.wordpress.org/Post_Formats)
|
||||
// add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));
|
||||
|
||||
// http://codex.wordpress.org/Function_Reference/register_nav_menus
|
||||
register_nav_menus(array(
|
||||
'primary_navigation' => __('Primary Navigation', 'roots')
|
||||
));
|
||||
// Tell the TinyMCE editor to use a custom stylesheet
|
||||
add_editor_style('css/editor-style.css');
|
||||
|
||||
}
|
||||
|
||||
add_action('after_setup_theme', 'roots_setup');
|
||||
|
||||
// http://codex.wordpress.org/Function_Reference/register_sidebar
|
||||
function roots_register_sidebars() {
|
||||
$sidebars = array('Sidebar', 'Footer');
|
||||
|
||||
foreach($sidebars as $sidebar) {
|
||||
register_sidebar(
|
||||
array(
|
||||
'id' => 'roots-' . sanitize_title($sidebar),
|
||||
'name' => __($sidebar, 'roots'),
|
||||
'description' => __($sidebar, 'roots'),
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">',
|
||||
'after_widget' => '</div></section>',
|
||||
'before_title' => '<h3>',
|
||||
'after_title' => '</h3>'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action('widgets_init', 'roots_register_sidebars');
|
||||
|
||||
// return post entry meta information
|
||||
function roots_entry_meta() {
|
||||
echo '<time class="updated" datetime="'. get_the_time('c') .'" pubdate>'. sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()) .'</time>';
|
||||
echo '<p class="byline author vcard">'. __('Written by', 'roots') .' <a href="'. get_author_posts_url(get_the_author_meta('id')) .'" rel="author" class="fn">'. get_the_author() .'</a></p>';
|
||||
}
|
||||
Reference in New Issue
Block a user