I understand php enough to get my self into trouble. Right now I'm in trouble. I want to pull 3 posts from a category by using a while loop. Right now it doesn't limit it to 3. What am I doing wrong?
Here's the code.
<?php query_posts('cat=4'); ?>
<?php if (have_posts()) : $count = 0; ?>
<?php while (have_posts()) : the_post(); $count <= 2; $count++; ?>
<h4>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></h4>
<p class="post-details"><?php _e('Posted on',woothemes); ?> <?php the_time('d. M, Y'); ?> | " rel="bookmark" title="Read More">Read More
<hr />
<?php endwhile; ?>
<?php endif; ?>
Part of it was missing. Nothing crucial but wanted to re-post.
<?php query_posts('cat=4'); ?>
<?php if (have_posts()) : $count = 0; ?>
<?php while (have_posts()) : the_post(); $count <= 2; $count++; ?>
<h4>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></h4>
<p class="post-details"><?php _e('Posted on',woothemes); ?> <?php the_time('d. M, Y'); ?> | " rel="bookmark" title="Read More">Read More
<hr />
<?php endwhile; ?>
<?php endif; ?>
Never mind. it's just making links when I post because of the href's
I solved it. If anyone finds this down the road. This is what I did.
Added this to the query: &posts_per_page=3
So now it looks like this:
<?php query_posts('cat=4&posts_per_page=3'); ?>
<?php if (have_posts()) : $count = 0; ?>
<?php while (have_posts()) : the_post(); $count <= 2; $count++; ?>
mrkeroppi
Member
Posted 1 year ago #
Seeing as this thread was so lonely, thought I would just say thanks KX254F.