Skip to content

Instantly share code, notes, and snippets.

@solepixel
Created March 11, 2014 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solepixel/9496395 to your computer and use it in GitHub Desktop.
Save solepixel/9496395 to your computer and use it in GitHub Desktop.
Helpers file in MIni Loops Plugin
<?php
# ...
function miniloops_shortcoder( $input ) {
$input = wp_filter_post_kses( $input );
//give our shortcodes the correct prefix
$input = str_replace( '[', '[ml_', $input );
$input = str_replace( '[/', '[/ml_', $input );
//make sure we haven't doubled-up
$input = str_replace( '[ml_ml_', '[ml_', $input );
$input = str_replace( '[/ml_ml_', '[/ml_', $input );
$input = str_replace( '[ml_ba_', '[ba_', $input );
$input = str_replace( '[/ml_ba_', '[/ba_', $input );
$input = str_replace( '[ml_/ml_', '[/ml_', $input );
//a hack: 2 shortcodes touching has issues
//%%%%% is a placeholder to be removed during output
$input = str_replace( '][', ']%%%%%[', $input );
$input = stripslashes( $input );
return $input;
}
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment