Support » Fixing WordPress » Problem with results page

  • Hi!

    I have a problem with the category/results template in my company’s website.

    To put it simply:

    – the results/category template page is coded to return a list of products.
    Have a look at this example (you don’t need to know Portuguese to understand it): http://www.audiolog.pt/produtos/fabricantes/art
    So, what you’re looking at his a category template page, which returns the listing of products for the selected category (in this case, a category called ART, which is the name of a manufacturer).

    – that template page is built to allow 8 results per page. If you have more results, then the usual “Next Products” link appears at the bottom to allow you to navigate;

    This is where I have my problem:

    1. If a category has *5 or less* products listed *in the second or subsequent pages* (this does not happen with the first page), then instead of showing the latest 3 results (for example), the user gets redirected to the null Search results page.

    Try for yourself, please.

    – Scroll down that page > click below on ‘Next Products’ (‘Produtos Seguintes’) > and when you are about to reach page 4, instead of having the last results presented, you get the “We couldn’t find anything” response-like.

    This happens with every category, as long as the list returns 5 or less results. If it has 6 results or more, then for some reason the page renders correctly.

    Any idea what might be causing this?

    Thanks.

    Best regards.
    André

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey, I’ve just read that you had a problem with the letter D, I wanted to tell you that I had the same problem and I found the answer to that. A lot a search engines in php user the function strpos or stripos. The thing is that when you compare you have to use three equals and the boolean value, for example:
    if(strpos($string,$substring)!===false)

    Regards,
    Diego

    Hi Diego.

    Thanks for your message.
    This problem was solved a few months ago with some WordPress update.
    But anyway, it’s good to finally understand the cause behind it.
    Thanks!

    Best regards.

    Toscano

    Hi Toscano !!!

    Use wp_query() or query_post() for listing and use following things for pagination for better pagination.

    <?php next_posts_link( __( ‘<span class=”meta-nav”>←</span> Older posts’, ‘theme_name’ ) ); ?>
    <?php previous_posts_link( __( ‘Newer posts <span class=”meta-nav”>→</span>’, ‘theme_name’ ) ); ?>

    Thnaks.

    sorry, I made a mistake in my original post: instead of the classic !=, you have to use !==

    for example:

    if(strpos($string,$substring)!==false)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with results page’ is closed to new replies.