Return to Snippet

Revision: 8803
at October 8, 2008 18:54 by Tate


Initial Code
<?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.
		else
			$offsetting = 2;

		// Plug it into our query.
		query_posts($query_string . "&offset=$offsetting");
	}
?>

Initial URL
http://pastebin.com/f318db5f3

Initial Description

                                

Initial Title
Show different amount of posts on Wordpress home page than other pages

Initial Tags

                                

Initial Language
PHP