Advertisement
srikat

Untitled

Aug 17th, 2016
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // Function to set what appears in the loop
  2. function sk_loop_content() {
  3. remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
  4. add_action( 'genesis_entry_header', 'genesis_post_info', 7 );
  5. }
  6.  
  7. // Function to output the loop
  8. function sk_loop_markup() {
  9. printf( '<article %s>', genesis_attr( 'entry' ) );
  10.  
  11. do_action( 'genesis_entry_header' );
  12.  
  13. do_action( 'genesis_before_entry_content' );
  14.  
  15. printf( '<div %s>', genesis_attr( 'entry-content' ) );
  16. do_action( 'genesis_entry_content' );
  17. echo '</div>';
  18.  
  19. do_action( 'genesis_after_entry_content' );
  20.  
  21. do_action( 'genesis_entry_footer' );
  22.  
  23. echo '</article>';
  24. }
  25.  
  26. add_action( 'get_header', 'function_to_add' );
  27. function function_to_add() {
  28. // WP_Query arguments
  29. $args = array (
  30. 'cat' => get_query_var( 'cat' ),
  31. 'no_found_rows' => true,
  32. 'posts_per_page' => '1',
  33. );
  34.  
  35. global $data;
  36.  
  37. ob_start();
  38. $loop = new WP_Query( $args );
  39.  
  40. if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
  41. sk_loop_content();
  42. sk_loop_markup();
  43. endwhile; endif; wp_reset_postdata();
  44. $data = ob_get_clean();
  45. }
  46.  
  47. add_action( 'genesis_before_loop', 'sk_latest_post', 15 );
  48. function sk_latest_post() {
  49. global $data;
  50. echo $data;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement