Re-organization
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<?php roots_footer_before(); ?>
|
<?php roots_footer_before(); ?>
|
||||||
<footer id="content-info" class="<?php echo WRAP_CLASSES; ?>" role="contentinfo">
|
<footer id="content-info" class="<?php echo WRAP_CLASSES; ?>" role="contentinfo">
|
||||||
<?php roots_footer_inside(); ?>
|
<?php roots_footer_inside(); ?>
|
||||||
<?php dynamic_sidebar('roots-footer'); ?>
|
<?php dynamic_sidebar('sidebar-footer'); ?>
|
||||||
<p class="copy"><small>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?></small></p>
|
<p class="copy"><small>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?></small></p>
|
||||||
</footer>
|
</footer>
|
||||||
<?php roots_footer_after(); ?>
|
<?php roots_footer_after(); ?>
|
||||||
|
|||||||
@@ -1,76 +1,43 @@
|
|||||||
<?php // https://github.com/retlehs/roots/wiki
|
<?php
|
||||||
|
/**
|
||||||
|
* Roots functions
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
|
if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
|
||||||
|
|
||||||
require_once locate_template('/inc/roots-config.php'); // config
|
require_once locate_template('/inc/util.php'); // Utility functions
|
||||||
require_once locate_template('/inc/roots-utils.php'); // utility functions
|
require_once locate_template('/inc/config.php'); // Configuration and constants
|
||||||
|
require_once locate_template('/inc/activation.php'); // Theme activation
|
||||||
define('WP_BASE', wp_base_dir());
|
require_once locate_template('/inc/template-tags.php'); // Template tags
|
||||||
define('THEME_NAME', next(explode('/themes/', get_template_directory())));
|
require_once locate_template('/inc/cleanup.php'); // Cleanup
|
||||||
define('RELATIVE_PLUGIN_PATH', str_replace(site_url() . '/', '', plugins_url()));
|
require_once locate_template('/inc/scripts.php'); // Scripts and stylesheets
|
||||||
define('FULL_RELATIVE_PLUGIN_PATH', WP_BASE . '/' . RELATIVE_PLUGIN_PATH);
|
require_once locate_template('/inc/htaccess.php'); // Rewrites for assets, H5BP .htaccess
|
||||||
define('RELATIVE_CONTENT_PATH', str_replace(site_url() . '/', '', content_url()));
|
require_once locate_template('/inc/hooks.php'); // Hooks
|
||||||
define('THEME_PATH', RELATIVE_CONTENT_PATH . '/themes/' . THEME_NAME);
|
require_once locate_template('/inc/actions.php'); // Actions
|
||||||
|
require_once locate_template('/inc/widgets.php'); // Sidebars and widgets
|
||||||
require_once locate_template('/inc/roots-activation.php'); // activation
|
require_once locate_template('/inc/custom.php'); // Custom functions
|
||||||
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; }
|
|
||||||
|
|
||||||
function roots_setup() {
|
function roots_setup() {
|
||||||
|
|
||||||
|
// Make theme available for translation
|
||||||
load_theme_textdomain('roots', get_template_directory() . '/lang');
|
load_theme_textdomain('roots', get_template_directory() . '/lang');
|
||||||
|
|
||||||
// tell the TinyMCE editor to use editor-style.css
|
// Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus)
|
||||||
// if you have issues with getting the editor to show your changes then
|
register_nav_menus(array(
|
||||||
// use this instead: add_editor_style('editor-style.css?' . time());
|
'primary_navigation' => __('Primary Navigation', 'roots'),
|
||||||
add_editor_style('editor-style.css');
|
));
|
||||||
|
|
||||||
// http://codex.wordpress.org/Post_Thumbnails
|
// Add post thumbnails (http://codex.wordpress.org/Post_Thumbnails)
|
||||||
add_theme_support('post-thumbnails');
|
add_theme_support('post-thumbnails');
|
||||||
// set_post_thumbnail_size(150, 150, false);
|
// 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'));
|
// add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));
|
||||||
|
|
||||||
// http://codex.wordpress.org/Function_Reference/register_nav_menus
|
// Tell the TinyMCE editor to use a custom stylesheet
|
||||||
register_nav_menus(array(
|
add_editor_style('css/editor-style.css');
|
||||||
'primary_navigation' => __('Primary Navigation', 'roots')
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('after_setup_theme', 'roots_setup');
|
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>';
|
|
||||||
}
|
|
||||||
@@ -20,4 +20,4 @@ function roots_google_analytics() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('roots_footer', 'roots_google_analytics');
|
add_action('roots_footer', 'roots_google_analytics');
|
||||||
@@ -74,7 +74,7 @@ function roots_root_relative_attachment_urls() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function enable_root_relative_urls() {
|
function enable_root_relative_urls() {
|
||||||
return !(is_admin() && in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) && ROOT_RELATIVE_URLS;
|
return !(is_admin() && in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) && current_theme_supports('root-relative-urls');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_root_relative_urls()) {
|
if (enable_root_relative_urls()) {
|
||||||
24
inc/config.php
Normal file
24
inc/config.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
add_theme_support('root-relative-urls');
|
||||||
|
add_theme_support('rewrite-urls');
|
||||||
|
add_theme_support('h5bp-htaccess');
|
||||||
|
add_theme_support('bootstrap-responsive');
|
||||||
|
|
||||||
|
// Set the content width based on the theme's design and stylesheet
|
||||||
|
if (!isset($content_width)) { $content_width = 940; }
|
||||||
|
|
||||||
|
define('POST_EXCERPT_LENGTH', 40);
|
||||||
|
define('WRAP_CLASSES', 'container');
|
||||||
|
define('CONTAINER_CLASSES', 'row');
|
||||||
|
define('MAIN_CLASSES', 'span8');
|
||||||
|
define('SIDEBAR_CLASSES', 'span4');
|
||||||
|
define('FULLWIDTH_CLASSES', 'span12');
|
||||||
|
define('GOOGLE_ANALYTICS_ID', '');
|
||||||
|
|
||||||
|
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);
|
||||||
@@ -44,15 +44,15 @@ if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') || stristr($_SERVER['SERVER_S
|
|||||||
|
|
||||||
// only use clean urls if the theme isn't a child or an MU (Network) install
|
// only use clean urls if the theme isn't a child or an MU (Network) install
|
||||||
if (!is_multisite() && !is_child_theme() && get_option('permalink_structure')) {
|
if (!is_multisite() && !is_child_theme() && get_option('permalink_structure')) {
|
||||||
if (REWRITE_URLS) {
|
if (current_theme_supports('rewrite-urls')) {
|
||||||
add_action('generate_rewrite_rules', 'roots_add_rewrites');
|
add_action('generate_rewrite_rules', 'roots_add_rewrites');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (H5BP_HTACCESS) {
|
if (current_theme_supports('h5bp-htaccess')) {
|
||||||
add_action('generate_rewrite_rules', 'roots_add_h5bp_htaccess');
|
add_action('generate_rewrite_rules', 'roots_add_h5bp_htaccess');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_admin() && REWRITE_URLS) {
|
if (!is_admin() && current_theme_supports('rewrite-urls')) {
|
||||||
$tags = array(
|
$tags = array(
|
||||||
'plugins_url',
|
'plugins_url',
|
||||||
'bloginfo',
|
'bloginfo',
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
define('ROOT_RELATIVE_URLS', true); // Use root relative URLs
|
|
||||||
define('REWRITE_URLS', true); // Use rewrites for theme assets and plugin folders
|
|
||||||
define('H5BP_HTACCESS', true); // Include the HTML5 Boilerplate .htaccess
|
|
||||||
define('POST_EXCERPT_LENGTH', 40);
|
|
||||||
define('BOOTSTRAP_RESPONSIVE', true);
|
|
||||||
define('WRAP_CLASSES', 'container');
|
|
||||||
define('CONTAINER_CLASSES', 'row');
|
|
||||||
define('MAIN_CLASSES', 'span8');
|
|
||||||
define('SIDEBAR_CLASSES', 'span4');
|
|
||||||
define('FULLWIDTH_CLASSES', 'span12');
|
|
||||||
define('GOOGLE_ANALYTICS_ID', '');
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function roots_scripts() {
|
function roots_scripts() {
|
||||||
// Not included by default since Bootstrap's reset supersedes h5bp's. Include if you aren't using Bootstrap.
|
// Not included by default since Bootstrap's reset supersedes h5bp's. Include if you aren't using Bootstrap.
|
||||||
//wp_enqueue_style('roots_style', get_template_directory_uri() . '/css/style.css', false, null);
|
//wp_enqueue_style('roots_style', get_template_directory_uri() . '/css/style.css', false, null);
|
||||||
wp_enqueue_style('roots_bootstrap_style', get_template_directory_uri() . '/css/bootstrap.css', false, null);
|
wp_enqueue_style('roots_bootstrap_style', get_template_directory_uri() . '/css/bootstrap.css', false, null);
|
||||||
|
|
||||||
if (BOOTSTRAP_RESPONSIVE) {
|
if (current_theme_supports('bootstrap-responsive')) {
|
||||||
wp_enqueue_style('roots_bootstrap_responsive_style', get_template_directory_uri() . '/css/bootstrap-responsive.css', array('roots_bootstrap_style'), null);
|
wp_enqueue_style('roots_bootstrap_responsive_style', get_template_directory_uri() . '/css/bootstrap-responsive.css', array('roots_bootstrap_style'), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
7
inc/template-tags.php
Normal file
7
inc/template-tags.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// 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>';
|
||||||
|
}
|
||||||
@@ -23,4 +23,5 @@ function add_filters($tags, $function) {
|
|||||||
foreach($tags as $tag) {
|
foreach($tags as $tag) {
|
||||||
add_filter($tag, $function);
|
add_filter($tag, $function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
function roots_widgets_init() {
|
||||||
|
// Register widgetized areas
|
||||||
|
register_sidebar(array(
|
||||||
|
'name' => __('Primary Sidebar', 'roots'),
|
||||||
|
'id' => 'sidebar-primary',
|
||||||
|
'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">',
|
||||||
|
'after_widget' => '</div></section>',
|
||||||
|
'before_title' => '<h3>',
|
||||||
|
'after_title' => '</h3>',
|
||||||
|
));
|
||||||
|
register_sidebar(array(
|
||||||
|
'name' => __('Footer', 'roots'),
|
||||||
|
'id' => 'sidebar-footer',
|
||||||
|
'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">',
|
||||||
|
'after_widget' => '</div></section>',
|
||||||
|
'before_title' => '<h3>',
|
||||||
|
'after_title' => '</h3>',
|
||||||
|
));
|
||||||
|
|
||||||
|
// Register widgets
|
||||||
|
register_widget('Roots_Vcard_Widget');
|
||||||
|
}
|
||||||
|
add_action('widgets_init', 'roots_widgets_init');
|
||||||
|
|
||||||
|
// Example vCard widget
|
||||||
class Roots_Vcard_Widget extends WP_Widget {
|
class Roots_Vcard_Widget extends WP_Widget {
|
||||||
function Roots_Vcard_Widget() {
|
function Roots_Vcard_Widget() {
|
||||||
$widget_ops = array('classname' => 'widget_roots_vcard', 'description' => __('Use this widget to add a vCard', 'roots'));
|
$widget_ops = array('classname' => 'widget_roots_vcard', 'description' => __('Use this widget to add a vCard', 'roots'));
|
||||||
@@ -126,9 +151,3 @@ class Roots_Vcard_Widget extends WP_Widget {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_widget_init() {
|
|
||||||
register_widget('Roots_Vcard_Widget');
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('widgets_init', 'roots_widget_init');
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<div class="well">
|
<div class="well">
|
||||||
<?php dynamic_sidebar('roots-sidebar'); ?>
|
<?php dynamic_sidebar('sidebar-primary'); ?>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Theme Name: Roots
|
Theme Name: Roots
|
||||||
Theme URI: http://rootstheme.com/
|
Theme URI: http://www.rootstheme.com/
|
||||||
Description: Roots is a starting WordPress theme made for developers that's based on HTML5 Boilerplate and Bootstrap from Twitter. <a href="https://github.com/retlehs/roots/contributors">Contribute on GitHub</a>
|
Description: Roots is a starting WordPress theme made for developers that's based on HTML5 Boilerplate and Bootstrap from Twitter. <a href="https://github.com/retlehs/roots/contributors">Contribute on GitHub</a>
|
||||||
Version: 5.1.0
|
Version: 5.1.0
|
||||||
Author: Ben Word
|
Author: Ben Word
|
||||||
|
|||||||
Reference in New Issue
Block a user