<?php get_header(); ?>

<div id="articles" class="section">
<h2 class="sectionheader">
<?php
$aOptions = SofaiBloggr::initOptions( false );
$readmore = ( strlen( $aOptions[ 'readmore' ] ) > 0 ) ? stripslashes( $aOptions[ 'readmore' ] ) : ' ...Read More';
$trim_text = ( strlen( $aOptions[ 'trim_text' ] ) > 0 ) ? stripslashes( $aOptions[ 'trim_text' ] ) : 25;

$categ_object = get_category( get_query_var( 'cat' ), false );
echo $categ_object->cat_name;
?>
</h2>
<?php 
if( have_posts() ) : 
echo '<ol class="post-list">';
while( have_posts() ) : the_post(); 
?>
	<li>
		<div class="postinfo">
			<span class="date"><?php the_time( 'M j, Y' ); ?></span>
			|
			<span class="category"><?php the_category( ', ' ); ?></span>

			<span class="comments-count"><?php comments_number( '0', '1', '%' ); ?></span>
		</div>
		<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
        <?php 
		$r_m = $readmore;
		$perma_link = get_permalink( $post->ID );
		$content = get_the_content();
		$content = apply_filters( 'the_content', $content );
		$content = str_replace( ']]>', ']]&gt;', $content );
		echo trim_the_content( $content, $r_m, $perma_link, (int)$trim_text, 1, 1 );
		?>
	</li>
<?php 
endwhile; 
echo '</ol>';
else : 
?>
<p>No articles in database!</p>
<?php endif; ?>

<div id="pagination">
	<?php 
    if( $wp_query->max_num_pages > 1 ) {
        // paging
        include( "wp-pagenavi.php" );
        if( function_exists( 'wp_pagenavi' ) ) { wp_pagenavi(); }
    } 
    ?>
</div><!-- pagination end -->

</div><!-- // articles end -->

<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Footer Category' ) ) : ?>
<?php endif; ?>

<?php get_footer(); ?>