• Resolved uveananda

    (@uveananda)


    Hi,

    I am trying to get the loader to my home page where my posts are. Currently I have 10 posts per page and at the end of the page there is a “Older Posts” button which takes to page 2 and so on.
    I would like to have infinite scroll or a “Load More Posts” button with scrolling functionality instead of this button which takes to “page 2”.
    I am using Ramza Theme.
    I cannot find the correct place in my template files to paste the shortcode in php format (<?php echo do_shortcode(“[ajax_load_more]”); ?>). I have tried various places in index.php and header.php but the results were ridiculous and not correct at all.

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

    (@dcooney)

    Hi @uveananda,
    You need to locate your homepage loop and replace that with your ALM shortcode.

    Did you locate that loop?

    Cheers,

    Thread Starter uveananda

    (@uveananda)

    Hi,

    I found something like this in index.php:

    <?php if ( have_posts() ) : ?>

    <div class=”c-posts”>

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    Could you assit me where i have to paste my shortcode? Thank you.

    Plugin Author Darren Cooney

    (@dcooney)

    Without seeing the entire template, I think you could replace:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    // loop
    <?php endwhile; ?>

    With:

    <?php echo do_shortcode('[ajax_load_more']); ?>

    Thread Starter uveananda

    (@uveananda)

    Just in case, I’ll paste a longer version because it seems to be different thing than what you thought:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <?php
    /*
    * Include the Post-Format-specific template for the content.
    * If you want to override this in a child theme, then include a file
    * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    */
    get_template_part( ‘template-parts/content’, get_post_format() );
    ?>

    <?php endwhile; ?>

    <?php ramza_print_posts_nav(); ?>

    </div><!– .c-posts –>

    <?php else : ?>

    <?php get_template_part( ‘template-parts/content’, ‘none’ ); ?>

    <?php endif; ?>

    </main><!– .b-site-main –>

    Thank you.

    Plugin Author Darren Cooney

    (@dcooney)

    I think you can replace your while loop as I said above. Try it and let me know.

    Thread Starter uveananda

    (@uveananda)

    I’m still struggling to get it correctly. Whenever I paste it into the template, I get HTTP 500 error for my website.

    You suggested I replace:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    // loop
    <?php endwhile; ?>

    With:
    <?php echo do_shortcode('[ajax_load_more']); ?>

    Well, as I mentioned my code is not identical to the one you wrote as an example:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php
    /*
    * Include the Post-Format-specific template for the content.
    * If you want to override this in a child theme, then include a file
    * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    */
    get_template_part( ‘template-parts/content’, get_post_format() );
    ?>
    
    <?php endwhile; ?>

    So I replaced this part of the code:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    With:
    <?php echo do_shortcode('[ajax_load_more']); ?>
    And got the HTTP 500 error. I tried various different options as well but still got the error. Feeling a bit clueless as what to do now.

    Plugin Author Darren Cooney

    (@dcooney)

    Hey, no worries.
    If you want some help open a ticket here – https://connekthq.com/plugins/ajax-load-more/support/ and provide a link to the site so I can take a look.

    Cheers,

    Yeah, me too! I can’t find ANY information on how to actually implement this. I had to google the get any answers. You start of by talking about shortcodes and what have you … why not provide an example of how to use this (if you did, I sure wasn’t able to find it anywhere)?

    When I do the above I get a blank site … !?

    Why do things that are supposed to be very simply very often turn out to become a nightmare for some? Well, poor communication and a LOT of assumptions.

    Sorry, if I sound harsh – not meant to. But boy, do one seem to waste a lot of time getting other peoples stuff to work. : )

    OK, made the mistake of copy/pasting your code!

    You have a typo:

    <?php echo do_shortcode(‘[ajax_load_more’]); ?>

    Should be:
    <?php echo do_shortcode(‘[ajax_load_more]’); ?>
    (brackets inside quotes)

    But do I then have to restyle my whole site, as you replace the get_post_format() part that gererates output? Seems cumbersome.

    Can I disable the auto load function? And only have to manually have to click the button?

    Can I change the text on the button?

    Plugin Author Darren Cooney

    (@dcooney)

    Hi @blaasvaer,
    Yes, you can turn off auto load and change the button text. These are both shortcode parameters you can adjust with the shortcode builder.

    Hope that helps.

    Plugin Author Darren Cooney

    (@dcooney)

    like this;
    [ajax_load_more pause="true" button_label="My Custom Text"]

    Thanks, went for another solution, though. Spent way to much time digging around …

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Cannot get the loader on homepage correctly’ is closed to new replies.