Skip to content

Instantly share code, notes, and snippets.

@travismillerweb
Created October 7, 2014 15:05
Show Gist options
  • Save travismillerweb/15c3520a390978262ae2 to your computer and use it in GitHub Desktop.
Save travismillerweb/15c3520a390978262ae2 to your computer and use it in GitHub Desktop.
PHP - Wordpress Shortcode Functions for Custom Sass Grid
<?php
// PHP - Wordpress Shortcode Functions for Custom Sass Grid
// A Working Shortcode Template for Custom Grid Layouts using Sass
/* =============================================================================
Row Block Shortcode
========================================================================== */
function row_shortcode($content = null ) {
$return_content = do_shortcode($content);
return "<div class='row'>". $return_content ."</div>";
}
add_shortcode( 'row', 'row_shortcode' );
/* =============================================================================
Column Block Shortcode
========================================================================== */
function column_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'column' => '',
), $atts ) );
if ($column) {
$layout_type = $column;
}
$return_content = do_shortcode($content);
return "<div class='column-".$layout_type ."'>". $return_content ."</div>";
}
add_shortcode( 'column', 'column_shortcode' );
/* ============================================================================ */
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment