• dado_it

    (@dado_it)


    Hi, this is my first post.
    I can not resolve my problem with taxonomy page.
    I’d like to hove just 5 post per page, this is my code

    <div id="content">
    
    <?php if (have_posts()) : ?>
     <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
      <div class="carbox clearfix" id="post-<?php the_ID(); ?>">
         <em>do something</em>
      </div>
     <?php endwhile; ?>
      <?php getpagenavi(); ?>
    <?php else : ?>
    	<h1 class="title">Not Found</h1>
    	<p>Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>

    Does anyone have a solution?
    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • vtxyzzy

    (@vtxyzzy)

    Try replacing this:

    <?php if (have_posts()) : ?>

    with this:

    <?php global $wp_query;
    query_posts(
       array_merge(
          $wp_query->query,
          array('posts_per_page' => 5)
       )
    );
    if (have_posts()) : ?>
    Thread Starter dado_it

    (@dado_it)

    Thanks, it works.
    But I don’t understand why the paginations doesn’t work.
    For the first result I have www.test.it/?condition=usato (and all it’s ok) but when I click on second page www.test.it/?condition=usato&paged=2 is a 404 not found page

    why?
    thanks a lot

    vtxyzzy

    (@vtxyzzy)

    I am not familiar with the getpagenavi() function.

    First, try adding the paged arg to the query. Change this:

    <?php global $wp_query;
    query_posts(
       array_merge(
          $wp_query->query,
          array('posts_per_page' => 5)
       )
    );

    to this:

    <?php global $wp_query;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts(
       array_merge(
          $wp_query->query,
          array('posts_per_page' => 5,
                'paged' => $paged )
       )
    );

    If that does not work, and you are using a free theme, post a link to its download site so I can examine the code. If it is a paid theme, you will need to ask the theme supplier.

    Thread Starter dado_it

    (@dado_it)

    thank you for helping me, but doesn’t work.
    Here you can download the free theme, the page is taxonomy.php
    gears

    many thanks

    vtxyzzy

    (@vtxyzzy)

    I don’t see anything obvious in the theme. Can you post a link to your site?

    Also, try saving the permalinks settings under Admin->Settings->Permalinks.

    Thread Starter dado_it

    (@dado_it)

    This is my site
    You can see the main menu on “minicar usage”, there is the taxonomy page where the paging doesn’t work.
    If you want I give you wp user to see the code
    Thanks

    vtxyzzy

    (@vtxyzzy)

    I still don’t see anything obvious. Please try setting the permalinks to the default.

    Thread Starter dado_it

    (@dado_it)

    permalinks is on default and doesn’t work
    see it

    have you an email so I send you the wpuser?

    vtxyzzy

    (@vtxyzzy)

    See my website here.

    Thread Starter dado_it

    (@dado_it)

    ok, you have a mail

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘limit taxonomy result’ is closed to new replies.