infinitescroll only loading partial template
-
I am having issues with infinite scroll. I am using this on a static page, I was able to create my own wp_query() you can see it on the main.php page template here:
<?php /* Template Name: Main */ get_header(); $paged = ( get_query_var('page') ) ? get_query_var('page') : 1; // WP_Query arguments $args = array ( 'post_type' => array('post','diy_howto'), 'pagination' => true, 'posts_per_page' => '10', 'order_by' => 'date', 'paged' => $paged, ); // The Query $wp_query = new WP_Query( $args ); // The Loop if ( $wp_query->have_posts() ) { while ( $wp_query->have_posts() ) { $wp_query->the_post(); // do something #include (TEMPLATEPATH . '/php/article-class.php' ); get_template_part('/php/article-class', get_post_format()); } include (TEMPLATEPATH . '/inc/nav.php' ); } else { // no posts found echo "<h2>Not Found</h2>"; } // Restore original Post Data wp_reset_postdata(); get_footer(); ?>The infinite scrolling is working, however any new posts that are displayed are only partial. They do not display the meta data of the post.
Here is the template for article-class.php:
<?php if(is_home() || is_front_page()) :?> <a class="article-anchor biggest-image" href="<?php the_permalink() ?>"> <article <?php post_class('river-article') ?> id="post-<?php the_ID(); ?>"> <aside class="image-container"> <img src="<?php echo append_suffix('bigger'); ?>" alt="" width="296"> </aside> </article> <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?> <span class="divider"></span> </a> <?php else: ?> <a class="article-anchor small-image" href="<?php the_permalink() ?>"> <article <?php post_class('river-article') ?> id="post-<?php the_ID(); ?>"> <aside class="image-container"> <img src="<?php echo append_suffix('small'); ?>" alt=""> </aside> </article> </a> <?php endif;?>You will see the include for meta.php which is fired. Here is the code for that:
<?php $title = trunc(get_the_title(),5,'title'); $category = get_the_category(); $catId = $category[0]->term_id; $categoryLink = get_category_link($catId); $comments = get_comments( array( 'number' => $count, 'status' => 'approve', 'post_id' => $post->ID )); $comments = count($comments); if ($comments == 0){ $commentNum = 'No Comments'; } elseif($comments == 1){ $commentNum = '1 Comment'; } else{ $commentNum = $comments . ' Comments'; } ?> <section class="meta"> <?php if(is_single() || is_home() || is_front_page()) : ?> <h2><?php echo get_the_title(); ?></h2> <?php else: ?> <h2><?php echo $title; ?> ...</h2> <?php endif ?> <?php if(is_single() || is_home() || is_front_page()): ?> <p class="fn">by <span class="meta-auth"><?php the_author_posts_link(); ?></span> in <span class="meta-cat"><?php echo $category[0]->name;?></span></p> <?php else: ?> <p class="fn">by <span><?php the_author(); ?></span> in <span><?php echo $category[0]->name;?></span></p> <?php endif ?> <?php if(is_single() || is_home() || is_front_page()): ?> <p class="date">on <time datetime="<?php echo date(DATE_W3C); ?>" pubdate class="updated"><?php the_time('F jS, Y') ?> | </time><a href="<?php the_permalink(); ?>#comment-wrapper"><?php echo $commentNum; ?></a></p> <?php else: ?> <p class="date">on <time datetime="<?php echo date(DATE_W3C); ?>" pubdate class="updated"><?php the_time('F jS, Y') ?></time></p> <?php endif ?> </section>I’ve been able to debug it down to the issue being something with: the_author_posts_link(); I am not quite sure how to resolve this, so I am turning to the boards.
The topic ‘infinitescroll only loading partial template’ is closed to new replies.