Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow for a custom 'class' to be entered for each column.

  • Loading branch information...
commit 13ea202d37f0d54c453f3c7552f093d1da6c5444 1 parent aae663d
@justintadlock authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 grid-columns.php
View
17 grid-columns.php
@@ -134,7 +134,15 @@ public function do_shortcode( $attr, $content = null ) {
$column_classes = array();
/* Set up the default arguments. */
- $defaults = apply_filters( 'gc_column_defaults', array( 'grid' => 4, 'span' => 1, 'push' => 0 ) );
+ $defaults = apply_filters(
+ 'gc_column_defaults',
+ array(
+ 'grid' => 4,
+ 'span' => 1,
+ 'push' => 0,
+ 'class' => ''
+ )
+ );
/* Parse the arguments. */
$attr = shortcode_atts( $defaults, $attr );
@@ -162,6 +170,13 @@ public function do_shortcode( $attr, $content = null ) {
$column_classes[] = "column-span-{$attr['span']}";
$column_classes[] = "column-push-{$attr['push']}";
+ /* Add user-input custom class(es). */
+ if ( !empty( $attr['class'] ) ) {
+ if ( !is_array( $attr['class'] ) )
+ $attr['class'] = preg_split( '#\s+#', $attr['class'] );
+ $column_classes = array_merge( $column_classes, $attr['class'] );
+ }
+
/* If the $grid property is equal to 0. */
if ( 0 == $this->grid ) {
Please sign in to comment.
Something went wrong with that request. Please try again.