Skip to content

Instantly share code, notes, and snippets.

@karenalenore
Created July 5, 2016 17:58
Show Gist options
  • Select an option

  • Save karenalenore/6fa7586dc858f33113ddcb92d1676ac3 to your computer and use it in GitHub Desktop.

Select an option

Save karenalenore/6fa7586dc858f33113ddcb92d1676ac3 to your computer and use it in GitHub Desktop.
// Column Shortcodes
add_shortcode('column', 'opensky_col_function');
function opensky_col_function( $atts, $content = null ) {
extract( shortcode_atts( array(
'class' => '',
'width' => '',
), $atts ) );
return '<div class="' . esc_attr($width) . esc_attr($class) . '">' . opensky_strip_autop(do_shortcode($content)) . '</div>';
}
//Strip content of AutoP
function opensky_strip_autop($content){
$content = do_shortcode(shortcode_unautop( $content ));
$content = preg_replace('#^<\/p>|^<br \/>|<p>$#', '', $content);
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment