Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'genesis_before_loop', 'sk_latest_post', 15 );
- function sk_latest_post() {
- // WP_Query arguments
- $args = array (
- 'cat' => get_query_var( 'cat' ),
- 'no_found_rows' => true,
- 'posts_per_page' => '1',
- );
- // The Query
- $query = new WP_Query( $args );
- // The Loop
- if ( $query->have_posts() ) {
- while ( $query->have_posts() ) {
- $query->the_post();
- // do something
- the_title();
- }
- } else {
- // no posts found
- }
- // Restore original Post Data
- wp_reset_postdata();
- }
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment