How to make custom Shortcodes in WordPress

Shortcodes are very useful to bloggers. You can use them to easily execute functions you have already created, which especially helpful for functions that are repeated often. Just add this WordPress Code Snippet to the functions.php file in your current WordPress theme in order to make custom Shortcodes in WordPress.

/**
 * Make custom Shortcodes in WordPress
 *
 * @author WPSnacks.com
 * @link http://www.wpsnacks.com
 */
function say_hello() {
return 'Hello Everyone!';
}
add_shortcode('say-hello', 'say_hello');

Then you just need to put [say-hello] anywhere in your content that you want to display the content of the shortcode you just created. You can obviously change this function around to suit your needs.

You can also click here to find out How to use shortcodes in your WordPress theme template files

Hope this helps, enjoy.

   Related Sponsored Links

Disclaimer: The information contained in this website is for general information purposes only and in no event will this site or its owners be liable for any losses or damages associated with your use of our site or content. Click here to see our full Disclaimer.

Leave a Comment

*