<?php get_header(); ?>
<div id="container">
<?php get_sidebar(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post">
<div class="header">
<h1><?php the_date(); ?></h2>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php
$attachments = attachments_get_attachments();
$total_attachments = count($attachments);
?>
<?php if( $total_attachments > 0 ) : ?>
<ul class="attachments">
<h3>Attachments:</h3>
<?php for ($i=0; $i < $total_attachments; $i++) : ?>
<li>
<a href="<?php echo $attachments[$i]['location']; ?>"><?php echo $attachments[$i]['title']; ?></a>
</li>
<?php endfor ?>
</ul>
<?php endif ?>
</div>
<div class="content">
<?php the_content(); ?>
</div>
<div class="footer">
<p class="category">
Categories: <?php the_category(', '); ?>
</p>
<?php if (is_user_logged_in()) : ?>
<ul class="admin">
<?php edit_post_link(); ?>
</ul>
<?php endif; ?>
</div>
</div>
<?php endwhile; else: ?>
<!-- No posts in query. -->
<?php endif; ?>
</div>
<?php get_footer(); ?>