Advertisement
srikat

home.php

Dec 29th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Display as Columns
  5. *
  6. */
  7. function be_portfolio_post_class( $classes ) {
  8.  
  9. if ( is_main_query() ) { // conditional to ensure that column classes do not apply to Featured widgets
  10. $columns = 2; // Set the number of columns here
  11.  
  12. $column_classes = array( '', '', 'one-half', 'one-third', 'one-fourth', 'one-fifth', 'one-sixth' );
  13. $classes[] = $column_classes[$columns];
  14. global $wp_query;
  15. if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % $columns )
  16. $classes[] = 'first';
  17. }
  18.  
  19. return $classes;
  20. }
  21. add_filter( 'post_class', 'be_portfolio_post_class' );
  22.  
  23. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement