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.

Ok so I have a blog on http://sergedenimes.com/blog/

The default template is a grid of images. I have a link in this page so if users want to switch to the normal list view they can click it. This just loads the page with a GET parameter that controls which template to load using this code:

<?php if ($_GET['blog_list'] == 1){
    include_once 'blog-list.php';
} else {
    include_once 'blog-grid.php';
} ?>

The trouble is with other pages... In grid view, only the 3 most recent posts are shown (+ some categories etc). But in list view there are previous/next links to go to older pages of posts. It seems that wordpress automatically appends the same GET parameter onto the end of the links link so: http://sergedenimes.com/blog/page/2/?blog_list=1.

This seems to result in the older pages not loading. I.e. the above url just reloads page 1, despite it saying page 2 in it.

The code is long for blog-grid.php and blog-list.php so here are links to pastebin.

My question is how do I solve this pagination issue. Should I try and fix the GET method or would it be better to make a brand new page and use completely separate templates for each view?

share|improve this question
add comment

Your Answer


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

Browse other questions tagged or ask your own question.