groups

name language licence
truncate a wordpress post - PHP - Snipplr PHP BSD
CUSTOM TEMPLATES FOR POSTS IN WORDPRESS PHP BSD
SHOW DIFFERENT AMOUNT OF POSTS ON WORDPRESS HOME PAGE THAN OTHER PAGES PHP BSD
ANAGE MULTIPLE WORDPRESS SITES WITH ONE DATABASE AND ONE CODE BASE PHP BSD
WORDPRESS QUERY POSTS OF CERTAIN CUSTOM FIELD VALUES PHP BSD
WORDPRESS LOAD JQUERY PHP BSD
WORDPRESS GET CONTENT PHP BSD
WORDPRESS: LATEST POSTS FROM CATEGORY PHP BSD

< 1 2 3 4 5 6 7 8 9 >



language: PHP
licence: BSD

SHOW DIFFERENT AMOUNT OF POSTS ON WORDPRESS HOME PAGE THAN OTHER PAGES

options: view full snippetsend to code collector
//URL: http://pastebin.com/f318db5f3

<?php
	// If we're on the index page, we only want the two first posts.
	if ( is_home() && !is_paged() )
		query_posts('posts_per_page=2');
 
	// If we're within the index archives, we want ten posts per page as usual.
	else {
		// If we are past the second page, offset by an appropriate amount for the page.
		// I'm by no means a math guru; I don't know why this works. Trial & error rocks!
		if ( get_query_var('paged') != 2 )
			$offsetting = 2 + ( ( get_query_var('paged') - 2 ) * get_query_var('posts_per_page') );
 
		// If we're on the second page, offset by two.
	
(Continues...)