• Ive written a custom template and custom query to fetch products. Ive added a text(an array has been printed) in the template( inside the loop). But in the second page(when the infinite scrolling triggers) the text is not showing .

    May I know why this happen?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Pablo Pérez

    (@pperez001)

    Hi there,

    I checked your page but I can’t see our plugin working in your site. Is it possible for us to replicate your issue in your site? Also if it is possible share with a screenshot of the selectors in the plugin.

    Have a great day.

    Thread Starter linjo13

    (@linjo13)

    @pperez001 Hello,

    I am using the YITH infinite scrolling plugin you can scroll down for the next page to load(via the plugin ) and you can see that.

    To make the issue more clearer, I’ve printed a “hai” inside the template, the hai is printing in the first page but not from the 2nd page(when the yith scrolling plugin comes into play.

    Please check this link to see whats happening

    Ive echoed the “hai” just before the wc_get_template_part( ‘content’, ‘product’)

    Please check the screenshot for a better understanding.

    Please let me know how we can get the “hai” printed before the loop template part.

    • This reply was modified 3 years, 1 month ago by linjo13.

    Hi there,

    you need to print that content inside the content-product.php file of your current theme.

    Usually, the theme should use a hook to print this custom code.

    You could try to add this custom code in the functions.php of your theme:

    add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_before_shop_loop_item_custom' );
    
    function woocommerce_before_shop_loop_item_custom() {
        echo 'hai';
    }

    Could you try it, please?

    Have a nice day!

    Thread Starter linjo13

    (@linjo13)

    @ivansosa Yes I got that, but I need the “hai” to be printed just before the li(pls refer the screenshot). What I am looking here is to print a category title before each group of items (so that it should be printed before li tag). Please guide



    Thanks

    Hi there,

    unfortunately, at the moment is not possible. Another way to do it is to use the solution I gave you previously and move all these elements to each parent element via JS.

    I hope it helps you.

    Have a nice day!

    Thread Starter linjo13

    (@linjo13)

    @ivansosa Okay, thanks for the reply. I will try that way with JS then. Hope you will consider this scenario as well in the next updates.

    Thread Starter linjo13

    (@linjo13)

    @ivansosa Can you pls guide where should I call my custom js? Like when the ajax for the next page load triggers? May I know where is that script?

    Hello there,

    I hope you’re doing well :D.

    I think you can use the following JS trigger

    yith_infs_added_elem

    For example you can use it in the following way

    jQuery(document).on( 'yith_infs_added_elem', function(){
    
     // show arrow up
    
    } );

    At the moment this is the trigger after the elements are added to the page.

    I hope it helps you.

    Have a good day.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Content inside custom Loop not working’ is closed to new replies.