I am trying to get my homepage on wordpress to show the latest blog updates.
I want it to show any post categoried as "featured" at the top of the page, with a limit of showing 2 featured posts.
Underneath this I want to show the latest blog updates from anything outside the featured category, with a limit of 5 posts.
Unfortunately I don't have a clue about php so I'm using total guesswork to try and get this to work, and so far I'm failing. Here is my code:
Currently the break counter on the top div is also breaking the content in the bottom div, when I want these to have seperate counts independent of each other.
Can anyone help me out and show me where I'm going wrong? Your help would be much appreciated!
I want it to show any post categoried as "featured" at the top of the page, with a limit of showing 2 featured posts.
Underneath this I want to show the latest blog updates from anything outside the featured category, with a limit of 5 posts.
Unfortunately I don't have a clue about php so I'm using total guesswork to try and get this to work, and so far I'm failing. Here is my code:
Code:
<div id="home-area">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if ( !in_category('featured') && !is_single() ) continue; ?>
<?php static $count1 = 0;
if ($count1 == "2") { break; }
else { ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<div class="featured">
<div class="read-more"><a href="<?php the_permalink() ?>"></a></div>
<div class="posted-info">
Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?> </div>
<div class="featured-title"></div>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
</article>
<?php $count1++; } ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div id="home-area2">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if ( in_category('featured') && !is_single() ) continue; ?>
<?php static $count2 = 0;
if ($count2 == "5") { break; }
else { ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<div class="brief-news">
<div class="read-more"><a href="<?php the_permalink() ?>"></a></div>
<div class="posted-info">
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?>
</div>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
</article>
<?php $count2++; } ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
Currently the break counter on the top div is also breaking the content in the bottom div, when I want these to have seperate counts independent of each other.
Can anyone help me out and show me where I'm going wrong? Your help would be much appreciated!