Improving WordPress Shortcode Usability
read more

Improving WordPress Shortcode Usability

In this tutorial we are going to talk about WordPress shortcodes and what I think is the missing piece with shortcodes in WordPress.

First I’ll start by saying I really like shortcodes, it allows you to give the author of the website full control of the content on the site and where it is positioned.

A shortcode allows the user to run a PHP function at any point you want in the content. A default shortcode you get with WordPress is the gallery shortcode, to add a gallery to your website all you have to do is add [ gallery ] to the content area of your website.

The name inside the square brackets is the name of the shortcode that you want to run at this position of the content. WordPress will then search for shortcodes on the the_content filter and using the function do_shortcode() will run the functions at this point of the content, the return of these functions will then be output into the rest of the content area.