Skip to content

Instantly share code, notes, and snippets.

@DavidCramer
Created October 14, 2014 11:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidCramer/395d3d1e09c2874a152d to your computer and use it in GitHub Desktop.
Save DavidCramer/395d3d1e09c2874a152d to your computer and use it in GitHub Desktop.
Setting Caldera Forms to use Zurb Foundation Grid instead of Bootstrap.
<?php
// Simple snippet to show how to use Foundation's grid over the built in Bootstrap grid.
add_filter('caldera_forms_render_grid_settings', 'setup_foundation_grid', 10, 2);
function setup_foundation_grid($grid, $form){
// Bootstrap grid sized to foundation equivilents
$grid_sizes = array(
'xs' => 'small',
'sm' => 'small',
'md' => 'medium',
'lg' => 'large',
);
// set grid size to foundation size from sizes array
$grid_size = $grid_sizes[ $form['settings']['responsive']['break_point'] ];
// column_before = column start
// %1$ sets the Column ID, %2$d Sets the span size, %3$d sets additional column classes
$grid['column_before'] = '<div %1$s class="' . $grid_size . '-%2$d columns %3$s" style="min-height: 1px;">';
// the min-height fixes an issue where an empty column doesn't show since foundation uses float:left
return $grid;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment