Code Monkey home page Code Monkey logo

flexington's Introduction

Flexington

A grid framework using flexbox. Originally forked from FlexBox Grid.

  • Optional gutters between grid items (not in FlexBox Grid)
  • Declare various breakpoints right in your HTML.
  • Breakpoints: xs < 544px, sm > 544px, md > 768px, lg > 992px, xl > 1200px
  • Easily nest columns.
  • Support for WordPress Galleries (not in FlexBox Grid)
  • View Flexington codepen.

Requirements

.col must be an immediate child of .row, this allows for nested grids

How To Use

Notes

.row uses negative margins when dealing with gutters. Try not to add styling to the .row itself, instead stying a different wrapping element to avoid potential problems from the negative margin.

Raw HTML

  1. Add the wrapping class .row Example: <div class="row">.
  2. Add a class of .col to each immediate child element that is part of the column grid.
  3. Add classes (for breakpoints xs, sm, md, lg) to a container element to declare the total columns out of the 12. Example: <div class="col col-xs-12 col-sm-6 col-md-4 col-lg-3 col-xl-2">.

Genesis Archives

// 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;
}

WordPress Galleries

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>';
}

flexington's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.