adding hooks & actions

This commit is contained in:
Ben Word
2011-05-26 00:27:06 -06:00
parent c2f44c8422
commit f3c1b46d18
21 changed files with 238 additions and 77 deletions

View File

@@ -1,5 +1,7 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" role="main">
<div class="container">
<h1><?php _e('File Not Found', 'roots'); ?></h1>
@@ -14,5 +16,7 @@
</ul>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -1,15 +1,25 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<h1><?php single_cat_title(); ?></h1>
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'category'); ?>
<?php roots_loop_after(); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -1,8 +1,6 @@
<?php if (get_option('roots_css_framework') === '1140') { ?>
</div><!-- /.row -->
<div class="row">
<?php } ?>
<?php roots_footer_before(); ?>
<footer id="content-info" class="<?php echo roots_container_class; ?>" role="contentinfo">
<?php roots_footer_inside(); ?>
<div class="container">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer") ) : ?>
<?php endif; ?>
@@ -29,10 +27,9 @@
<?php } ?>
</div>
</footer>
<?php if (get_option('roots_css_framework') === '1140') { ?>
</div><!-- /.row -->
<?php } ?>
<?php roots_footer_after(); ?>
</div><!-- /#wrap -->
<?php wp_footer(); ?>
<?php roots_footer(); ?>
</body>
</html>

View File

@@ -1,14 +1,22 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<?php get_template_part('loop', 'page'); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -9,6 +9,8 @@ include_once('inc/roots-options.php'); // theme options menu
include_once('inc/roots-ob.php'); // output buffer
include_once('inc/roots-cleanup.php'); // code cleanup/removal
include_once('inc/roots-htaccess.php'); // h5bp htaccess
include_once('inc/roots-hooks.php'); // hooks
include_once('inc/roots-actions.php'); // actions
include_once('inc/roots-custom.php'); // custom functions
// set the value of the main container class depending on the selected grid framework

View File

@@ -19,6 +19,7 @@
<script>window.jQuery || document.write('<script src="<?php echo get_template_directory_uri(); ?>/js/libs/jquery-1.6.1.min.js">\x3C/script>')</script>
<?php wp_head(); ?>
<?php roots_head(); ?>
<?php if (get_option('roots_css_framework') === '1140') { ?>
<script src="<?php echo get_template_directory_uri(); ?>/js/css3-mediaqueries.js"></script>
<?php } ?>
@@ -33,11 +34,11 @@
<?php } ?>
</head>
<body <?php $page_slug = $post->post_name; body_class($page_slug); ?>>
<?php roots_wrap_before(); ?>
<div id="wrap" class="container" role="document">
<?php if (get_option('roots_css_framework') === '1140') { ?>
<div class="row">
<?php } ?>
<?php roots_header_before(); ?>
<header id="banner" class="<?php echo roots_container_class; ?>" role="banner">
<?php roots_header_inside(); ?>
<div class="container">
<a id="logo" href="<?php echo home_url(); ?>/"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" width="300" height="75" alt="<?php bloginfo('name'); ?>"></a>
<nav id="nav-main" role="navigation">
@@ -48,7 +49,4 @@
</nav>
</div>
</header>
<?php if (get_option('roots_css_framework') === '1140') { ?>
</div><!-- /.row -->
<div class="row">
<?php } ?>
<?php roots_header_after(); ?>

34
inc/roots-actions.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
add_action('roots_header_before', 'roots_1140_header_before');
add_action('roots_header_after', 'roots_1140_header_after');
add_action('roots_footer_before', 'roots_1140_footer_before');
add_action('roots_footer_after', 'roots_1140_footer_after');
function roots_1140_header_before() {
if (get_option('roots_css_framework') === '1140') {
echo "<div class=\"row\">";
}
}
function roots_1140_header_after() {
if (get_option('roots_css_framework') === '1140') {
echo "</div><!-- /.row -->";
echo "<div class=\"row\">";
}
}
function roots_1140_footer_before() {
if (get_option('roots_css_framework') === '1140') {
echo "</div><!-- /.row -->";
echo "<div class=\"row\">";
}
}
function roots_1140_footer_after() {
if (get_option('roots_css_framework') === '1140') {
echo "</div><!-- /.row -->";
}
}
?>

