• Resolved kureeru

    (@kureeru)


    Hello,

    I have an issue with the search by categories results.

    First of all, the search did very well in localhost and when I pulled my website into preprod the search by category didn’t work anymore.
    Here is the code that I display :

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>
     <?php endwhile; ?>
     <?php 
        $cat = get_query_var('cat');
        $category = get_category ($cat);
        echo do_shortcode('[ajax_load_more category="'.$category->slug.'" cache="true" cache_id="cache-'.$category->slug.'" seo="true" post_type="post" posts_per_page="6" scroll="false" button_label="Voir plus d\'articles" button_loading_label="Chargement..."]');
      ?>
      <?php else : ?>
        <p><?php echo 'No results'; ?></p>
      <?php endif; ?>

    I tried to replace this code by the code in the repeater template and it worked, so the error seems to come by the plugin.

    In my page, nothing is displayed after the div which is supposed to contain the articles, nothing appears in the code (the #ajax-load-more div isn’t here) and there is no error in the console.

    Can you help me with this?

    Have a nice day

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @kureeru,
    Is this a category archive?

    I removed the while loop from the query:

    <?php if ( have_posts() ) :	
     $cat = get_query_var('cat');
     $category = get_category ($cat);
     echo do_shortcode('[ajax_load_more category="'.$category->slug.'" seo="true" post_type="post" posts_per_page="6" scroll="false" button_label="Voir plus d\'articles" button_loading_label="Chargement..."]');
    ?>
    <?php else : ?>
     <p><?php echo 'No results'; ?></p>
    <?php endif; ?>
    Plugin Author Darren Cooney

    (@dcooney)

    Thread Starter kureeru

    (@kureeru)

    Hi @dcooney,

    Thanks for your help!

    Yes it’s a category archive, sorry I forgot to precise it!
    I tried your code and the link above but it doesn’t seem to solve the issue unfortunately.

    Plugin Author Darren Cooney

    (@dcooney)

    I’ll need to see a link please.

    Thread Starter kureeru

    (@kureeru)

    Of course (I’ll edit it when the problem is solved) :

    • This reply was modified 5 years, 11 months ago by kureeru. Reason: website url
    Plugin Author Darren Cooney

    (@dcooney)

    I think you have something wrong with your site.
    check your error_log. The site is not completing the load.

    • This reply was modified 5 years, 11 months ago by Darren Cooney.
    Thread Starter kureeru

    (@kureeru)

    The website was loading right when I tried to remove the shortcode and put the template repeater code instead.
    It’s that way that I found that the Ajax load more code seems to stop the loading of the page.
    Without this code, the page is fully loaded.

    Plugin Author Darren Cooney

    (@dcooney)

    Probably an issue in your Repeater template then.

    Thread Starter kureeru

    (@kureeru)

    I use it for search page by term and for loading articles and there is no issue in these pages, the archive category page is the only one that doesn’t work.
    Tried to copy/paste all the code in the page you linked, and it seems to work finaly (I supposed I did it wrong the last time).

    Thank you for your help!
    Can I ask you to remove the link to my website in your previous post please?

    Thanks a lot again, have a nice day!

    Plugin Author Darren Cooney

    (@dcooney)

    Ok great! Link removed ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Search by category doesn’t work’ is closed to new replies.