WordPress.org

Ready to get started?Download WordPress

Forums

limit taxonomy result (11 posts)

  1. dado_it
    Member
    Posted 1 year ago #

    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

  2. vtxyzzy
    Member
    Posted 1 year ago #

    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()) : ?>
  3. dado_it
    Member
    Posted 1 year ago #

    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

  4. vtxyzzy
    Member
    Posted 1 year ago #

    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.

  5. dado_it
    Member
    Posted 1 year ago #

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

    many thanks

  6. vtxyzzy
    Member
    Posted 1 year ago #

    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.

  7. dado_it
    Member
    Posted 1 year ago #

    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

  8. vtxyzzy
    Member
    Posted 1 year ago #

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

  9. dado_it
    Member
    Posted 1 year ago #

    permalinks is on default and doesn't work
    see it

    have you an email so I send you the wpuser?

  10. vtxyzzy
    Member
    Posted 1 year ago #

    See my website here.

  11. dado_it
    Member
    Posted 1 year ago #

    ok, you have a mail

Topic Closed

This topic has been closed to new replies.

About this Topic