Skip to content

Instantly share code, notes, and snippets.

@JanHoek
Last active January 29, 2017 16:38
Show Gist options
  • Save JanHoek/3501eb5637cda7dc92a0 to your computer and use it in GitHub Desktop.
Save JanHoek/3501eb5637cda7dc92a0 to your computer and use it in GitHub Desktop.
Simple Genesis Columns Shortcode Handler
<?php
//*shortcode handler for columnization
//* One Half
function shortcode_half_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-half first col1"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_half_second( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-half col2"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( 'half1', 'shortcode_half_first' );
add_shortcode( 'half2', 'shortcode_half_second' );
//* One Third
function shortcode_third_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-third first col3"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_third_second( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-third col4"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_third_third( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-third col5"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( 'third1', 'shortcode_third_first' );
add_shortcode( 'third2', 'shortcode_third_second' );
add_shortcode( 'third3', 'shortcode_third_third' );
//* One Fourth
function shortcode_fourth_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-fourth first col6"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_fourth_second( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-fourth col7"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_fourth_third( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-fourth col8"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_fourth_fourth( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-fourth col9"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( 'fourth1', 'shortcode_fourth_first' );
add_shortcode( 'fourth2', 'shortcode_fourth_second' );
add_shortcode( 'fourth3', 'shortcode_fourth_third' );
add_shortcode( 'fourth4', 'shortcode_fourth_fourth' );
//* One Sixth
function shortcode_sixth_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-sixth first col10"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_sixth_second( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-sixth col11"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_sixth_third( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-sixth col12"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_sixth_fourth( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-sixth col13"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_sixth_fifth( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-sixth col14"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_sixth_sixth( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="one-sixth col15"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( 'sixth1', 'shortcode_sixth_first' );
add_shortcode( 'sixth2', 'shortcode_sixth_second' );
add_shortcode( 'sixth3', 'shortcode_sixth_third' );
add_shortcode( 'sixth4', 'shortcode_sixth_fourth' );
add_shortcode( 'sixth5', 'shortcode_sixth_fifth' );
add_shortcode( 'sixth6', 'shortcode_sixth_sixth' );
//* Three Sixths
function shortcode_3sixths_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="three-sixths first col16"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_3sixths( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="three-sixths col17"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '3sixths1', 'shortcode_3sixths_first' );
add_shortcode( '3sixths', 'shortcode_3sixths' );
//* Two Fourths
function shortcode_2fourths_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="two-fourths first col18"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_2fourths( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="two-fourths col19"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '2fourths1', 'shortcode_2fourths_first' );
add_shortcode( '2fourths', 'shortcode_2fourths' );
//* Two Sixths
function shortcode_2sixths_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="two-sixths first col20"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_2sixths( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="two-sixths col21"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '2sixths1', 'shortcode_2sixths_first' );
add_shortcode( '2sixths', 'shortcode_2sixths' );
//* Four Sixths
function shortcode_4sixths_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="four-sixths first col22"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_4sixths( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="four-sixths col23"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '4sixths1', 'shortcode_4sixths_first' );
add_shortcode( '4sixths', 'shortcode_4sixths' );
//* Two Thirds
function shortcode_2thirds_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="two-thirds first col24"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_2thirds( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="two-thirds col25"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '2thirds1', 'shortcode_2thirds_first' );
add_shortcode( '2thirds', 'shortcode_2thirds' );
//* Three Fourths
function shortcode_3fourths_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="three-fourths first col26"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_3fourths( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="three-fourths col27"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '3fourths1', 'shortcode_3fourths_first' );
add_shortcode( '3fourths', 'shortcode_3fourths' );
//* Five Sixths
function shortcode_5sixths_first( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="five-sixths first 5sixths1"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
function shortcode_5sixths( $atts, $content = null ) {
$content = wptexturize( $content );
$content = wpautop( $content );
$content = '<div class="five-sixths 5sixths"><div class="column-inner">' . $content . '</div></div>';
return $content;
}
add_shortcode( '5sixths1', 'shortcode_5sixths_first' );
add_shortcode( '5sixths', 'shortcode_5sixths' );
//* Clear Lines
function row_clear( $atts ) {
return '<div class="rowclear"></div>';
}
add_shortcode('rowclear','row_clear');
function line_clear( $atts ) {
return '<div class="lineclear"></div>';
}
add_shortcode('lineclear','line_clear');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment