-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop.php
233 lines (171 loc) · 8.19 KB
/
loop.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php
/* MAIN THEME LOOP FOR SINGLE(POSTS & PAGES), ARCHIVES (ALL), ATTACHMENT PAGES (IMAGES) */
/* DISPLAY PAGE AND POST CONTENT ON SINGLE POST & SINGLE PAGES
*****************************************************/
if ( is_page() || is_single() && !is_attachment() ) {
if (have_posts()) : while (have_posts()) : the_post(); ?>
<section class="main-body">
<div class="wrapper">
<div class="left-content">
<article id="post-<?php the_ID(); ?>">
<header>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<p>Posted on <?php the_time('F jS, Y'); ?> by <?php the_author(); ?></p>
</header>
<section>
<?php the_content('Read more on "'.the_title('', '', false).'" »'); ?>
</section>
<footer>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
<p>
This entry was posted on <?php the_time('l, F jS, Y'); ?> at <?php the_time(); ?> and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// both comments and pings open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// only pings are open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// comments are open, pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// neither comments nor pings are open ?>
Both comments and pings are currently closed.
<?php } edit_post_link('Edit this entry','','.'); ?>
<?php echo add_this(); ?>
</p>
</footer>
</article>
<?php include_once('_next-previous-posts.php') ?>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<section>
<article>
<p>Sorry, no posts matched your criteria.</p>
</article>
</section>
<?php endif; ?>
</div> <!-- /.left-content -->
<?php get_sidebar(); ?>
</div> <!-- /.wrapper -->
</section> <!-- /.main-body -->
<?php } // END - DISPLAY PAGE AND POST CONTENT ON SINGLE POST & SINGLE PAGES ?>
<?php
/* DISPLAY POSTS ON HOME, ARCHIVE AND SEARCH PAGES
*****************************************************/
if ( is_home() || is_archive() || is_search() ) {
?>
<section class="main-body">
<div class="wrapper">
<div class="left-content">
<?php if (have_posts()) :
// If we're on any page then display the title for it.
?>
<?php $post = $posts[0]; ?>
<?php if (is_category()) { ?>
<h1>Archive for the “<?php single_cat_title(); ?>” Category</h1>
<?php } elseif(is_tag()) { ?>
<h1>Posts Tagged “<?php single_tag_title(); ?>”</h1>
<?php } elseif (is_day()) { ?>
<h1>Archive for <?php the_time('F jS, Y'); ?></h1>
<?php } elseif (is_month()) { ?>
<h1>Archive for <?php the_time('F, Y'); ?></h1>
<?php } elseif (is_year()) { ?>
<h1>Archive for <?php the_time('Y'); ?></h1>
<?php } elseif (is_author()) { ?>
<h1>Author Archive</h1>
<?php } elseif (is_search()) { ?>
<h1>Search Results for “<?php the_search_query(); ?>”</h1>
<?php } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h1>Blog Archives</h1>
<?php } ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>">
<header>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<p>Posted on <?php the_time('F jS, Y'); ?> by <?php the_author(); ?></p>
</header>
<section>
<?php the_excerpt('Read more on "'.the_title('', '', false).'" »'); ?>
</section>
<footer>
<p><?php the_tags('Tags: ', ', ', '<br>'); ?> Posted in <?php the_category(', '); ?> • <?php edit_post_link('Edit', '', ' • '); ?> <?php comments_popup_link('Respond to this post »', '1 Response »', '% Responses »'); ?></p>
</footer>
</article>
<?php endwhile; ?>
<nav>
<p><?php posts_nav_link(' • '); ?></p>
</nav>
<?php else : ?>
<article>
<h1>Not Found</h1>
<p>Sorry, but the requested resource was not found on this site.</p>
<?php get_search_form(); ?>
</article>
<?php endif; ?>
</div> <!-- /.left-content -->
<?php get_sidebar(); ?>
</div><!-- /.wrapper -->
</section> <!-- /.main-body -->
<?php } // END - DISPLAY POSTS ON HOME, ARCHIVE AND SEARCH PAGES ?>
<?php
/* SINGLE ATTATCHMENT/IMAGE PAGE
*****************************************************/
if ( is_attachment() ) {
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<section class="main-body">
<div class="wrapper">
<div class="left-content">
<article id="post-<?php the_ID(); ?>">
<header>
<h1><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> » <?php the_title(); ?></h1>
<p><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p>
</header>
<section>
<?php if (!empty($post->post_excerpt)) the_excerpt(); // the caption ?>
<?php the_content('Read more on "'.the_title('', '', false).'" »'); ?>
<nav>
<p><?php previous_image_link(); ?> • <?php next_image_link(); ?></p>
</nav>
</section>
<footer>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
<p>
This entry was posted on <?php the_time('l, F jS, Y'); ?> at <?php the_time(); ?> and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// both comments and pings open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// only pings are open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// comments are open, pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// neither comments nor pings are open ?>
Both comments and pings are currently closed.
<?php } edit_post_link('Edit this entry','','.'); ?>
</p>
</footer>
</article>
<?php include_once('_next-previous-posts.php') ?>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<section>
<article>
<p>Sorry, no posts matched your criteria.</p>
</article>
</section>
<?php endif; ?>
</div> <!-- /.left-content -->
<?php get_sidebar(); ?>
</div> <!-- /.wrapper -->
</section> <!-- /.main-body -->
<?php } // END - SINGLE ATTATCHMENT/IMAGE PAGE ?>