I think you can use the “get_posts()” template tag. get_posts('numberposts=5')
for the 1st row,
get_posts('numberposts=5&offset=5')
for the 2nd
get_posts('numberposts=5&offset=10')
for the 3rd, etc.
putting <div>
or <br />
in between.
Have a look here:
http://codex.wordpress.org/Template_Tags/get_posts
hey
thanks a lot:D
I try now
Ugh! A better way would be to just keep a loop counter.
// code to get 25 posts
$counter=1;
// start of the loop
if ($counter!=5) $counter++;
else
{
// do your output of a br or what have you
$counter = 1; // reset counter
}
// end of your post loop
thanks otto,
I just have problem with the previous solution,
it ends up like this:
http://chandamon.com/YL/?cat=1
now I try yours, thanks a lot.
Hello Otto42, I know it is too rude and too much for me to ask so, but I really appreciate if you can help me with the codes I am using below by the method u provide…It is just perfect if you can show me exactly how I can I do it…
I am really new to php, and I dont understand how the_post() works, so i dont really know how to implement the code you provided to this case…
can you please do me favor? Since I am really in a hurry, sorry.
Thanks for your kindly help .
<?php while (have_posts()) : the_post(); ?>
<div class=”substory_frame”>
<div class=”substory” id=”left”>
<h3 class=”substory_subhead”><?php the_time(‘j F Y’); ?></h3>
<h3 class=”substory_head”>” rel=”bookmark”>
<?php the_title(); ?>
</h3>
<?php the_excerpt(); ?>
<h4 class=”comments”>” rel=”bookmark”>
全文… »
</h4>
</div>
<?php endwhile; ?>
</div>
Like so:
<?php
$counter = 1;
while (have_posts()) : the_post();
?>
<div class="substory_frame">
... all the other stuff here ...
</div>
<?php
if ($counter != 5) $counter++;
else {
echo '';
$counter=1;
}
endwhile;
?>
...
Or something similar to that. You’ll need to make the page show 25 posts at once though. You can do that by setting the post number to 25 in the options, but that will affect the whole site.
Thanks a lot:D
you are really nice:)
yes
currently I am stuck in the problem with the preset post number….
Since I would like to have different numbers of posts in different archives and pages….
Add this before the “while” line then:
query_posts($query_string . "&showposts=25");
That will set it to 25 posts for that particular page only. You can put different ones on different types of pages to change the numbers for each page.