Created
April 30, 2012 02:27
-
-
Save jubalm/2554988 to your computer and use it in GitHub Desktop.
wordpress - useful shortcodes
This file contains 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 | |
// Useful Shortcodes | |
add_shortcode('home_url', 'return_home_url'); | |
add_filter('widget_text', 'do_shortcode'); // enable shortcodes on widgets | |
function return_home_url() { | |
return home_url(); | |
} | |
add_shortcode('theme_url', 'return_theme_url'); | |
function return_theme_url() { | |
return get_bloginfo('template_url'); | |
} | |
add_shortcode('uploads_url', 'return_uploads_url'); | |
function return_uploads_url() { | |
$uploads_dir = wp_upload_dir(); | |
return $uploads_dir['baseurl']; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment