Skip to Content
WordPress® All-in-One For Dummies®
book

WordPress® All-in-One For Dummies®

by Lisa Sabin-Wilson, Cory Miller, Kevin Palmer, Andrea Rennick, Michael Torbert
April 2011
Beginner to intermediate content levelBeginner to intermediate
908 pages
22h 37m
English
For Dummies
Content preview from WordPress® All-in-One For Dummies®

Using a Plugin Template

When you start writing WordPress plugins, you find that you spend a significant amount of time rewriting the same things. Typically, most plugins have the same basic structure and are set up the same way, meaning that they all deal with settings pages, storing options, and interacting with particular plugins, among other things. You eventually conclude that a valuable use of your time is to create a template for all the plugins to save you hours of work each time you start a new plugin.

Such a template varies from person to person, and to you, depending on programming styles, preferences, and the types of plugins the developer wants to include. For instance, if you often write plugins that use your own database tables, you should include this in your template. Similarly, if your plugins almost never require options pages, leave those out of your template.

image When making a template, keep in mind your personal plugin preferences and tendencies.

To create your own template, determine what functionality and structure your plugins usually contain. Follow these steps:

  1. Create your file structure.

    As you write more plugins, you find yourself repeating the same general filenames. If you find that you're including enough JavaScript and CSS in your plugins to necessitate their own files or directories, include these in your template. For example, if you're using a lot ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WordPress® 24-Hour Trainer

WordPress® 24-Hour Trainer

George Plumley
Gaming Hacks

Gaming Hacks

Simon Carless

Publisher Resources

ISBN: 9780470877012Purchase book