Skip to content

Instantly share code, notes, and snippets.

@billerickson billerickson/functions.php Secret
Last active Feb 24, 2016

Embed
What would you like to do?
<?php
/**
* Two column tablet classes
*
*/
function be_two_column_tablet( $classes ) {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return $classes;
// Add this to all posts
$classes[] = 'tablet-one-half';
// Every other post gets this
global $wp_query;
if( 0 == $wp_query->current_post % 2 )
$classes[] = 'tablet-first';
return $classes;
}
add_filter( 'post_class', 'be_two_column_tablet' );
@media only screen and (max-width: 960px) {
.one-third.tablet-one-half,
.one-fourth.tablet-one-half {
width: 49.166666666667%;
}
.one-third.first.tablet-one-half,
.one-fourth.first.tablet-one-half {
margin-left: 1.6666666666667%;
clear: none;
}
.one-third.tablet-one-half.tablet-first,
.one-third.first.tablet-one-half.tablet-first,
.one-fourth.tablet-one-half.tablet-first,
.one-fourth.first.tablet-one-half.tablet-first {
clear: both;
margin-left: 0;
}
}
@media only screen and (max-width: 767px) {
.one-third.tablet-one-half,
.one-third.first.tablet-one-half,
.one-fourth.tablet-one-half,
.one-fourth.first.tablet-one-half,
.one-third.tablet-one-half.tablet-first,
.one-third.first.tablet-one-half.tablet-first,
.one-fourth.tablet-one-half.tablet-first,
.one-fourth.first.tablet-one-half.tablet-first {
margin: 0;
width: 100%;
}
}
}
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.