Duplicate posts in loop.php
-
Im trying to grab posts in the loop by post_type. I only want to display 4 posts. But 24 posts appear.
Any ideas?
Here is my code:
<?php elseif ( is_home() ) : ?> <?php $my_query = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => 4, 'order' => 'ASC', 'cat' => 8) ); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="other-works"> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="title-bg"> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?> > </a> </h2> </div> <div class="post-thumb"> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail();?></a> </div> </div> </div> <?php endwhile; ?> <?php else: ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Duplicate posts in loop.php’ is closed to new replies.