Show second newest post
-
Hello, I currently use
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php // Fetch most recent posts, limit to 1 $latest_posts = get_posts( array( 'posts_per_page' => 1, ) ); // get first and only item in array $latest_post = $latest_posts[0]; ?> <h3><a href="<?php echo get_permalink( $latest_post->ID ); ?>"><?php echo $latest_post->post_title; ?></a></h3> <?php if ( has_excerpt( $latest_post ) ) : ?> <p><?php echo $latest_post->post_excerpt; ?></p> <p> <?php else : ?> <?php echo strip_shortcodes(wp_trim_words( $latest_post->post_content, 50 )); // '250' is number of words ?> <?php endif; ?> </p> <p><a href="<?php echo get_permalink( $latest_post->ID ); ?>"> Read More...</a></p> </div>
to show my most resent post, but what need’s to be changed to show the second most resent post?
Thanks
Aled
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Show second newest post’ is closed to new replies.