What are WordPress shortcodes and how do I use them?
Shortcodes in WordPress are little bits of code that let you do various things with little effort. With shortcodes, one single line is all it takes to add functionality to your website that would otherwise need a lot of coding. All our plugins generate WordPress shortcodes. You can use them the same way you’d use any other WordPress ones.
There are 3 ways of using our plugins’ shortcodes:
- You can insert them into the content of any web page or blog post. Just copy the shortcode to the Content Editor when you edit a page or a post.
- You can insert the shortcode into a text widget. It can be useful when you have to add a plugin to a sidebar. By default the text widget doesn’t support WordPress shortcodes. There are 2 ways to make them work with it:
- https://wordpress.org/plugins/shortcodes-in-sidebar/ – you can install and activate this plugin. It will automatically enable shortcodes inside the text widget.
- Another way to make shortcodes work with the text widget is for your theme to have a special filter:
If your theme doesn’t include it, then it’s necessary to add this filter to functions.php file of the theme (make sure that you are very attentive when editing this file). After that drag and drop a text widget into any sidebar and copy the shortcode into the text widget.
- You can insert the plugin shortcode into a template, footer or any other PHP-file of your WordPress theme. To do this, use the following function:
<?php echo do_shortcode('[instashow id="1"]'); ?>
Learn more about this function at https://developer.wordpress.org/reference/functions/do_shortcode/