33
inc/roots-hooks.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// header.php
function roots_head() { do_action( 'roots_head' ); }
function roots_wrap_before() { do_action( 'roots_wrap_before' ); }
function roots_header_before() { do_action( 'roots_header_before' ); }
function roots_header_inside() { do_action( 'roots_header_inside' ); }
function roots_header_after() { do_action( 'roots_header_after' ); }
// 404.php, archive.php, front-page.php, index.php, loop-page.php, loop-search.php, loop-single.php, loop.php
// page-custom.php, page-full.php, page-sitemap.php, page-subpages.php, page.php, search.php, single.php
function roots_content_before() { do_action( 'roots_content_before' ); }
function roots_content_after() { do_action( 'roots_content_after' ); }
function roots_main_before() { do_action( 'roots_main_before' ); }
function roots_main_after() { do_action( 'roots_main_after' ); }
function roots_post_before() { do_action( 'roots_post_before' ); }
function roots_post_after() { do_action( 'roots_post_after' ); }
function roots_post_inside_before() { do_action( 'roots_post_inside_before' ); }
function roots_post_inside_after() { do_action( 'roots_post_inside_after' ); }
function roots_loop_before() { do_action( 'roots_loop_before' ); }
function roots_loop_after() { do_action( 'roots_loop_after' ); }
function roots_sidebar_before() { do_action( 'roots_sidebar_before' ); }
function roots_sidebar_inside_before() { do_action( 'roots_sidebar_inside_before' ); }
function roots_sidebar_inside_after() { do_action( 'roots_sidebar_inside_after' ); }
function roots_sidebar_after() { do_action( 'roots_sidebar_after' ); }
// footer.php
function roots_footer_before() { do_action( 'roots_footer_before' ); }
function roots_footer_inside() { do_action( 'roots_footer_inside' ); }
function roots_footer_after() { do_action( 'roots_footer_after' ); }
function roots_footer() { do_action( 'roots_footer' ); }
?>

View File

@@ -1,15 +1,23 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<h1>Latest Posts</h1>
<h1><?php _e('Latest Posts', 'roots');?></h1>
<?php get_template_part('loop', 'index'); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -1,10 +1,11 @@
<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<?php if (function_exists('yoast_breadcrumb')) { if (is_page() && $post->post_parent) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } } ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<nav id="page-nav"><p>' . __('Pages:', 'roots'), 'after' => '</p></nav>' )); ?>
<?php roots_post_before(); ?>
<?php roots_post_inside_before(); ?>
<?php if (function_exists('yoast_breadcrumb')) { if (is_page() && $post->post_parent) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } } ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<nav id="page-nav"><p>' . __('Pages:', 'roots'), 'after' => '</p></nav>' )); ?>
<?php roots_post_inside_after(); ?>
<?php roots_post_after(); ?>
<?php endwhile; // End the loop ?>

View File

