Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So my issue is that I need to create two versions of a category.php template. Now, I know very well that if I want to display posts from just one category, I duplicate category.php and call it category-xx.php for the slug or ID number. Great. Got that.

The problem is the client wants it where on the first page of posts, only 4 posts appear. 6 on all subsequent pages. Worse, she wants a div with additional content to appear above the posts but only on the first page. So http://www.yoursite.com/category/whatever/page/2/ and /page/3/ look different than http://www.yoursite.com/category/whatever/.

Now I know I could use conditional comments like is_page() to specify a certain page to display let's say, a certain div. But how would I do it in this sense? Can I do it? There must be some kind of if...else statement that'll make this work.

share|improve this question

1 Answer 1

get_query_var('paged') will show you pagination information. The code below will show only on first page of archive

if(get_query_var('paged') == 1){
    //run extra code    
}
share|improve this answer
    
Works in informational way, but getting non-consistent amount of posts per page correcty is waaay more convoluted. :( –  Rarst Jun 25 '13 at 21:23

Your Answer

 
discard

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.