Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a WP-Touch theme and I have a template file that looks like this:

<?php get_header(); ?>  
<?php locate_template( 'featured-post.php', true, false ); ?>
<?php locate_template( 'blog-loop.php', true ); ?>
<?php get_footer(); ?>

Inside the blog-loop I load in a number of posts with a basic loop then at the bottom of the page there is an ajax call(built into the theme) that loads in the next set of posts. This works great accept the ajax call is made inside of blog-loop and is loading in the featured-post query as well. So every time a user clicks 'load more' they get a featured article between all of the new posts.

How can I fix this? Can I have a conditional statement that allows the featured article to show up only on the first load?

share|improve this question

1 Answer 1

I was able to find a solution to my own problem.

For anyone needing to solve this in the future, Wordpress offers a set of conditional statements for just able everything, include pagination.

<?php get_header(); ?>
<?php if ( ! $paged || $paged < 2 ){ ?>
<?php locate_template( 'featured-post.php', true, false ); ?>
<?php }?>
<?php locate_template( 'blog-loop.php', true ); ?>
<?php get_footer(); ?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.