Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function to set what appears in the loop
- function sk_loop_content() {
- remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
- add_action( 'genesis_entry_header', 'genesis_post_info', 7 );
- }
- // Function to output the loop
- function sk_loop_markup() {
- printf( '<article %s>', genesis_attr( 'entry' ) );
- do_action( 'genesis_entry_header' );
- do_action( 'genesis_before_entry_content' );
- printf( '<div %s>', genesis_attr( 'entry-content' ) );
- do_action( 'genesis_entry_content' );
- echo '</div>';
- do_action( 'genesis_after_entry_content' );
- do_action( 'genesis_entry_footer' );
- echo '</article>';
- }
- add_action( 'get_header', 'function_to_add' );
- function function_to_add() {
- // WP_Query arguments
- $args = array (
- 'cat' => get_query_var( 'cat' ),
- 'no_found_rows' => true,
- 'posts_per_page' => '1',
- );
- global $data;
- ob_start();
- $loop = new WP_Query( $args );
- if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
- sk_loop_content();
- sk_loop_markup();
- endwhile; endif; wp_reset_postdata();
- $data = ob_get_clean();
- }
- add_action( 'genesis_before_loop', 'sk_latest_post', 15 );
- function sk_latest_post() {
- global $data;
- echo $data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement