Support » Plugin: WordPress Infinite Scroll - Ajax Load More » alm_localize is not defined

  • Resolved ebop

    (@ebop)


    Hello everyone, i’m trying to get the alm plugin to work, there is no content appearing on the page, but in the inspector i can see the div’s with the ‘ajax-load-more’ id’s. In the console i get the following: “alm_localize is not defined”. Any help would be much appreciated 🙂

    Here is the page code:

    <main id=”main” class=”site-main” role=”main”>
    <?php $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 15 );
    $loop = new WP_Query( $args ); ?>
    <?php if ( have_posts() ) : ?>

    <?php /* Start the Loop */ ?>

    <?php while ( $loop -> have_posts() ) : $loop -> the_post(); ?>

    <?php

    echo do_shortcode(‘[ajax_load_more post_type=”post” posts_per_page=”3″ transition=”fade”]’);
    ?>

    <?php endwhile;?>

    <?php else : ?>

    <?php get_template_part( ‘loop-templates/content’, ‘none’ ); ?>

    <?php endif; ?>

    </main><!– #main –>

    https://wordpress.org/plugins/ajax-load-more/

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

    (@dcooney)

    Hi ebop,
    Do you have wp_footer() in your footer.php file?

    Also, you don’t need the [ajax_load_more] shortcode wrapped in a while loop.

    You could do.

    <main id="main" class="site-main" role="main">
    <?php $args = array( 'post_type' => 'post', 'posts_per_page' => 15 );
    $loop = new WP_Query( $args ); ?>
    <?php if ( have_posts() ) : ?>
    <?php
    echo do_shortcode('[ajax_load_more post_type="post" posts_per_page="3" transition="fade"]');
    ?>
    <?php else : ?>
    <?php get_template_part( 'loop-templates/content', 'none' ); ?>
    <?php endif; ?>
    </main>

    Hi, thanks for the fast reply, yes I have the wp_footer in the footer file,
    tried your version, still nothing

    Plugin Author dcooney

    (@dcooney)

    Ok, can you share a link?

    Plugin Author dcooney

    (@dcooney)

    Thanjs.
    The ajax-load-more.js is not present on the page.

    jQuery is a required dependency for Ajax Load More… Enqueue jQuery and it should load.

    done and done, dcooney you’re the man

    in case anybody else encounters this problem, this is the function I added to my functions.php file in order for the Ajax Load More to work:

    if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
    function my_jquery_enqueue() {
        wp_deregister_script('jquery');
        wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
        wp_enqueue_script('jquery');
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

    btw, is there a way to use this plugin for comments too?
    thanks

    Plugin Author dcooney

    (@dcooney)

    Ok great!
    Yes- but addon required.

    Comments

    nice, thanks again, have a good one

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘alm_localize is not defined’ is closed to new replies.