Tip: Use a WordPress shortcode outside the loop

by

in

Hey! Today i have a quick tip tip for you! How many times did you try to insert a shortcode outside the loop? In a text widget for example, in a menu item, in your author biographical information or anywhere else… to do that, there’s a really simple function called: do_shortcode(). Just use it this way:

One response to “Tip: Use a WordPress shortcode outside the loop”

  1. Robert

    I haven’t tried this yet, but in you said “in a menu item”. So do you mean using this I can use a shortcode as a link in the built-in WP menu functionality? I want to use a shortcode from a plugin that creates a modal login window and I would love to have a link in my nav menu that says “Login” and then calls that modal window using a shortcode. The plugin has the shortcode, but I can’t use it in the menu since WP removes the square brackets and prepends an http:// on it.

Leave a Reply