Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 102 lines (91 sloc) 4.625 kb
4325847 Single and comment templates.
Dougal Campbell authored
1 <?php
2 /**
3 * The loop that displays posts.
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
4325847 Single and comment templates.
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>
4325847 Single and comment templates.
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>
4325847 Single and comment templates.
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>
4325847 Single and comment templates.
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' );
4325847 Single and comment templates.
Dougal Campbell authored
59 // use a format template
60 $format = get_post_format();
61 get_template_part('format', $format);
62
63 if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries ?>
9c4bc4c Dougal Campbell Fix some hfeed microformat bits.
authored
64 <div id="entry-author-info" class="vcard author">
4325847 Single and comment templates.
Dougal Campbell authored
65 <div id="author-avatar">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
66 <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'formattd_author_bio_avatar_size', 60 ) ); ?>
4325847 Single and comment templates.
Dougal Campbell authored
67 </div><!-- #author-avatar -->
68 <div id="author-description">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
69 <h2><?php printf( esc_attr__( 'About %s', 'formattd' ), get_the_author() ); ?></h2>
4325847 Single and comment templates.
Dougal Campbell authored
70 <?php the_author_meta( 'description' ); ?>
71 <div id="author-link">
9c4bc4c Dougal Campbell Fix some hfeed microformat bits.
authored
72 <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" rel="author" class="url">
f42de7a Dougal Campbell More vcard tweaks.
authored
73 <?php printf( __( 'View all posts by <span class="fn n">%s</span> <span class="meta-nav">&rarr;</span>', 'formattd' ), get_the_author() ); ?>
4325847 Single and comment templates.
Dougal Campbell authored
74 </a>
75 </div><!-- #author-link -->
76 </div><!-- #author-description -->
77 </div><!-- #entry-author-info -->
78 <?php endif; ?>
79
80 <div class="entry-utility">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
81 <?php formattd_posted_in(); ?>
82 <?php edit_post_link( __( 'Edit', 'formattd' ), '<span class="edit-link">', '</span>' ); ?>
4325847 Single and comment templates.
Dougal Campbell authored
83 </div><!-- .entry-utility -->
84
85 <div id="nav-below" class="navigation">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
86 <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'formattd' ) . '</span> %title' ); ?></div>
87 <div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'formattd' ) . '</span>' ); ?></div>
4325847 Single and comment templates.
Dougal Campbell authored
88 </div><!-- #nav-below -->
7d1d547 Widget area redux.
Dougal Campbell authored
89 <?php get_sidebar( 'single-insert' ); ?>
4325847 Single and comment templates.
Dougal Campbell authored
90 <?php comments_template( '', true ); ?>
91
92
93 <?php endwhile; // End the loop. Whew. ?>
94
95 <?php /* Display navigation to next/previous pages when applicable */ ?>
96 <?php if ( $wp_query->max_num_pages > 1 ) : ?>
97 <nav id="nav-below" class="navigation">
6f21dc3 Renaming from 'initializr' to 'formattd'.
Dougal Campbell authored
98 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'formattd' ) ); ?></div>
99 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'formattd' ) ); ?></div>
4325847 Single and comment templates.
Dougal Campbell authored
100 </nav><!-- #nav-below -->
101 <?php endif; ?>
Something went wrong with that request. Please try again.