Duplicate Posts – default.php
-
Hi. I’ve managed to configure the default.php template it works however it’s repeating existing posts over and over. Can you help please? Thanks
-
This topic was modified 2 years, 11 months ago by
digstertron.
-
This topic was modified 2 years, 11 months ago by
-
Hello @digstertron Sure, but I need more information to be able to even guess what the issue is.
- Can you share a link?
- Can you share your Repeater Template?
Hi, this is my code inside the default.php template file:
<?php $_posts = new WP_Query($args);?>
<main class=”fullwidth-blog”>
<div class=”bloglist”>
<?php while($_posts->have_posts()): $_posts->the_post();?>
<div class=”blog_list_outter”>
<div class=”post-grid”>
<h2 class=”blog_heading”>
<a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a>
</h2>
</div>
<div class=”blog_author”>
<div class=”author_image”><?php echo get_avatar( get_the_author_meta(‘ID’), 60); ?></div>
<div class=”author-profile-post”><?php the_author_posts_link();?></div>
</div>
<div class=”category_title”>
<div class=”category__list__card”>
<p class=”cat”>
<?php the_category(‘, ‘); ?>
</p>
</div>
<div class=”post__stamp”>
<?php the_time(‘F j, Y’); ?>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</main>
Ok this is incorrect.
Here are a few docs to get started with the plugin.
- https://connekthq.com/plugins/ajax-load-more/docs/implementation-guide/
- https://connekthq.com/plugins/ajax-load-more/docs/repeater-templates/
Ajax Load More creates a query for you, so you need to remove that remove your Repeater Template.
Your Repeater Template would be what’s between the
whileandendwhilein that template.If I remove the query the posts do not load and I have been through the documentation and followed the steps so I’m really at a total loss.
That’s how the plugin works and you’re using it incorrectly.
Please revert your Repeater Template to the default.
https://connekthq.com/plugins/ajax-load-more/docs/faqs/#how-can-i-restore-the-default-repeater-templateCreate a new page and drop the basic Ajax Load More shortcode onto it using the shortcode block.
[ajax_load_more]The problem with using the default code is I am using custom CSS for my Blog layout. The basic repeater template code works but visually it’s not matching my theme.
Yes I know. You said “If I remove the query the posts do not load“.
Im asking you test the default to see if anything loads.The default template works perfectly but when I apply custom CSS rules they are not being honoured specifically – .alm-listing .alm-reveal behaves of its own accord. My blog posts are displayed within a two column grid which Ajax is ignoring for the custom generated posts.
[ajax_load_more css_classes="fullwidth-blog" transition_container_classes="bloglist"]Apologies I realised I hadn’t set the transition container correctly. Sorry for the back and forth and many thanks for your help.
Thanks again 🙂
No worries. Sounds like it’s working… happy to hear that!
The topic ‘Duplicate Posts – default.php’ is closed to new replies.