0

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?

1 Answer 1

0

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(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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