@@ -4,19 +4,19 @@
<p class="bottom"><?php _e('Sorry, no results were found.', 'roots'); ?></p>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<?php roots_post_before(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php roots_post_inside_before(); ?>
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<time pubdate datetime="<?php the_time('c'); ?>"><?php printf(__('Posted on %s at %s.', 'roots'), get_the_time('l, F jS, Y'), get_the_time()); ?></time>
<?php if (get_option('roots_post_author') == 'checked') { ?>
<p class="byline author vcard">
<?php _e('Written by', 'roots');?> <span class="fn"><?php the_author(); ?></span>
<?php _e('Written by', 'roots'); ?> <span class="fn"><?php the_author(); ?></span>
</p>
<?php } ?>
</header>
@@ -26,10 +26,9 @@
<footer>
<?php $tag = get_the_tags(); if (!$tag) { } else { ?><p><?php the_tags(); ?></p><?php } ?>
</footer>
<?php roots_post_inside_after(); ?>
</article>
<?php comments_template('', true); ?>
<?php roots_post_after(); ?>
<?php endwhile; // End the loop ?>
<?php /* Display navigation to next/previous pages when applicable */ ?>

View File

@@ -1,27 +1,29 @@
<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<time class="updated" datetime="<?php the_time('c'); ?>" pubdate><?php printf(__('Posted on %s at %s.', 'roots'), get_the_time('l, F jS, Y'),get_the_time())?></time>
<?php if (get_option('roots_post_author') == 'checked') { ?>
<p class="byline author vcard">
<?php _e('Written by', 'roots');?> <span class="fn"><?php the_author(); ?></span>
</p>
<?php } ?>
<?php if (get_option('roots_post_tweet') == 'checked') { ?>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal"><?php _e('Tweet', 'roots');?></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<?php } ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(array('before' => '<nav id="page-nav"><p>' . __('Pages:', 'roots'), 'after' => '</p></nav>' )); ?>
<p><?php the_tags(); ?></p>
</footer>
<?php comments_template(); ?>
</article>
<?php roots_post_before(); ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php roots_post_inside_before(); ?>
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<time class="updated" datetime="<?php the_time('c'); ?>" pubdate><?php printf(__('Posted on %s at %s.', 'roots'), get_the_time('l, F jS, Y'),get_the_time())?></time>
<?php if (get_option('roots_post_author') == 'checked') { ?>
<p class="byline author vcard">
<?php _e('Written by', 'roots');?> <span class="fn"><?php the_author(); ?></span>
</p>
<?php } ?>
<?php if (get_option('roots_post_tweet') == 'checked') { ?>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal"><?php _e('Tweet', 'roots');?></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<?php } ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(array('before' => '<nav id="page-nav"><p>' . __('Pages:', 'roots'), 'after' => '</p></nav>' )); ?>
<p><?php the_tags(); ?></p>
</footer>
<?php comments_template(); ?>
<?php roots_post_inside_after(); ?>
</article>
<?php roots_post_after(); ?>
<?php endwhile; // End the loop ?>

View File

@@ -4,13 +4,13 @@
<p class="bottom"><?php _e('Sorry, no results were found.', 'roots'); ?></p>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<?php roots_post_before(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php roots_post_inside_before(); ?>
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<time pubdate datetime="<?php the_time('c'); ?>"><?php printf( __('Posted on %s at %s.','roots'), get_the_time('l, F jS, Y'), get_the_time()) ?></time>
@@ -30,10 +30,9 @@
<footer>
<?php $tag = get_the_tags(); if (!$tag) { } else { ?><p><?php the_tags(); ?></p><?php } ?>
</footer>
<?php roots_post_inside_after(); ?>
</article>
<?php comments_template('', true); ?>
<?php roots_post_after(); ?>
<?php endwhile; // End the loop ?>
<?php /* Display navigation to next/previous pages when applicable */ ?>

View File

@@ -3,16 +3,26 @@
Template Name: Custom
*/
get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'page'); ?>
<?php roots_loop_after(); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -3,11 +3,17 @@
Template Name: Full Width
*/
get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo roots_container_class; ?>" role="main">
<div class="container">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'page'); ?>
<?php roots_loop_after(); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -3,10 +3,14 @@
Template Name: Sitemap
*/
get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo roots_container_class; ?>" role="main">
<div class="container">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'page'); ?>
<?php roots_loop_after(); ?>
<h2><?php _e('Pages', 'roots'); ?></h2>
<ul><?php wp_list_pages('sort_column=menu_order&depth=0&title_li='); ?></ul>
<h2><?php _e('Posts', 'roots'); ?></h2>
@@ -15,10 +19,16 @@ get_header(); ?>
<ul><?php wp_get_archives('type=monthly&limit=12'); ?></ul>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -3,10 +3,14 @@
Template Name: List Subpages
*/
get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo roots_container_class; ?>" role="main">
<div class="container">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'page'); ?>
<?php roots_loop_after(); ?>
<?php
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
if ($children) { ?>
@@ -16,10 +20,16 @@ get_header(); ?>
<?php } ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -1,14 +1,24 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'page'); ?>
<?php roots_loop_after(); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -1,15 +1,25 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<div id="main" class="<?php echo get_option('roots_main_class'); ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<h1><?php _e('Search Results for', 'roots'); ?> <?php echo get_search_query(); ?></h1>
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'search'); ?>
<?php roots_loop_after(); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>

View File

@@ -1,14 +1,24 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo roots_container_class; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo get_option('roots_main_class'); ?>" role="main">
<div class="container">
<?php roots_loop_before(); ?>
<?php get_template_part('loop', 'single'); ?>
<?php roots_loop_after(); ?>
</div>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<div class="container">
<?php get_sidebar(); ?>
</div>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>