I have an unusual one here. I wish to use this plugin to load more posts after the first 12. To give you some idea here is my very custom loop.php page…
<div id="column_01">
<!-- First Loop: Display post 1 -->
<?php query_posts('showposts=2'); ?>
<?php $posts = get_posts('numberposts=2&offset=0'); foreach ($posts as $post) : start_wp(); ?>
<?php static $count1 = 0; if ($count1 == "2") {break;} else { ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>">
<div class="the-title">
<h2>
<?php the_title(); ?>
</h2>
</div>
<div class="img-container">
<figure>
<!-- The Post Thumbnail -->
<?php if(has_post_thumbnail()) : ?>
<?php the_post_thumbnail('bloglanding-post-thumbnail'); ?>
<?php endif; ?>
</figure>
</div>
</a>
<div class="socialWarf"><?php social_warfare(); ?></div>
</article>
<?php $count1++; } ?>
<?php endforeach; ?>
</div>
After this first Column I have a further 3 more showing the latest 12 posts. After that I want to rest using this plugin. The repeater template I tries to use this this…..
<?php query_posts('showposts=6'); ?>
<?php $posts = get_posts('numberposts=6&offset=12'); foreach ($posts as $post) : start_wp(); ?>
<?php static $count5 = 0; if ($count5 == "6") {break;} else { ?>
<article id="post-mainblock" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>">
<div class="the-title">
<h2>
<?php the_title(); ?>
</h2>
</div>
<div class="img-container">
<figure>
<!-- The Post Thumbnail -->
<?php if(has_post_thumbnail()) : ?>
<?php the_post_thumbnail('bloglanding-post-thumbnail'); ?>
<?php endif; ?>
</figure>
</div>
</a>
</article>
<?php $count5++; } ?>
<?php endforeach; ?>
As you can see from the page it is showing a lot more than the first 6 posts it should be showing. Remember the are 4 columns showing the latest 12 and at the time of writing this there are 18 test posts published starting with the usual Hello World post.
I hope all this makes sense!
Many thanks,
Phillip Dews
]]>I am using version 4.1.0, as the newer version conflicted with some code.
Any ideas?
Thanks in advance!
(No links as site still in development in localhost)
]]>Is this expected behavior?
]]>I am trying to modify “The repeater template” with my customizr theme’s native posts-grid. But I am unable to do so. I am unable to find the right code in my theme to bring the look as seen in my blog link. I have tried few codes but nothing seems worked out.
Can you please help me with this case?
Thanks,
Chandra
i am using latest version of this plugin (3.5.0), and i notice that when i use this plugin to show woocommerce products, some product keep repeating in the loop .
That means a product which name is red mobile-1 , it will keep coming after loading of next 10 products , then again re mobile-1 come then other 10 product will load .
my example short code is
[ajax_load_more post_type="product" columns="4" css_classes="products" posts_per_page="8" transition="fade" taxonomy="product_cat" taxonomy_terms="mobiles" taxonomy_operator="IN" button_label=" " post__not_in="1234,1256,3456"]
My example repeater template is
<!--<li<?php if (! has_post_thumbnail() ) { echo ' class="no-img"'; } ?>>
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail('alm-thumbnail');
}?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="entry-meta">
<?php the_time("F d, Y"); ?>
</p>
<?php the_excerpt(); ?>
</li>-->
<li class="product-li">
<?php wc_get_template_part( 'content', 'product' ); ?>
</li>
also i am triggering load more event using the following code
jQuery(function($){
var myInterval = setInterval(function () {
$.fn.almTriggerClick();
},1000);
});
. Please help to solve this .
]]><img src="<?php the_post_thumbnail_url( 'small'); ?>" srcset="<?php the_post_thumbnail_url( 'medium'); ?> 768w, <?php the_post_thumbnail_url( 'large'); ?> 1024w, <?php the_post_thumbnail_url( 'full'); ?> 1600w" alt="<?php the_post_thumbnail_caption(); ?>" />
The template loads in find, however the URL is http instead of https which means the images do not load.
Is there a way to force https?
]]>my front-page.php
<?php
/*
* Template Name:
*/
get_header();
get_template_part (‘inc/carousel’);
$the_query = new WP_Query( [
‘posts_per_page’ => 14,
‘paged’ => get_query_var(‘paged’, 1)
] );
if ( $the_query->have_posts() ) { ?>
<div id=”ajax-load”>
<?php
$i = 0;
while ( $the_query->have_posts() ) { $the_query->the_post();
if ( $i % 7 === 0 ) { // Large post: on the first iteration and every 7th post after… ?>
<article <?php post_class( ‘col-sm-12 col-md-12’ ); ?>>
<div class=”large-front-container”>
<?php the_post_thumbnail(‘full’, array(‘class’ => ‘large-front-thumbnail’)); ?>
</div>
<h2>“><?php the_title(); ?></h2>
<p class=”front-page-post-excerpt”><?php echo get_the_excerpt(); ?></p>
“>Read more
<?php get_template_part (‘front-page-shop’); ?>
<?php get_template_part( ‘share-buttons’ ); ?>
<div class=”front-comments”><?php comments_popup_link (‘0’, ‘1’, ‘%’, ‘comment-count’, ‘none’); ?></div>
</article><?php
} else { // Small posts ?>
<article <?php post_class( ‘col-sm-6 col-md-4’ ); ?>>
<div class=”front-thumbnail-image”><?php the_post_thumbnail(‘full’, array(‘class’ => ‘medium-front-thumbnail’)); ?></div>
“><?php the_title(); ?>
<p class=”front-page-post-excerpt”><?php echo get_the_excerpt(); ?></p>
“>Read more
<?php get_template_part (‘front-page-shop’); ?>
<?php get_template_part( ‘share-buttons’ ); ?>
<div class=”front-comments”><?php comments_popup_link (‘0’, ‘1’, ‘%’, ‘comment-count’, ‘none’); ?></div>
</article>
<?php
}
$i++;
}?>
</div>
<?php if(get_query_var(‘paged’) < $the_query->max_num_pages) {
echo do_shortcode( ‘[ajax_load_more id=”ajax-load” post_type=”post” posts_per_page=”14″ pause=”true” scroll=”false” button_label=”LOAD POSTS”]’ );
}
}
elseif (!get_query_var(‘paged’) || get_query_var(‘paged’) == ‘1’) {
echo ‘<p>Sorry, no posts matched your criteria.</p>’;
}
wp_reset_postdata();
get_footer();
what I tried adding to the repeater template…
<div id=”ajax-load”>
<?php
$i = 0;
while ( $the_query->have_posts() ) { $the_query->the_post();
if ( $i % 7 === 0 ) { // Large post: on the first iteration and every 7th post after… ?>
<article <?php post_class( ‘col-sm-12 col-md-12’ ); ?>>
<div class=”large-front-container”>
<?php the_post_thumbnail(‘full’, array(‘class’ => ‘large-front-thumbnail’)); ?>
</div>
<h2>“><?php the_title(); ?></h2>
<p class=”front-page-post-excerpt”><?php echo get_the_excerpt(); ?></p>
<div class=”front-post-info”>
“>Read more
<?php get_template_part (‘front-page-shop’); ?>
<?php get_template_part( ‘share-buttons’ ); ?>
<div class=”front-comments”><?php comments_popup_link (‘0’, ‘1’, ‘%’, ‘comment-count’, ‘none’); ?></div>
</article><?php
} else { // Small posts ?>
<article <?php post_class( ‘col-sm-6 col-md-4’ ); ?>>
<div class=”front-thumbnail-image”><?php the_post_thumbnail(‘full’, array(‘class’ => ‘medium-front-thumbnail’)); ?></div>
“><?php the_title(); ?>
<p class=”front-page-post-excerpt”><?php echo get_the_excerpt(); ?></p>
“>Read more
<?php get_template_part (‘front-page-shop’); ?>
<?php get_template_part( ‘share-buttons’ ); ?>
<div class=”front-comments”><?php comments_popup_link (‘0’, ‘1’, ‘%’, ‘comment-count’, ‘none’); ?></div>
</article>
<?php
}
$i++;
}?>
</div>
I have an ACF radio button for each post to select if the post is Portrait or Landscape for example. Then in my loop I add a class to the post based on this selection. Which works well for the effect I need. However, I can’t replicate this for the repeater template. Is there any way I can do this?
Here is my simple if/else statement.
if (get_field('landscape_or_portrait') == 'Portrait') {
$gridsetting = 'news-post-third';
} else {
$gridsetting = 'news-post-two-thirds';
}
]]>