How can I show second most recent post in sidebar, if most recent post is open in the browser?
You can use the WP Query option “post__not_in” for that, this variable should be an array with IDs of posts that should not appear on the result, so you would use it like that: $the_query = new WP_Query(array( ‘post__not_in’ => array( get_the_ID() ), ‘post_type’ => ‘articles’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 1, ‘orderby’ => ‘date’, … Read more