Last active
August 29, 2015 14:08
-
-
Save jrobinsonc/908832758b4f953699d0 to your computer and use it in GitHub Desktop.
Wordpress shortcode: Shortcodes for native functions of wordpress.
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 | |
// Use shortcodes within text widgets | |
add_filter('widget_text', 'do_shortcode'); | |
// wp_nav_menu | |
add_shortcode('wp_nav_menu', 'wp_nav_menu_shortcode'); | |
function wp_nav_menu_shortcode($atts = array(), $content = '') | |
{ | |
$atts['echo'] = false; | |
return wp_nav_menu($atts); | |
} | |
// get_search_form | |
add_shortcode('get_search_form', 'get_search_form_shortcode'); | |
function get_search_form_shortcode($atts = array(), $content = '') | |
{ | |
return get_search_form(false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment