Having some issues on the tag.php page.

Right now it just give me a "nothing to show" If I have no query it shows posts, but I want to change the number of posts per page.

Changing the reading settings in the admin is not an option in this case, so I'm looking for template tag ideas only.

Any suggestions on ways to re-write this properly?

Thanks, sorry if this question is really boring.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $tags = array(
    'posts_per_page' => 10,
    'paged' =>$paged

    <?php query_posts($tags); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Just as an edit: I am looking for some syntax help to write some code for posts_per_page and pagination that is structured for just a plain wordpress loop.

Thanks, sorry if it was a bit confusing.

2 Answers 2


After some other attempts I Found the syntax solution I was looking for. Just sharing.

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

      query_posts($query_string .'&posts_per_page=10&paged=' . $paged);

      if (have_posts()) : while (have_posts()) : the_post(); ?>

Hope this help

$story_type = $_GET['type'];
if ( get_query_var('paged') ) {
    $paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
    $paged = get_query_var('page');
} else {
    $paged = 1;
$alt_query = array (
    'tax_query' => array(
            'taxonomy' => 'lot-term',
            'terms' => $story_type,
            'field' => 'slug',
    'post-type' => 'story',
    'paged' => $paged

Just copy pasted from my recent work. Just change the 'tax_query' with your own tag query & the 'post_type' value.

  • Hmm, this seems like you are query-ing a specific taxonomy. I don't want to do that in this case. I just want to find a better way to write pagination and posts_per_page on a boring old normal "if have posts" wordpress loop. ie: write in pagination without using a custom query. I guess I was't clear enough.
    – Nadine
    Commented Mar 5, 2012 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.