WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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(); ?>
share|improve this answer

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.

share|improve this answer
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 Mar 5 '12 at 23:01

Your Answer


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

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