• Resolved elba00

    (@elba00)


    Hello,

    Plugins version: 3.0
    JS loaded after jQuery, CSS loaded as well, no errors/warnings in console.

    I can’t figure out why I’m getting an empty div, here is my setup:
    I’m using the shortcode in a custom php template where I used to query custom post type posts with many different custom fields.

    Now I’m just trying to echo post titles as a test with the following in the repeater:

    <div class="col-lg-4">
       <div class="blog-post flex-col">
          <?php the_title(); ?>       
       </div>
    </div>

    If I understand right the shortcode deals with the query and it needs to be pasted in the loop like this:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php echo do_shortcode(' [ajax_load_more id="5979198204" container_type="div"  post_type="books" posts_per_page="6" scroll_distance="350" max_pages="3" transition="none" images_loaded="true"] ') ?>
    <?php endwhile; endif; ?>

    The resulting div ‘alm-listing alm-ajax’ with the attributes I set up with the shortcode is empty. Also the button or loader element is not present in the page source.

    There must be something I don’t see right now, could please point me to the right direction?

    Thank your for the plugin.

    • This topic was modified 7 years, 10 months ago by elba00. Reason: grammar
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @elba00,
    Looks good, except for you don’t need the if(), while() loop. Ajax Load More takes care of that.

    Try removing that and let me know.

    
    <?php echo do_shortcode(' [ajax_load_more id="5979198204" container_type="div"  post_type="books" posts_per_page="6" scroll_distance="350" max_pages="3" transition="none" images_loaded="true"] ') ?>

    Cheers,

    Thread Starter elba00

    (@elba00)

    Thank you for your swift reply.

    It turns out that I had a function that deregistered the default jQuery script, I removed that and the plugin works like a charm.

    Slighty out of topic: Is there any way to add class names to the alm-reveal element besides ajax-load-more?

    Beautifully crafted plugin, keep up the good work!

    Thank you.

    Plugin Author Darren Cooney

    (@dcooney)

    Ok great!
    No, that element doesn’t have a way to add class names ??

    Thread Starter elba00

    (@elba00)

    Ok, thanks again, I just adjust my CSS then.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Empty result on custom page template’ is closed to new replies.