Skip to content

Commit

Permalink
drying layout scaffold
Browse files Browse the repository at this point in the history
Signed-off-by: Norik Davtian <norik@bigemployee.com>
  • Loading branch information
NorikDavtian committed Mar 2, 2014
1 parent d1f4786 commit f5aca58
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 302 deletions.
21 changes: 9 additions & 12 deletions 404.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
* *
*/ */
get_header(); get_header();
get_header('layout');
?> ?>
<div id="primary" class="content-area"> <header class="page-header">
<div id="content" class="site-content" role="main"> <h1 class="page-title"><?php _e('Not Found', 'bigblank'); ?></h1>
<header class="page-header"> </header>
<h1 class="page-title"><?php _e('Not Found', 'bigblank'); ?></h1> <div class="page-content">
</header> <p><?php _e('It looks like nothing was found at this location. Maybe try a search?', 'bigblank'); ?></p>
<div class="page-content"> <?php get_search_form(); ?>
<p><?php _e('It looks like nothing was found at this location. Maybe try a search?', 'bigblank'); ?></p> </div><!-- .page-content -->
<?php get_search_form(); ?>
</div><!-- .page-content -->
</div><!-- #content -->
</div><!-- #primary -->
<?php <?php
get_sidebar(); get_footer('layout');
get_footer(); get_footer();
7 changes: 2 additions & 5 deletions archive.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* *
*/ */
get_header(); get_header();
get_header('layout');
?> ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if (have_posts()) : ?> <?php if (have_posts()) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"> <h1 class="page-title">
Expand Down Expand Up @@ -50,8 +49,6 @@
get_template_part('content', 'none'); get_template_part('content', 'none');
endif; endif;
?> ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php <?php
get_sidebar(); get_footer('layout');
get_footer(); get_footer();
85 changes: 41 additions & 44 deletions author.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,53 +6,50 @@
* *
*/ */
get_header(); get_header();
get_header('layout');
?> ?>
<section id="primary" class="content-area"> <?php if (have_posts()) : ?>
<div id="content" class="site-content" role="main"> <header class="archive-header">
<?php if (have_posts()) : ?> <h1 class="archive-title">
<header class="archive-header">
<h1 class="archive-title">
<?php
/*
* Queue the first post, that way we know what author
* we're dealing with (if that is the case).
*
* We reset this later so we can run the loop properly
* with a call to rewind_posts().
*/
the_post();
printf(__('All posts by %s', 'bigblank'), get_the_author());
?>
</h1>
<?php if (get_the_author_meta('description')) : ?>
<div class="author-description"><?php the_author_meta('description'); ?></div>
<?php endif; ?>
</header><!-- .archive-header -->
<?php <?php
/* /*
* Since we called the_post() above, we need to rewind * Queue the first post, that way we know what author
* the loop back to the beginning that way we can run * we're dealing with (if that is the case).
* the loop properly, in full. *
* We reset this later so we can run the loop properly
* with a call to rewind_posts().
*/ */
rewind_posts(); the_post();
// Start the Loop. printf(__('All posts by %s', 'bigblank'), get_the_author());
while (have_posts()) : the_post(); ?>
/* </h1>
* Include the post format-specific template for the content. If you want to <?php if (get_the_author_meta('description')) : ?>
* use this in a child theme, then include a file called called content-___.php <div class="author-description"><?php the_author_meta('description'); ?></div>
* (where ___ is the post format) and that will be used instead. <?php endif; ?>
*/ </header><!-- .archive-header -->
get_template_part('content', get_post_format()); <?php
endwhile; /*
// Previous/next page navigation. * Since we called the_post() above, we need to rewind
bigblank_paging_nav(); * the loop back to the beginning that way we can run
else : * the loop properly, in full.
// If no content, include the "No posts found" template. */
get_template_part('content', 'none'); rewind_posts();
endif; // Start the Loop.
?> while (have_posts()) : the_post();
</div><!-- #content --> /*
</section><!-- #primary --> * Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part('content', get_post_format());
endwhile;
// Previous/next page navigation.
bigblank_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part('content', 'none');
endif;
?>
<?php <?php
get_sidebar(); get_footer('layout');
get_footer(); get_footer();
59 changes: 28 additions & 31 deletions category.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,39 +6,36 @@
* *
*/ */
get_header(); get_header();
get_header('layout');
?> ?>
<section id="primary" class="content-area"> <?php if (have_posts()) : ?>
<div id="content" class="site-content" role="main"> <header class="archive-header">
<?php if (have_posts()) : ?> <h1 class="archive-title"><?php printf(__('Category Archives: %s', 'bigblank'), single_cat_title('', false)); ?></h1>
<header class="archive-header"> <?php
<h1 class="archive-title"><?php printf(__('Category Archives: %s', 'bigblank'), single_cat_title('', false)); ?></h1> // Show an optional term description.
<?php $term_description = term_description();
// Show an optional term description. if (!empty($term_description)) :
$term_description = term_description(); printf('<div class="taxonomy-description">%s</div>', $term_description);
if (!empty($term_description)) :
printf('<div class="taxonomy-description">%s</div>', $term_description);
endif;
?>
</header><!-- .archive-header -->
<?php
// Start the Loop.
while (have_posts()) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part('content', get_post_format());
endwhile;
// Previous/next page navigation.
bigblank_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part('content', 'none');
endif; endif;
?> ?>
</div><!-- #content --> </header><!-- .archive-header -->
</section><!-- #primary --> <?php
// Start the Loop.
while (have_posts()) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part('content', get_post_format());
endwhile;
// Previous/next page navigation.
bigblank_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part('content', 'none');
endif;
?>
<?php <?php
get_sidebar(); get_footer('layout');
get_footer(); get_footer();
12 changes: 12 additions & 0 deletions footer-layout.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Closing our content scaffold and checking to see if we should include sidebar
* Always call get_header('layout'); to open tags closed here.
*
*/
?>
</div><!-- #main -->
<?php if ($layout == 'content-sidebar' || $layout == 'sidebar-content'): ?>
<?php get_sidebar(); ?>
<?php endif; ?>
</div><!-- #content -->
22 changes: 22 additions & 0 deletions header-layout.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Adding layout class to our main content
* Always call get_footer('layout'); to close tags opened here.
* @todo create a function to overwrite comments open
* @todo create a function to get the layout
* @link https://codex.wordpress.org/Function_Reference/comments_open#Examples
*/
$layout = get_post_meta(get_the_ID(), 'bigblank_post_layout', true);
$options = bigblank_get_theme_options();
if (!$layout) {
$layout = $options['theme_layout'];
}
if(is_page()){
$comments = $options['page_comments'];
}
if(is_single()){
$comments = $options['post_comments'];
}
?>
<div id="content" class="site-content <?php echo $layout; ?>">
<div id="main" role="main">
93 changes: 45 additions & 48 deletions image.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,55 +6,52 @@
// Retrieve attachment metadata. // Retrieve attachment metadata.
$metadata = wp_get_attachment_metadata(); $metadata = wp_get_attachment_metadata();
get_header(); get_header();
get_header('layout');
?> ?>
<section id="primary" class="content-area image-attachment"> <?php
<div id="content" class="site-content" role="main"> // Start the Loop.
<?php while (have_posts()) : the_post();
// Start the Loop. ?>
while (have_posts()) : the_post(); <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
<div class="entry-meta">
<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr(get_the_date('c')); ?>"><?php echo esc_html(get_the_date()); ?></time></span>
<span class="full-size-link"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span>
<span class="parent-post-link"><a href="<?php echo get_permalink($post->post_parent); ?>" rel="gallery"><?php echo get_the_title($post->post_parent); ?></a></span>
<?php edit_post_link(__('Edit', 'bigblank'), '<span class="edit-link">', '</span>'); ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<div class="entry-attachment">
<div class="attachment">
<?php bigblank_the_attached_image(); ?>
</div><!-- .attachment -->
<?php if (has_excerpt()) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div><!-- .entry-caption -->
<?php endif; ?>
</div><!-- .entry-attachment -->
<?php
the_content();
wp_link_pages(array(
'before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'bigblank') . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
));
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> </div><!-- .entry-content -->
<header class="entry-header"> </article><!-- #post-## -->
<?php the_title('<h1 class="entry-title">', '</h1>'); ?> <nav id="image-navigation" class="navigation image-navigation">
<div class="entry-meta"> <div class="nav-links">
<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr(get_the_date('c')); ?>"><?php echo esc_html(get_the_date()); ?></time></span> <?php previous_image_link(false, '<div class="previous-image">' . __('Previous Image', 'bigblank') . '</div>'); ?>
<span class="full-size-link"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span> <?php next_image_link(false, '<div class="next-image">' . __('Next Image', 'bigblank') . '</div>'); ?>
<span class="parent-post-link"><a href="<?php echo get_permalink($post->post_parent); ?>" rel="gallery"><?php echo get_the_title($post->post_parent); ?></a></span> </div><!-- .nav-links -->
<?php edit_post_link(__('Edit', 'bigblank'), '<span class="edit-link">', '</span>'); ?> </nav><!-- #image-navigation -->
</div><!-- .entry-meta --> <?php comments_template(); ?>
</header><!-- .entry-header --> <?php endwhile; // end of the loop. ?>
<div class="entry-content">
<div class="entry-attachment">
<div class="attachment">
<?php bigblank_the_attached_image(); ?>
</div><!-- .attachment -->
<?php if (has_excerpt()) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div><!-- .entry-caption -->
<?php endif; ?>
</div><!-- .entry-attachment -->
<?php
the_content();
wp_link_pages(array(
'before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'bigblank') . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
));
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<nav id="image-navigation" class="navigation image-navigation">
<div class="nav-links">
<?php previous_image_link(false, '<div class="previous-image">' . __('Previous Image', 'bigblank') . '</div>'); ?>
<?php next_image_link(false, '<div class="next-image">' . __('Next Image', 'bigblank') . '</div>'); ?>
</div><!-- .nav-links -->
</nav><!-- #image-navigation -->
<?php comments_template(); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php <?php
get_sidebar(); get_footer('layout');
get_footer(); get_footer();
Loading

0 comments on commit f5aca58

Please sign in to comment.