Support » Plugin: WordPress Infinite Scroll - Ajax Load More » I can not find where to insert [ajax_load_more]

  • Resolved rogeriodec

    (@rogeriodec)


    I apologize, but I could not see where to place the shortcode on my site, which is something quite simple.
    I just wanted to replace the “older posts” link in the bottom left corner for the site to do the infinite scroll, removing the limitation of 5 posts per page.
    Is there a simple way (preferably without touching the theme)?

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

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

    (@dcooney)

    Hi @rogeriodec,
    Unfortunately, Ajax Load More requires you to add the shortcode to a widget area, content editor or a page template for implementation.

    In your case you would need to directly modify the index.php or front-page.php template.

    Hope this helps.

    I inserted

    <?php echo do_shortcode('[ajax_load_more button_label="More Posts"]'); ?>

    in wp-content/themes/adventurous/index.php like this:

                <?php while ( have_posts() ) : the_post(); ?>
            
                    <?php
                        /* Include the Post-Format-specific template for the content.
                         * If you want to overload 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( 'content', get_post_format() );
    					<?php echo do_shortcode('[ajax_load_more button_label="More Posts"]'); ?>
                    ?>
            
                <?php endwhile; ?>

    But nothing changes. How can I do that?

    • This reply was modified 1 year, 3 months ago by  rogeriodec.
    Plugin Author dcooney

    (@dcooney)

    THat wont work due to PHP errors.

    Try this.

    
    <?php while ( have_posts() ) : the_post(); ?>
    <?php
    /* Include the Post-Format-specific template for the content.
    * If you want to overload 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( 'content', get_post_format() );
    ?>
    <?php endwhile; wp_reset_query(); ?>
    <?php echo do_shortcode('[ajax_load_more button_label="More Posts"]'); ?>
    

    Please note, you’ll need to offset Ajax Load More by the amount of posts loaded above the shortcode.
    <?php echo do_shortcode('[ajax_load_more button_label="More Posts" offset="5"]'); ?>

    • This reply was modified 1 year, 3 months ago by  dcooney.

    index.php looks like it is not the correct file for this. Even though I put a <? php echo "xxxxxxxxxxxxxxxxxx">; there to see if something appeared on the page but nothing appeared.
    This should be easier, is not it?
    Can you tell if there is any way to implement this correctly?

    Plugin Author dcooney

    (@dcooney)

    Well, which theme are you using?

    Plugin Author dcooney

    (@dcooney)

    Looks like home.php might be the correct template.
    https://themes.svn.wordpress.org/adventurous/1.9.3/home.php

    You’re right, thank you!
    However, if you can access my site now, you may notice that the first 5 posts appear correctly showing the videos, but the following posts show only the titles.
    How to fix this?

    Plugin Author dcooney

    (@dcooney)

    Update your Repeater Template to be.

    <div>
    <?php 
    global $post;
    get_template_part( 'content', get_post_format($post->ID) ); ?>
    </div>

    Now it’s perfect!
    Many thanks for your attention and your patience!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘I can not find where to insert [ajax_load_more]’ is closed to new replies.