WordPress shortcode element allows you to add any WordPress shortcode to your layout. Visual Composer Website Builder will execute and render this shortcode and display the result in Frontend editor and to your website visitors.
How to add WordPress shortcode to a page?
To add WordPress shortcode to your page, open the Add Content window and search for the Shortcode element. Once you add the element to your layout, you will see an Edit window with parameters and the option to enter shortcode. Copy/paste or enter shortcode with its attributes.
What is WordPress Shortcode?
Shortcode is a WordPress specific code that allows inserting advanced features or content blocks within your site. WordPress shortcode is based on Shortcode API which is a set of simple functions that can be used by developers to create those content blocks.
Note: You can read more about how to create a shortcode via Shortcode API in the official WordPress Codex.
A typical example of a shortcode would be [videoplayer], such shortcode (most likely) would output video. Of course, shortcodes can have additional attributes.
In the example above, we would probably want to point shortcode to output specific video which would look like this: [videoplayer id=”1″].
So, does that mean you can simply write [videoplayer id=”1″ size=”fullscreen”] to create a fullscreen video on your WordPress site? Not really, some developer (or maybe you) should create such shortcode via Shortcode API and add it to your site (via theme or plugin.) At the same time, not all shortcodes must be added via plugins or themes, some are already there – WordPress default shortcodes. Default shortcodes are very basic content blocks that can help you deal with the audio, caption, embed, gallery, and video.
Even though WordPress shortcode is a lot easier way to add functionality to your site there are still drawbacks like:
- Performance issues (if you have tons of shortcodes);
- It’s still a code (you still need to write it).
Lots of shortcodes can easily create a mess on your site, and this is where WordPress builders can help you out. Instead of dealing with shortcodes, you can use regular builder elements, compatibility elements, or WordPress shortcode elements to add shortcodes via a visual interface. This means that if you are not a technical person and just want to create your own website you don’t have to be afraid of shortcodes – most likely you will never see them.