-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop-header.php
180 lines (124 loc) · 5.28 KB
/
loop-header.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
/**
* Title and description or other content shown above loop on categories, archives, etc.
*
* Hierarchy information: http://codex.wordpress.org/Template_Hierarchy
*/
// No direct access
if ( ! defined( 'ABSPATH' ) ) exit;
// Show only on loop multiple
if ( is_singular() ) return;
do_action('uplifted_before_loop_header');
/**************************************
* BLOG POSTS
**************************************/
// Show page title and content before loop when static front page used and "Posts page" is specified
// Possibility: Simplify by making this condition cause Blog tempate to load with "Posts page" $post global?
if ( ctfw_is_posts_page() ) : ?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( get_post_field( 'post_title', get_queried_object_id() ) ); ?></h1>
<?php if ( $content = apply_filters( 'the_content', get_post_field( 'post_content', get_queried_object_id() ) ) ) : ?>
<div class="uplifted-entry-content">
<?php echo $content; ?>
</div>
<?php endif; ?>
<?php
/**************************************
* BLOG TAXONOMIES
**************************************/
elseif ( is_category() ) : ?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( single_cat_title( '', false ) ); ?></h1>
<div class="uplifted-entry-content">
<?php echo category_description(); ?>
</div>
<?php elseif ( is_tag() ) : ?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( sprintf( __( "'%s' tagged posts", 'uplifted' ), single_tag_title( '', false ) ) ); ?></h1>
<?php
/**************************************
* CUSTOM TAXONOMY
**************************************/
elseif ( is_tax() ) : ?>
<?php
// Title format depends on taxonomy; default shows taxonomy alone
$taxonomy = get_query_var( 'taxonomy' );
$taxonomy_titles = array(
/* translators: %s represents sermon topic */
'ctc_sermon_topic' => _x( 'Sermons on %s', 'sermon topic', 'uplifted' ),
/* translators: %s represents Bible book */
'ctc_sermon_book' => _x( 'Sermons on %s', 'sermon book', 'uplifted' ),
/* translators: %s represents sermon speaker name */
'ctc_sermon_speaker' => __( 'Sermons by %s', 'uplifted' ),
/* translators: %s represents sermon tag term */
'ctc_sermon_tag' => __( "'%s' tagged sermons", 'uplifted' ),
);
$taxonomy_title = isset( $taxonomy_titles[$taxonomy] ) ? $taxonomy_titles[$taxonomy] : '%s';
?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( sprintf( $taxonomy_title, single_term_title( '', false ) ) ); ?></h1>
<div class="uplifted-entry-content">
<?php echo term_description( '', get_query_var( 'taxonomy' ) ); ?>
</div>
<?php
/**************************************
* AUTHOR ARCHIVE
**************************************/
elseif ( is_author() ) : ?>
<h1 class="uplifted-main-title"><?php echo uplifted_title_paged( sprintf( __( "Posts by %s", 'uplifted' ), get_the_author() ) ); ?></h1>
<?php
/**************************************
* SEARCH RESULTS
**************************************/
?>
<?php elseif ( is_search() ) : ?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( sprintf( __( "Search results for '%s'", 'uplifted' ), get_search_query() ) ); ?></h1>
<div class="uplifted-entry-content">
<?php
/* translators: %d is number of matches, %s is search term */
echo sprintf( _n( 'There is %d match for %s.', 'There are %d matches for %s.', $wp_query->found_posts, 'uplifted' ), $wp_query->found_posts, '<i>' . get_search_query() . '</i>' );
?>
</div>
<?php
/**************************************
* DATE ARCHIVE
**************************************/
elseif ( is_day() || is_month() || is_year() ) : ?>
<?php
// Date format
if ( is_day() ) {
$date = get_the_date();
} else if ( is_month() ) {
$date = get_the_date( _x( 'F Y', 'monthly archives date format', 'uplifted' ) );
} else if ( is_year() ) {
$date = get_the_date( _x( 'Y', 'yearly archives date format', 'uplifted' ) );
}
// Title format depends on post type
$post_type = get_post_type();
$archive_titles = array(
/* translators: %s represents date */
'post' => __( 'Posts from %s', 'uplifted' ),
/* translators: %s represents date */
'ctc_sermon' => __( 'Sermons from %s', 'uplifted' ),
);
$archive_title = isset( $archive_titles[$post_type] ) ? $archive_titles[$post_type] : '%s';
?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( sprintf( $archive_title, $date ) ); ?></h1>
<?php
/**************************************
* POST TYPE ARCHIVE
**************************************/
// When page template not used to output post type items, post type name shown at top
elseif ( is_post_type_archive() ) : ?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( post_type_archive_title( '', false ) ); ?></h1>
<?php
/**************************************
* GENERIC ARCHIVE
**************************************/
// This is used when nothing higher up is suitable
elseif ( is_archive() ) : ?>
<h1 class="uplifted-main-title"><?php uplifted_title_paged( __( 'Archives', 'uplifted' ) ); ?></h1>
<?php
elseif ( is_404() ) : ?>
<h1 class="uplifted-main-title"><?php _e( 'Not Found', 'uplifted' ); ?></h1>
<div class="uplifted-entry-content">
<?php _e( 'Sorry, the page or file you tried to access was not found.', 'uplifted' ); ?>
</div>
<?php endif; ?>
<?php do_action('uplifted_after_loop_header'); ?>