Skip to content

Instantly share code, notes, and snippets.

@NickToye
Created September 3, 2012 19:52
Show Gist options
  • Save NickToye/3612854 to your computer and use it in GitHub Desktop.
Save NickToye/3612854 to your computer and use it in GitHub Desktop.
<?php
/**
* The loop that displays posts.
*
* The loop displays the posts and the post content. See
* http://codex.wordpress.org/The_Loop to understand it and
* http://codex.wordpress.org/Template_Tags to understand
* the tags used in it.
*
* This can be overridden in child themes with loop.php or
* loop-template.php, where 'template' is the loop context
* requested by a template. For example, loop-index.php would
* be used if it exists and we ask for the loop with:
* <code>get_template_part( 'loop', 'index' );</code>
*
* @package WordPress
* @subpackage Starkers
* @since Starkers 3.0
*/
?>
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<?php next_posts_link( __( '&larr; Older posts', 'twentyten' ) ); ?>
<?php previous_posts_link( __( 'Newer posts &rarr;', 'twentyten' ) ); ?>
<?php endif; ?>
<?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( ! have_posts() ) : ?>
<h1><?php _e( 'Not Found', 'twentyten' ); ?></h1>
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
<?php get_search_form(); ?>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php /* How to display posts in the Gallery category. */ ?>
<?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php twentyten_posted_on(); ?>
<?php if ( post_password_required() ) : ?>
<?php the_content(); ?>
<?php else : ?>
<a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
<p><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
$total_images
); ?></p>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '|', '' ); ?>
<?php else : ?>
<div class="concert">
<div class="poster">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
set_post_thumbnail_size( 300, 225, true );
}
?>
</div>
<p class="venue"><?php echo get_post_meta($post->ID, 'venue', true);?>
<p class="date-time"><?php echo get_post_meta($post->ID, 'date', true)?> <?php echo get_post_meta($post->ID, 'time', true)?>
<div class="music">
<?php echo get_field('music');?>
</div>
<p class="conductor">Conductor - <?php echo get_post_meta($post->ID, 'conductor', true);?></p>
<div class="musicians">
<?php echo get_field('musicians');?>
</div>
</div>
<?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
<?php endwhile; // End the loop. Whew. ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment