Created
December 29, 2013 12:19
-
-
Save birchestx/8169831 to your computer and use it in GitHub Desktop.
Add shortcode [code]some code[/code] to wordpress
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 | |
| /* | |
| Plugin Name: Code Shortcode | |
| Description: Add shortcode [code]some code[/code] to wordpress | |
| Version: 1.0 | |
| Author: Karen Baker | |
| License: GPL2 | |
| */ | |
| add_action( 'wp_enqueue_scripts', 'prefix_code_add_my_stylesheet' ); | |
| function prefix_code_add_my_stylesheet() { | |
| wp_register_style( 'prefix-code-style', plugins_url('style.css', __FILE__) ); | |
| wp_enqueue_style( 'prefix-code-style' ); | |
| } | |
| add_shortcode( 'code', 'sc_code' ); | |
| function sc_code( $atts, $content = null ) { | |
| return '<code>'.$content.'</code>'; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment