srikat

front-page.php

Oct 18th, 2013
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.82 KB | None | 0 0
  1. <?php
  2.  
  3. //* Add even/odd post class
  4. add_filter( 'post_class', 'minimum_even_odd_portfolio_post_class' );
  5. function minimum_even_odd_portfolio_post_class( $classes ) {
  6.  
  7.     global $wp_query;
  8.     $classes[] = ($wp_query->current_post % 2 == 0) ? 'portfolio-odd' : 'portfolio-even';
  9.     return $classes;
  10.  
  11. }
  12.  
  13. function minimum_portfolio_grid() {
  14.  
  15.     if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
  16.         printf( '<div class="portfolio-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
  17.  
  18.     }
  19.  
  20. }
  21.  
  22. //* Add widget support for homepage if widgets are being used
  23. add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
  24. function minimum_front_page_genesis_meta() {
  25.  
  26.     if ( is_home() ) {
  27.  
  28.         //* Remove the entry meta in the entry header
  29.         remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
  30.         remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
  31.         remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
  32.  
  33.         //* Remove the entry content
  34.         remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
  35.  
  36.         //* Remove the entry image
  37.         remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
  38.  
  39.         //* Add the featured image after post title
  40.         add_action( 'genesis_entry_content', 'minimum_portfolio_grid' );
  41.  
  42.         //* Remove entry footer functions
  43.         remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
  44.         remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
  45.         remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
  46.  
  47.         //* Force full width content layout
  48.         add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
  49.  
  50.     }
  51.  
  52. }
  53.  
  54. //* Run the Genesis loop
  55. genesis();
Advertisement
Add Comment
Please, Sign In to add comment