Help with category loop
-
Hi I am trying to get info from a category loop but I cannot get anything to display.
Any advice would be appreciated, Thanks
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $my_query = new WP_Query(array('category__in' => array(4), 'posts_per_page' => 2,'paged'=>$paged)); ?> <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) :the_post(); ?> <?php $currentid = get_the_id(); ?> <div class="project-box grid-box grid-block mod-box width100"> <div class="project-img"> <?php if (get_the_post_thumbnail($currentid) != "") { ?> <a href="<?php the_permalink(); ?>" ><?php echo get_the_post_thumbnail($currentid,array(300,600)); ?></a> <?php } else { ?> <a href="<?php the_permalink(); ?>" ><img src='<?php bloginfo('template_url') ?>/images/default.png' alt='Killen Civlil Engineering'/></a> <?php } ?> </div> <div class="project-info"> <h2><a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?></a></h2> <p><?php echo get_the_excerpt(); ?></p> <a href="<?php the_permalink(); ?>" class="info">More ?</a> </div> </div> <?php endwhile; ?> <div class="project-pagination"> <div class="pagination page-btn"><?php next_posts_link( '? Prev' ); ?></div> <div class="pagination page-btn-1"><?php previous_posts_link( 'Next ?' ); ?></div> </div> <?php endif; wp_reset_query(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Help with category loop’ is closed to new replies.