WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find the best and easiest way of modifying my archive.php template to contain slider on top which slides the 4 first posts and the rest (6) will be displayed beneath as a regular posts.

it should work dynamically with one loop, meaning that if I am clicking on "Previous" or "next" posts and get the paged archive it should work normally and display the same structure starting with the 4 first (in that paged archive) in the slider continuing beneath it with 6 regular posts.

Also I need the name of the category on top but not including other categories which share the same posts!

It seems like a pretty simple Query. the only thing I am concerned bout is how to loop through the slider which contains 2 part: the 4 slider boxes on the right and the faded images on the left.

to better understand what I am trying to achieve here. here is an image I prepared to explain it:

enter image description here

would appreciate any help Thanks. Gil

share|improve this question

There are several ways of doing this. You could, for instance, incorporate a counter into your loop and treat the post data with respect to the counter's value.

$my_counter = 0;
while ( have_posts() ) : the_post();
if ( $my_counter <= 4 ) {
} else {
share|improve this answer
Anyway you can add the loop examples (Slider action and Regular posts action) to that code? I am not such an experienced developer. Thanks! – gil hamer Mar 5 '13 at 22:58
WPSE is not a work for me for free site. Your question is over-broad, but this answer covers the main part of the question: how to output the first four posts separately as a slider, followed by the remaining 6 posts. – Chip Bennett Mar 5 '13 at 23:23
I dont intend to use this site as a "work for me for free" as you mentioned. just wanted to have a small example no the whole code. for instance - how do I treat the slider? it has 2 <ul> lists which need to loop: The slider pictures and the text links that change the slider photos. what do I do in that case? any rough example? – gil hamer Mar 15 '13 at 16:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.