Last active
August 29, 2015 14:13
-
-
Save willybahuaud/b8a062be60c7998de9a9 to your computer and use it in GitHub Desktop.
Il faudrait tester cette astuce, pour voir si elle fonctionne :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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