O'Reilly logo

WordPress 3 Complete by April Hodge Silver

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.

How do shortcodes 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 theme by adding it to functions.php.

Creating a simple shortcode

Let's say you want to add a page with your bio on it and the text of your most recent post. Your bio won't change every day, but your most recent post will. We ...

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