-
Notifications
You must be signed in to change notification settings - Fork 47
/
archive.php
70 lines (57 loc) · 1.57 KB
/
archive.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Archive
*
* @package EAStarter
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
**/
// Full width
add_filter( 'ea_page_layout', 'ea_return_full_width_content' );
/**
* Body Class
*
*/
function ea_archive_body_class( $classes ) {
$classes[] = 'archive';
return $classes;
}
add_filter( 'body_class', 'ea_archive_body_class' );
/**
* Archive Header
*
*/
function ea_archive_header() {
$title = $subtitle = $description = $more = false;
if( is_home() && get_option( 'page_for_posts' ) ) {
$title = get_the_title( get_option( 'page_for_posts' ) );
} elseif( is_search() ) {
$title = 'Search Results';
$more = get_search_form( false );
} elseif( is_archive() ) {
$title = get_the_archive_title();
if( ! get_query_var( 'paged' ) )
$description = get_the_archive_description();
}
if( empty( $title ) && empty( $description ) )
return;
$classes = [ 'archive-description' ];
if( is_author() )
$classes[] = 'author-archive-description';
echo '<header class="' . join( ' ', $classes ) . '">';
do_action ('ea_archive_header_before' );
if( ! empty( $title ) )
echo '<h1 class="archive-title">' . $title . '</h1>';
if( !empty( $subtitle ) )
echo '<h4>' . $subtitle . '</h4>';
echo apply_filters( 'ea_the_content', $description );
echo $more;
do_action ('ea_archive_header_after' );
echo '</header>';
}
add_action( 'tha_content_while_before', 'ea_archive_header' );
// Breadcrumbs
add_action( 'ea_archive_header_before', 'ea_breadcrumbs', 5 );
// Build the page
require get_template_directory() . '/index.php';