简体   繁体   中英

Wordpress ajax load more plugin

For my current Wordpress project I'm using the 'ajax load more' plugin: http://connekthq.com/plugins/ajax-load-more/

I bought the add on for using more then one repeater template. But I'am having some issues.

First let me explain the situation.

On page one I'm using this plugin using the "default" repeater template. Everything works fine in here.

On the second page I'm using this plugin using the "template_2" repeater template. This works fine for the first record that is loaded but not for the rest.

For the first one it uses the "template_2" repeater for all the other records is is using the "default" repeater template and I can't figure out wy.

I noticed the issue because my block sizes where not correct. So I made the titles of my articles static for both templates. I load 5 records at a time extra. The first one get's the title of the expected repeater template but all the rest of my records the one one the default one and I can't figure out why.

The short code I use on the second page:

echo do_shortcode('[ajax_load_more repeater="template_2" post_type="post, external_urls, files, infographics, quotes, tweets, videos, audios" taxonomy="stories" taxonomy_terms="'.$scenario->slug.'" posts_per_page="5" scroll="false" transition="fade" images_loaded="false" button_label="Next Page" offset="5" max_pages="100" button_label="Show more" pause="true" scroll_distance="100" pause_override="false"]');

I hope somebody can help me solve this problem, the deadline is pretty close and I really need to fix this problem.

For the record my Wordpress version is: 4.3.1

I came across the same issue and it turned out that I was using variable names in my repeater template that conflicted with variable names inside of the Ajax Load More plugin itself.

I had a variable called $type which I was setting to the post type inside of the repeater. This caused an override of ALM's own $type variable inside of the plugin once it was loading my repeater.

When using custom repeaters, the ALM type variable is set to "template_", and my repeater code was setting it to the current post type.

Post your repeater code so we can check to see if you are using any variable names inside of your repeater that could interfere with ALM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM