Re-organization

This commit is contained in:
Ben Word
2012-05-09 00:55:09 -06:00
parent d4ec36331b
commit 7d2b3c1e07
17 changed files with 95 additions and 90 deletions

View File

@@ -20,4 +20,4 @@ function roots_google_analytics() {
}
}
add_action('roots_footer', 'roots_google_analytics');
add_action('roots_footer', 'roots_google_analytics');

View File

@@ -74,7 +74,7 @@ function roots_root_relative_attachment_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()) {

24
inc/config.php Normal file
View 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);

View File

@@ -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
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');
}
if (H5BP_HTACCESS) {
if (current_theme_supports('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(
'plugins_url',
'bloginfo',

View File

@@ -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', '');

View File

@@ -1,11 +1,11 @@
<?php
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_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);
}

7
inc/template-tags.php Normal file
View 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>';
}

View File

@@ -23,4 +23,5 @@ function add_filters($tags, $function) {
foreach($tags as $tag) {
add_filter($tag, $function);
}
}
}

View File

@@ -1,5 +1,30 @@
<?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 {
function Roots_Vcard_Widget() {
$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
}
}
function roots_widget_init() {
register_widget('Roots_Vcard_Widget');
}
add_action('widgets_init', 'roots_widget_init');