• Resolved pauti12

    (@pauti12)


    Hi,
    Do you know how can I get the code to paste it in my file.php instead of the shortcode?

    I’ve tried with <?php //echo do_shortcode(‘[shortcode”]’); ?> but when the page is loaded, the shortcode works automatically instead of clicking it when needed.

    Thank you

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

    (@dcooney)

    Not sure what you mean it works automatically?

    Maybe you just need to set pause="true" in your shortcode? Have a look at the shortcode parameters,
    https://connekthq.com/plugins/ajax-load-more/docs/shortcode-parameters/

    Thread Starter pauti12

    (@pauti12)

    Yes! That was what I was looking for. Thank you

    Also, I was modifying the Repeater Template, but it’s not working. Could it be because it doesn’t read JavaScript actions that I have on my files.php?

    I was doing something like this:

    <?php if (in_category(‘example’)) { ?>

    <div class=”show-hide”>
    <div class=”excerpt”><?php the_excerpt(); ?></div>
    <div class=”content”><?php the_content(); ?></div>
    </div>

    <?php endif; ?>

    The “show-hide” tag is calling a script. This works on my theme, but it doesn’t work when I click the Load more button. It just displays all the content…

    Thank you

    Plugin Author Darren Cooney

    (@dcooney)

    When using javascript with ajax content you need to use the .on() function.

    $(document).on('click', '.my_item', function(){
       alert("Do Something!");
    });
    Thread Starter pauti12

    (@pauti12)

    Yes, I know. But I didn’t know that I could add JavaScript on the Repeater Template, so I tried it and now it’s working.
    Thanks!

    Plugin Author Darren Cooney

    (@dcooney)

    Ok great!

    Thread Starter pauti12

    (@pauti12)

    Hello,
    I don’t know why but the plugin is not working correctly on my page.
    On the static page I show 5 posts and then, when I click “load more” it shows all the posts, but also the ones that were showing on the static page, so they appear twice…
    Could you help me with this? My code is below:

    <?php
    $first_loop = array(
    ‘posts_per_page’ => 5,
    ‘cat’ => array(6,7,8,9),
    );
    ?>

    <section class=”two-columns_updates”>
    <div class=”row1″>
    <article class=”left-column”>

    <?php $the_query = new WP_Query( $first_loop ); ?>
    <?php if ( $the_query->have_posts() ) : ?>

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

    <article id=”post-<?php the_ID(); ?>” class=”article <?php post_class(); ?>” >
    // Displays the post
    </article>

    <?php endwhile; ?>

    <?php wp_reset_postdata(); ?>

    <?php else : ?>
    <p><?php _e( ‘Sorry, no posts matched your criteria.’ ); ?></p>
    <?php endif; ?>

    <?php echo do_shortcode(‘[ajax_load_more post_type=”post” category__not_in=”16″ pause=”true” pause_override=”true”]’); ?>

    </div></section>

    Thank you!

    Plugin Author Darren Cooney

    (@dcooney)

    Add offset=”5″ to your shortcode to offset the loading.

    Thread Starter pauti12

    (@pauti12)

    No, it’s doesn’t work… I still have the same issue…

    Plugin Author Darren Cooney

    (@dcooney)

    Well that is the issue, so make sure your ordering and queries almost the same.

    Because right now, I can see they are different.

    The first query is pulling from 4 categories, the ALM query is pulling from all cats except for 1.

    Thread Starter pauti12

    (@pauti12)

    You were right! It’s solved just adding offset=”5″
    The problem was that it wasn’t working because I pasted your quotes and they weren’t the correct ones!

    Congratulations for the plugin, it is exactly what I was looking for

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Get the code to paste it in my file.php instead of the shortcode’ is closed to new replies.