Cycle through Single Posts of a particular category
-
Is there a way to hack this code so it only cycles through posts, right and left buttons added, in a particular category such as ‘news’
<?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( has_post_thumbnail() ) { ?> <?php } ?> <div class="gridly-copy"> <h1><?php the_title(); ?> </h1> <div class="detail"><?php the_content(); ?></div> <?php the_tags(); ?> <div class="clear"></div> <?php comments_template(); ?> </div> </div> <?php endwhile; endif; ?> <div class="post-nav"> <div class="post-prev"><?php previous_post_link('%link'); ?> </div> <div class="post-next"><?php next_post_link('%link'); ?></div> </div> <?php get_footer(); ?>
or alternatively change it to a foreach array to cycle through only posts with these parameters
<?php $args = array( 'numberposts' => 50, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'suppress_filters' => 'true', 'meta_query' => array( array( 'key' => 'news', 'value' => 'no', ) ) ); ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Cycle through Single Posts of a particular category’ is closed to new replies.