<?php get_header(); ?>
<!--include sidebar-->
<?php include(TEMPLATEPATH."/l_sidebar.php");?>
<div id="content">
<!--archive.php-->
<!-- Below for alphabetical listing at top of each page -->
<?php ?>
<br />
<?php
$query = "SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) LEFT OUTER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = 'lastname') WHERE 1=1 AND wp_term_taxonomy.taxonomy = 'category' AND wp_term_taxonomy.term_id IN ('5') AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY COALESCE(wp_postmeta.meta_value, post_title) ASC, post_title ASC";
$pageposts = $wpdb->get_results($query, OBJECT);
?>
<?php if ( $pageposts ) : ?>
<h1><?php $post = $posts[0]; ?>
<?php if (is_category()) { ?>
<?php echo single_cat_title(); ?>
<?php } elseif (is_day()) { ?>
Archive for <?php the_time('F jS, Y'); ?>
<?php } elseif (is_month()) { ?>
Archive for <?php the_time('F, Y'); ?>
<?php } elseif (is_year()) { ?>
Archive for <?php the_time('Y'); ?>
<?php } elseif (is_search()) { ?>
Search Results
<?php } elseif (is_author()) { ?>
Author Archive
<?php } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
Blog Archives
<?php } ?>
</h1>
<?php foreach ($pageposts as $post) : setup_postdata($post); ?>
<div id="post-<?php the_ID(); ?>" class="thumbnail">
<a href="<?php echo get_permalink() ?>" class="thumbnailer" rel="bookmark" title="<?php the_title(); ?>"><h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3><span><img src="<?php echo get_post_meta($post->ID, "Thumbnail", true); ?>" /></span></a>
</div>
<?php endforeach; ?>
<!-- Previous/Next page navigation -->
<div class="page-nav">
<div class="nav-new"><?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
</div>
<!-- Remove this becuase the new plugin displays page numbers
<div class="nav-next"><?php ?>
</div> -->
</div>
<?php else : ?>
<h3>Page Not Found</h3>
<p>We're sorry, but the page you are looking for isn't here.</p>
<p>Try searching for the page you are looking for or using the navigation in the header or sidebar</p>
<?php endif; ?>
<!--archive.php end-->
</div>
<!--include footer-->
<?php get_footer(); ?>