Skip to content

Instantly share code, notes, and snippets.

@willybahuaud
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save willybahuaud/b8a062be60c7998de9a9 to your computer and use it in GitHub Desktop.

Select an option

Save willybahuaud/b8a062be60c7998de9a9 to your computer and use it in GitHub Desktop.
Il faudrait tester cette astuce, pour voir si elle fonctionne :-)
<?php
// On désactive le précédent shortcode
remove_shortcode( 'pastacode' );
// On applique le notre
add_shortcode( 'pastacode', 'new_pastacode' );
function new_pastacode( $atts, $content = "" ) {
// On éxécute la fonction normal
$str = sc_pastacode( $atts, $content );
// On inverse
$re = "/(<pre.*<\/pre>\s)(<div class=\"code-embed-infos\">.*)/s";
$subst = "\${2}\${1}";
$result = preg_replace($re, $subst, $str, 1);
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment