-
-
Save billerickson/16bee44567fe30c9de52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function be_portfolio_post_class( $classes ) { | |
<!-- I dont understand this part--> | |
global $wp_query; | |
if( !$wp_query->is_main_query() ) | |
return $classes; | |
<!-- End--> | |
$columns = 3; | |
<!-- I dont understand this part--> | |
$column_classes = array( '', '', 'one-half', 'one-third', 'one-fourth', 'one-fifth', 'one-sixth' ); | |
$classes[] = $column_classes[$columns]; | |
if( 0 == $wp_query->current_post % $columns ) | |
$classes[] = 'first'; | |
return $classes; | |
<!-- End--> | |
} | |
add_filter( 'post_class', 'be_portfolio_post_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment