Skip to content
No results
  • The journey to better code
  • Articles
  • Tools
  • Projects
  • About
  • Contact
    • Thank you for your message
draghici.net
  • All articles
  • About
  • Contact
draghici.net

WordPress menu in a shortcode

  • Cristi DraghiciCristi Draghici
  • January 21, 2015
  • Programming / Development
function print_menu_shortcode($atts, $content = null) {
     extract(shortcode_atts(array( 'name' => null, ), $atts));
     return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}
add_shortcode('menu', 'print_menu_shortcode');

Source:

Call a navigation menu using a shortcode

# php# Wordpress
Previous Post Check if port is open from Ubuntu command line
Next Post Migrating from PHP to node.js

Categories

  • Everything else
  • Programming / Development
  • News and fun facts
  • Useful tools
  • My projects

Tags

Android Apache application Bootstrap css digitalocean docker dotenv editors git Github hidden hosting html javascript jenkins jest jquery json laravel Linux macOS mysql node.js npm nvm ohmyzsh online openlayers parser php postgres raspberry pi react redux SlimPHP ssh Starfish Ubuntu Virtualmin Vue.js webmin website Windows Wordpress

A quick note

I post here articles that I found interesting, solutions to problems I have encountered and last but not least, display information about my projects and achievements.

Around the web

draghici.net © 2006 - 2023  - Most of the rights reserved