Skip to content

Instantly share code, notes, and snippets.

@billerickson billerickson/functions.php Secret
Created Dec 21, 2015

Embed
What would you like to do?
<?php
function be_portfolio_post_class( $classes ) {
<!-- I dont understand this part-->
global $wp_query;
if( !$wp_query-&gt;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-&gt;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
You can’t perform that action at this time.