HostPapa Explains: WordPress Shortcodes

Shortcodes in WordPress are bits of code that help you do certain things very easily. They started to function in WordPress 2.5 and made it very convenient to execute code inside WordPress pages, widgets, and posts without writing any actual code. 

You can use it to embed files or to create objects that would usually need a lot of coding knowledge. For example, you can embed a video with this shortcode:

[ video ]

You can also add attributes, the next one is an example of the video shortcode with an src attribute:

[video src="video-source.avi"]

WordPress has shortcodes for audio, caption, embed, video, and gallery. You can add other shortcodes with the Shortcode API plugin. 

If you want yo use the text of a shortcode in a post, you will need to use double brackets. So, if you want to display the text of the code instead of the actual video, you would need to use the shortcode with double square brackets:

[video]

Shortcodes are an easy option to add features to your WordPress site. Without them, adding galleries, videos, and other functions would require a lot of code editing. 

Shortcodes add HTML and other markup dynamically directly where you want them to show.

 

For further questions, or if you need help, please open a support ticket from your HostPapa Dashboard. Click here to learn how to do it.

Was this article helpful?

  • Was this article helpful ?

  • yes   no

Related Articles

Leave A Comment?