How Do I Only Select One Post From One Category?
-
Let’s say i want to get the latest post from ‘liveblog’ category, which part do i edit?
<?php require('../wp-blog-header.php');?> <html> <?php $args = array( 'numberposts' => 1, 'post_status'=>"publish", 'post_type'=>"post", 'orderby'=>"post_date", 'category'=>"liveblog"); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> Redirecting to <b> <?php echo the_permalink(); echo "</b>. "; ?> If redirection doesn't take place within 5 seconds, click <a href = "<?php the_permalink()?>">here</a>. <br/><br/> <b>Post Name</b> : <?php the_title();?><br/> <b>Date Posted</b> : <?php the_date();?><br/> <script> //location = "<?php the_permalink()?>"; </script> <?php endforeach; ?> </html>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How Do I Only Select One Post From One Category?’ is closed to new replies.