Skip to content

Commit

Permalink
archive template file
Browse files Browse the repository at this point in the history
  • Loading branch information
billerickson committed Feb 19, 2018
1 parent 65aeecf commit eb569bc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*config.codekit3
.DS_Store
.sass-cache/
30 changes: 7 additions & 23 deletions inc/general.php → archive.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
<?php
/**
* General Functions
* Archive
*
* @package EAStarter
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
**/

/**
* Body Classes
*
*/
function ea_archive_body_classes( $classes ) {

// Blog Archive
if( is_home() || is_archive() || is_search() ) {
$classes[] = 'archive';
}

// Standard layout (content less wide then header/footer)
$standard = apply_filters( 'ea_standard_body_class', is_singular() || is_page() );
if( $standard )
$classes[] = 'layout-standard';

return $classes;
}
//add_filter( 'body_class', 'ea_archive_body_classes' );

/**
* Archive Header
*
Expand All @@ -36,9 +16,13 @@ function ea_archive_header() {

$title = $description = false;

if( is_search() )
if( is_home() ) {
$title = get_the_title( get_option( 'page_for_posts' ) );

} elseif( is_search() ) {
$title = 'Search Results for: <em>' . get_search_query() . '</em>';
if( is_archive() ) {

} elseif( is_archive() ) {
$title = get_the_archive_title();
$description = get_the_archive_description();
}
Expand Down
12 changes: 12 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,15 @@ function ea_setup() {
}
endif;
add_action( 'after_setup_theme', 'ea_setup' );

/**
* Template Hierarchy
*
*/
function ea_template_hierarchy( $template ) {

if( is_home() || is_search() )
$template = get_query_template( 'archive' );
return $template;
}
add_filter( 'template_include', 'ea_template_hierarchy' );

0 comments on commit eb569bc

Please sign in to comment.