Skip to content

Instantly share code, notes, and snippets.

@kachi
Created March 10, 2012 17:23
Show Gist options
  • Save kachi/2012198 to your computer and use it in GitHub Desktop.
Save kachi/2012198 to your computer and use it in GitHub Desktop.
<?php
function escape_my_code( $attr, $content = null ) {
$content = clean_pre($content);
return '<pre"><code>' .
str_replace('<', '&lt;', $content) .
'</code></pre>';
}
add_shortcode('code', 'escape_my_code');
?>
/*記事内で[code]<?php echo 'Hello World!' ?>[/code]と書く*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment