Title: Only loading 5 posts
Last modified: August 22, 2016

---

# Only loading 5 posts

 *  Resolved [mreee](https://wordpress.org/support/users/mreee/)
 * (@mreee)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/)
 * The load more button does not work. Here is my code.
 *     ```
       <?php echo do_shortcode('[ajax_load_more post_type="post" scroll="false" button_label="Load More" category="'. (is_archive() ? $cat_slug : "") .'"]'); ?>
       ```
   
 * Dev URL: [http://tcg.thelabelcreative.com/blog/](http://tcg.thelabelcreative.com/blog/)
 * [https://wordpress.org/plugins/ajax-load-more/](https://wordpress.org/plugins/ajax-load-more/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716382)
 * I think you have some errors in your page markup.
    Can you check your repeater
   templates and make sure all html tags are closed properly? [http://cl.ly/image/1e1P2R0W3913](http://cl.ly/image/1e1P2R0W3913)
 *  Thread Starter [mreee](https://wordpress.org/support/users/mreee/)
 * (@mreee)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716534)
 * Thanks for the reply.
 * I have 2 divs that are being closed outside of the template. Could that be causing
   the error?
 *     ```
       <?php
       	if (!isset($i)){
       		$i = 1;
       	}
       ?>
       <?php if ($i == 2) { ?>
       		<div class="articles-sidebar">
       			<div class="fixedsticky blog-sidebar" id="blog-sidebar">
       				<div class="blog-sidebar-inner">
       					<h3 class="blog-sidebar-title">Sort By Category</h3>
       					<?php blog_sidebar_menu(); ?>
       				</div>
       				<?php get_search_form(); ?>
       			</div>
   
       			<div class="cf center-articles-wrap">
       		<?php } ?>
       			<?php $img = get_field('hero_image'); ?>
       			<?php if( !empty($img) ) { ?><?php } ?>
   
       			<article id="post-<?php the_ID(); ?>" class="cf article <?php if ($i == 1) { ?> top-article <?php } elseif ($i == 2 || $i == 3) { ?> center-article <?php } else { ?> normal-article <?php } ?>" style="background-image: url('<?php if ($i == 1) { echo $img['url']; } ?>');" role="article">
   
       				<?php if ($i > 1) { ?>
       				<div class="article-image-wrap fourcol first">
       					<?php
       					$thumb_id = get_post_thumbnail_id();
       					if ($i < 4) {
       						$thumb_url = wp_get_attachment_image_src($thumb_id,'label-thumb-450', true);
       					} else {
       						$thumb_url = wp_get_attachment_image_src($thumb_id,'label-thumb-300', true);
       					}
   
       					?>
       					<a href="<?php the_permalink(); ?>"><img src="<?php echo $thumb_url[0]; ?>" alt="<?php the_title(); ?>"></a>
       				</div>
       				<?php } ?>
   
       				<div class="article-content-wrap eightcol last">
       					<header class="article-header cf">
       						<p class="category-item <?php foreach(get_the_category() as $category) { echo $category->slug . ' ';} ?>"><?php printf( __( '<span class="vact">%1$s</span> ', 'labeltheme' ), get_the_category_list(', ')); ?></p>
       						<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
       					</header> <?php // end article header ?>
   
       					<?php if ($i > 3) { ?>
       					<section class="article-excerpt">
       						<?php custom_excerpt(170); ?>
       					</section>
       					<?php } ?>
   
       					<footer class="cf article-footer">
       						<div class="post-info">
       							<?php echo get_avatar( get_the_author_meta( 'user_email' ), 86 ); ?>
       							<?php printf( __( '<div class="vact-t-a"> <span class="author"><span class="single-by">by</span> %3$s</span> <time class="updated" datetime="%1$s" pubdate>%2$s</time> </div>', 'labeltheme' ), get_the_time('Y-m-j'), get_the_time(get_option('date_format')), label_get_the_author_posts_link(), get_the_category_list(', ')); ?>
       						</div>
       						<?php if ($i > 3) { ?>
       							<a href="<?php the_permalink(); ?>" class="button button-black-border">Read More</a>
       						<?php } ?>
       					</footer> <?php // end article footer ?>
       				</div>
   
       			</article> <?php // end article ?>
   
       		<?php if ($i == 3) { ?></div><?php } ?>
   
       		<?php $i++; ?>
       ```
   
 *  Thread Starter [mreee](https://wordpress.org/support/users/mreee/)
 * (@mreee)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716537)
 * Sorry for the wall of code. Here is the url of the current site
 * thecontrolgroup.com/blog
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716541)
 * Likely the issue. Each templates should be opened and closed or i cannot guarantee
   the results – as stated in the Template Help section inside the plugin.
 * > **Tips and Tricks**
   >  Always open and close your templates with an HTML element.
   > In some rare cases data may not be displayed if not wrapped in HTML. e.g. <
   > li> </ li> or < div> </ div>
 *  Thread Starter [mreee](https://wordpress.org/support/users/mreee/)
 * (@mreee)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716543)
 * Looks like that is my problem.
 * Thanks for the help
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716544)
 * No problem, good luck!
 *  [fernandorigotti](https://wordpress.org/support/users/fernandorigotti/)
 * (@fernandorigotti)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716691)
 * I am havign the same problem. This is my template:
 *     ```
       <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 box">
          <?php 
   
           $cats = get_the_category();
       	$cat = $cats[0];
       	$parent = $cat->parent;
   
       	if($parent !== 0) {
   
       	$parentz = get_category($parent);
       	$parent_name = $parentz->name;
       	$parent_url = $parentz->slug;
   
       	} else {
   
       	$parent_name = $cats[0]->name;
       	$parent_url = $cats[0]->slug;
   
       	}
   
       	$author_id= get_the_author_meta('id');
       $user = "user_".$author_id;
       $avatar = get_field('avatar', $user);
   
       $thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), 'grid-thumb' );
       $url = $thumb['0'];
   
       ?>
   
               <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>">
               <img src="<?php echo $url; ?>" alt="<?php echo esc_attr( get_the_title() ); ?>" class="img-responsive cem">
               </a> 
   
           <div class="info">
           <span class="canal">
           <a href="/<?php echo $parent_url; ?>" title="Ver todas dicas de <?php echo $parent_name; ?>"><?php if(is_post_type('galeria')) { ?>
           <i class="fa fa-camera"></i>
           <?php } elseif(is_post_type('video')) { ?>
           <i class="fa fa-video-camera"></i>
           <?php } ?> <?php echo $parent_name; ?></a></span>
           <p class="titulo-chamada"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></p>
           <div class="autor">
            <div class="col-xs-7 col-md-9"><img src="<?php echo $avatar['sizes']['autor']; ?>" class="img-responsive pull-left img-circle avatar" alt="<?php the_author(); ?>"><?php the_author_posts_link(); ?></div>
           <div class="col-xs-5 col-md-3 text-right"><?php if( function_exists('zilla_likes') ) zilla_likes(); ?></div>
           </div>
           </div>
           </div>
       ```
   
 * What’s wrong?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Only loading 5 posts’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [fernandorigotti](https://wordpress.org/support/users/fernandorigotti/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/only-loading-5-posts/#post-5716691)
 * Status: resolved