O'Reilly logo

WordPress: Pushing the Limits by Rachel McCollin

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

Chapter 9: Custom Functionality in Theme Functions and Plugins

WordPress is designed to be added to. A vanilla WordPress installation gives you a great deal you can use to build a website, such as the ability to add pages with a hierarchical structure, posts, category and tag archives, menus, widgets, and more. But if you want to take it further (for example, by adding your own custom post types or taxonomies or linking to external APIs such as Google and Twitter), you'll need to include additional functionality. Most sites you build will likely need functionality that isn't included in the core WordPress installation. There are three ways you could do this:

• Use an off-the-shelf plugin, either by downloading a free one from the WordPress plugins repository at http://wordpress.org/extend/plugins/ or by buying a premium one. You can use any plugins you download as is, or you can edit them to meet the needs of your project. But if you do edit a third-party plugin, you won't be able to take advantage of automatic updates for that plugin.

• Write your own plugin.

• Add functionality via the theme's functions.php file.

This chapter assumes that you need to code your own functionality, so you will be using the functions file or your own plugin. The method you choose doesn't affect the result—it's largely the same code, after all; but it does affect the maintainability and flexibility of any site you build, or the scope of a theme or theme framework you're developing.

The first ...

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