Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 75 lines (66 sloc) 2.976 kb
0ee651c Some archive handling.
Dougal Campbell authored
1 <?php
2 /**
3 * The loop that displays archives.
4 *
5 * The loop displays the posts and the post content. See
6 * http://codex.wordpress.org/The_Loop to understand it and
7 * http://codex.wordpress.org/Template_Tags to understand
8 * the tags used in it.
9 *
10 * This can be overridden in child themes with loop.php or
11 * loop-template.php, where 'template' is the loop context
12 * requested by a template. For example, loop-index.php would
13 * be used if it exists and we ask for the loop with:
14 * <code>get_template_part( 'loop', 'index' );</code>
15 *
16 * @package WordPress
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
17 * @subpackage Formattd
ad89bf4 Changing current version to 0.1. Meant to do this before uploading to Gi...
Dougal Campbell authored
18 * @since Formattd 0.1
0ee651c Some archive handling.
Dougal Campbell authored
19 */
20 ?>
21
22 <?php /* Display navigation to next/previous pages when applicable */ ?>
23 <?php if ( $wp_query->max_num_pages > 1 ) : ?>
24 <nav id="nav-above" class="navigation">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
25 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'formattd' ) ); ?></div>
26 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'formattd' ) ); ?></div>
0ee651c Some archive handling.
Dougal Campbell authored
27 </nav><!-- #nav-above -->
28 <?php endif; ?>
29
30 <?php /* If there are no posts to display, such as an empty archive page */ ?>
31 <?php if ( ! have_posts() ) : ?>
32 <div id="post-0" class="post error404 not-found">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
33 <h1 class="entry-title"><?php _e( 'Not Found', 'formattd' ); ?></h1>
0ee651c Some archive handling.
Dougal Campbell authored
34 <div class="entry-content">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
35 <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'formattd' ); ?></p>
0ee651c Some archive handling.
Dougal Campbell authored
36 <?php get_search_form(); ?>
37 </div><!-- .entry-content -->
38 </div><!-- #post-0 -->
39 <?php endif; ?>
40
41 <?php
42 /* Start the Loop.
43 *
44 * In Intializr we use the same loop in multiple contexts.
45 * It is broken into three main parts: when we're displaying
46 * posts that are in the gallery category, when we're displaying
47 * posts in the asides category, and finally all other posts.
48 *
49 * Additionally, we sometimes check for whether we are on an
50 * archive page, a search page, etc., allowing for small differences
51 * in the loop on each template without actually duplicating
52 * the rest of the loop that is shared.
53 *
54 * Without further ado, the loop:
55 */ ?>
56 <?php while ( have_posts() ) : the_post();
57
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
58 $comment_number_template = _n( '1 Comments', '% Comments', get_comments_number(), 'formattd' );
0ee651c Some archive handling.
Dougal Campbell authored
59
60 // use a format template
61 $format = get_post_format();
62 if (! $format ) $format = 'standard';
63
64 get_template_part('format-archive', $format);
65
66 endwhile; // End the loop. Whew. ?>
67
68 <?php /* Display navigation to next/previous pages when applicable */ ?>
69 <?php if ( $wp_query->max_num_pages > 1 ) : ?>
70 <nav id="nav-below" class="navigation">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
71 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'formattd' ) ); ?></div>
72 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'formattd' ) ); ?></div>
0ee651c Some archive handling.
Dougal Campbell authored
73 </nav><!-- #nav-below -->
74 <?php endif; ?>
Something went wrong with that request. Please try again.