Created
September 25, 2012 18:23
-
-
Save serkanalgur/3783555 to your computer and use it in GitHub Desktop.
function for comments shortcode
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
function phpcode($atts, $content = "") { | |
return '<pre class="php">'.esc_attr($content).'</pre>'; | |
} | |
function csscode($atts, $content = "") { | |
return '<pre class="css">'.$content.'</pre>'; | |
} | |
function htmlcode($atts, $content = "") { | |
return '<pre class="html">'.esc_html($content).'</pre>'; | |
} | |
function init_common_shortcodes() { | |
add_shortcode('html', 'htmlcode'); | |
add_shortcode('php', 'phpcode'); | |
add_shortcode('css', 'csscode'); | |
} | |
function init_comment_shortcodes() { | |
remove_all_shortcodes(); | |
init_common_shortcodes(); | |
add_filter('comment_text', 'do_shortcode'); | |
} | |
init_common_shortcodes(); | |
add_filter('comments_template', 'init_comment_shortcodes'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment