askdesign
2/6/2017 - 4:50 PM

A grid framework using flexbox

~ Mike Hemberger - Jan. 15, 2017

// Flexington 2.1.0+ includes support for WordPress Galleries (1, 2, 3, 4, 6 columns only)
// Remove default WordPress gallery CSS
 
// Turn off gallery CSS
add_filter( 'use_default_gallery_style', '__return_false' );

// Bonus: Remove unsupported options from the gallery dropdown
/**
 * Add custom CSS to <head>
 *
 * @return void
 */
add_action( 'admin_head', 'prefix_remove_unsupported_flexington_gallery_options' );
function prefix_remove_unsupported_flexington_gallery_options() {
    echo '<style type="text/css">
        .gallery-settings .columns option[value="5"],
        .gallery-settings .columns option[value="7"],
        .gallery-settings .columns option[value="8"],
        .gallery-settings .columns option[value="9"] {
            display:none !important;
            visibility: hidden !important;
        }
        </style>';
}
Originally forked from FlexBox Grid - flexboxgrid.com
https://github.com/JiveDig/flexington

// Flexington archive wrap opening html
add_action( 'genesis_before_loop', 'prefix_do_flexington_wrap_open', 100 );
function prefix_do_flexington_wrap_open() {
    echo '<div class="row gutter-30">';
}

// Flexington archive wrap closing html
// If archive pagination throws things off, try hooking into `genesis_after_endwhile`
add_action( 'genesis_after_loop', 'prefix_do_flexington_wrap_close', 0 );
function prefix_do_flexington_wrap_close() {
    echo '</div>';
}

// Add Flexington col classes to .entry
add_filter( 'genesis_attr_entry', 'prefix_flexington_archive_wrap' );
function prefix_flexington_archive_wrap( $attributes ) {
    $attributes['class'] = $attributes['class']. ' col col-xs-12 col-sm-6 col-md-4 col-lg-3 col-xl-2';
    return $attributes;
}