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 https://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.
Leave a Reply