Pagination for the Magazine ThemeFebruary 7, 2014
Maybe you have a magazine-style WordPress theme with a slider at the top of the front page. The issue of pagination comes up when the user hits the Older Posts link.
Say you have a front page that displays 3 posts in the slider. The slider is a loop. Then a default loop that shows your most recent posts. And the number of posts is determined by the setting in your Settings -> Reading -> Blog pages show at most X posts.
First of all, you probably don’t want to load the same template for your back pages. You probably don’t want the slider on the back pages. By default, clicking the pagination link will load the same template, but give the default loop and ‘offset’ equal to number of posts in the Blog pages show at most setting. If you want second, and subsequent pages to skip the slider, and other front page stuff, and just show a list of posts, then you need a redirect to a different template.
This is the fix: duplicate index.php, and name it backpages.php.
Second, you need a redirect to backpages.php. It goes in the functions.php file.
Next we need to fix the pagination on backpages.php. Use this code before the default loop on backpages.php, which re-calculates the offset value to account for the number of posts in the slider: