Using wordpress shortcodes anywhere

WordPress shortcodes are normally only displayed when the_content() is being fired.

You can however, if you know the shortcode and its parameters, paint it anywhere you like on your WordPress website. Its not practical to use for all plugins, as alot of them uses a referance to the post they are supposed to represent. (normaly the_content() is part of the loop).

Do this to display a shortcode anywhere on your WordPress site, this example will show the subscribe2 plugin signup form with only the “subscribe” button:

Often you need to take care that the plugin’s shortcode can be used like this – does it depend on a post_id, does it need to return stuff to the screen after a form has been submitted and so on..

Skriv kommentar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *