O'Reilly logo

WordPress 3.7 Complete Third Edition by Aaron Hodge Silver, Karol Król

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Shortcodes

Shortcodes are a handy way to let a nontechnical person, that is, the editor of the website, include dynamic functionality within pages and posts, without having to actually use any PHP, complex HTML structures, or custom JavaScript. In other words, shortcodes are handy reusable pieces of code, yet they don't require any actual coding experience or knowledge on the end user's part.

Shortcodes and the way they work

The way a shortcode works is that you tell WordPress to look at text within square brackets ([]) and evaluate it by running a PHP function. That PHP function can live in your functions.php file of your theme, or in a plugin file, or in a widget file. Let's create a simple shortcode and include it in with our most recent widget, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required