Advertisement
srikat

home.php

Mar 30th, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.16 KB | None | 0 0
  1. <?php
  2.  
  3. function sk_add_odd_even_class( $classes ) {
  4.  
  5.     if ( is_main_query() ) { // conditional to ensure that column classes do not apply to Featured widgets
  6.         global $wp_query;
  7.         if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 ) {
  8.             $classes[] = 'odd';
  9.         } else {
  10.             $classes[] = 'even';
  11.         }
  12.     }
  13.  
  14.     return $classes;
  15. }
  16. add_filter( 'post_class', 'sk_add_odd_even_class' );
  17.  
  18. // Force full width content
  19. add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
  20.  
  21. // Remove the entry title
  22. remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
  23.  
  24. // Remove post info
  25. remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
  26.  
  27. // Remove the post content
  28. remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
  29.  
  30. // Remove the post image
  31. remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
  32.  
  33. function sk_display_featured_image() {
  34.     if ( $image = genesis_get_image( 'format=url&size=full' ) ) {
  35.         printf( '<div class="featured-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
  36.     }
  37. }
  38.  
  39. // Remove entry meta from entry footer incl. markup
  40. remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
  41. remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
  42. remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
  43.  
  44. // Add classes to .entry-header
  45. add_filter( 'genesis_attr_entry-header', 'custom_attributes_entry_header' );
  46. function custom_attributes_entry_header( $attributes ) {
  47.     $attributes['class'] .= ' one-half first';
  48.     return $attributes;
  49. }
  50.  
  51. // Add classes to .entry-content
  52. add_filter( 'genesis_attr_entry-content', 'custom_attributes_entry_content' );
  53. function custom_attributes_entry_content( $attributes ) {
  54.     $attributes['class'] .= ' one-half';
  55.     return $attributes;
  56. }
  57.  
  58. add_action( 'genesis_before_entry', 'sk_alternate_image_content' );
  59. function sk_alternate_image_content() {
  60.     global $wp_query;
  61.     if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 ) {
  62.         add_action( 'genesis_entry_header', 'genesis_do_post_title' );
  63.         add_action( 'genesis_entry_header', 'genesis_do_post_content' );
  64.         add_action( 'genesis_entry_content', 'sk_display_featured_image' );
  65.         add_action( 'genesis_entry_content', 'genesis_post_info' );
  66.         add_action( 'genesis_entry_content', 'genesis_post_meta' );
  67.     } else {
  68.         // remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
  69.         // remove_action( 'genesis_entry_header', 'genesis_do_post_content' );
  70.  
  71.         // add_action( 'genesis_entry_header', 'sk_display_featured_image' );
  72.         // add_action( 'genesis_entry_header', 'genesis_post_info' );
  73.         // add_action( 'genesis_entry_header', 'genesis_post_meta' );
  74.  
  75.         // remove_action( 'genesis_entry_content', 'sk_display_featured_image' );
  76.         // remove_action( 'genesis_entry_content', 'genesis_post_info' );
  77.         // remove_action( 'genesis_entry_content', 'genesis_post_meta' );
  78.  
  79.         // add_action( 'genesis_entry_content', 'genesis_do_post_title' );
  80.         // add_action( 'genesis_entry_content', 'genesis_do_post_content' );
  81.     }
  82. }
  83.  
  84. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement