For web developers who are familiar with WordPress and want to get started with their own themes and plugins
YAY for open source!
Everything I know I learned from the interwebs!
Keep in mind:
- WordPress is evolving RAPIDLY! If you want to know where it's going, you can find information on WordPress.org and even check out the WordPress trac.
- Random info/code on the web can be out of date or just plain wrong... always test, keep/make backups, and/or use version control.
Don’t be intimidated by a little bit of code! Copy and paste away, experiment with editing, and maybe you’ll learn something… A little goes a long way!
Oh good, I already know those stuffs! Now what are my options?
Use an existing theme framework or parent theme to make a child theme
Modify an existing theme (make sure the license allows this... many do!)
Writing a theme from total scratch without any copying and pasting is just plain silly! At least copy and paste the loop!
Do you like what’s already there? How familiar are you with it? How much customization do you need? Do you need WordPress widget support? Is it compatible with plugins you want to use? How many themes are you going to make? Should I modify a theme or build a child?
Watch out: random themes may have bugs or just not work as advertised, code might not be easy to follow or modify
Support network: free/paid access to forums and lists, paid development services
Is the code commented/self-explanatory? Is it valid XHTML? Cross-browser compatible? Is there an active, helpful, and enthusiastic community for support? Does the framework build upon WordPress’ existing standards or will I have to learn a whole new set of functions? How long will it take me to get up to speed? Does the framework do too much more than I need? Not enough?
For best (quick) results: Choose a popular, well-tested theme or framework
A separate WordPress theme that works in conjunction with and builds off of an existing parent theme, using as much or as little of the parent theme's styles, templates, and functions as you want it to!
You need to have the parent theme installed in order for the child theme to work (the child theme must be the activated theme).
New in 2.7: Override parent templates and add new custom templates
Child themes are definitely sounding more interesting these days… but are they really the answer?
New in 2.7: Override parent templates and add new custom templates (previously limited to CSS and functions) YAYs: Leverage parent theme upgrades without having to update your own custom theme. Oh noes: If you do major customization and override a lot of templates, there may be little to leverage in the parent theme.
Upgrades to the existing theme (adding features, enabling future WordPress compatibility, etc.) may still have to be merged into your customized one.
Child theme: Better for those who want to rely on the parent maker for upgrades and need less customization (best if you can do almost everything through CSS or PHP functions/plugins).
Modifying: For those who need more customization to the various templates. Less to learn and less files to manage, so everything’s a bit more straightforward.
Remember that themes may not always be standards compliant or fully supported by the latest WordPress release. This is why I often start with a cleaned up version of the default theme, Kubrick.
Personal opinion: I don’t want to learn a new complicated framework, I just want to support the WordPress core and would rather spend my time keeping up and learning to do more with it. Plus I don’t want any extra bloat in my theme. HOWEVER, if WordPress came out with an official theme framework as part of the core distribution then I’d probably jump on it! I usually either start with a theme the client has picked out and do as much customization as necessary, or when starting with a photoshop template I directly modify a blanked out WordPress default theme. I sell my support and customization services usually on an hourly basis and all of the sites are different. If a client wants an upgrade to a newer WP, then it’s beneficial to me that they pay for it! So it also depends on your business model.
Stylesheet (style.css) – Know your CSS! Template files – Site markup and a bit of PHP Functions (optional: functions.php) – Write custom PHP code to add functionality, features, and services to your theme!
WordPress loads the appropriate template and sets certain variables based on the query string
In your template, you need to write code that gets the content through these variables… eg. on most pages you’ll be iterating through an array posts
AND you also need to write the site markup to display this content on the page
Header, footer, sidebar, comments
Header/logo image – upload an image into the theme directory, adjust markup in header.php, and style with CSS Horizontal page menu – call WP function wp_list_pages(‘title_li=‘) in header.php and style with CSS Footer – adjust markup in footer.php and style with CSS
Even if you are new to themes, if you know CSS you can already do a lot just by editing stylesheets!
What CAN’T you do? You can make your site do almost anything!
Any function in functions.php can be written as a plugin (and vise versa) If the function only makes sense in your theme, then it’s probably better to put it in functions.php Main reason to make it a plugin: Share your super useful and cool functions across themes and with others!
For those who know PHP or aren’t afraid of it!
Override pluggable.php functions Use WordPress filters to manipulate data Use WordPress action hooks to run custom code where you want it Use built-in WordPress functions Access the database (using WordPress functions, of course) Connect WordPress to other applications and services
For example, I use my WordPress website to refresh profile boxes on my Facebook app more or less hourly, because Facebook caches the content otherwise.
Sometimes all you need is to be able to understand what a piece of code does to use it. What’s the point in doing something someone else has already done? At the very least you can check out the options, and if you feel like it, you can do it yourself better!
WordPress Themes and Plugins
A basic introduction for web
Use free resources!
• WordPress Codex: http://codex.wordpress.org
• Source code of other themes, plugins, and the
• Search the internet!
• WordPress support forums on WordPress.org:
I want a custom theme! What skills do
I need to have?
• Image editing (only if you plan on having any
images and they’re not already ready to go)
• Copy and paste!
Good to know:
• Make a child theme
• Modify an existing theme
• Write your own new theme (or framework)
from scratch with lots of copying and pasting!
Things to look for when researching
existing themes and frameworks
• Design and layout
• Ease of use and quality of code
• Support network
• Theme/framework/author reputation
• Internationalization support
• The good: Leverage parent theme upgrades
• The bad: Doing major customization may
mean there might not be much to leverage!
Building smarter, faster, better!
• Child theme: for those who want to rely on
the parent maker for upgrades and need less
• Modifying: for those who don’t care about
upgrades, want a simpler structure, and need
What is a WordPress theme?
• Stylesheet (style.css)
• Template files
• Functions (optional: functions.php)
Theme Name: MyTheme
General comments/License Statement if any..
What can I do with functions.php and
• Write any custom code!
• Override pluggable.php functions
• Use WordPress filter and action hooks
• Access the database (using WordPress
functions, of course!)
• Connect WordPress to other applications and
Plugins (and theme functions) don’t
have to be complicated!
• Your coding skill can range from non-existent
to expert (REALLY!)
• Search, research, and make liberal use of your
copy and paste skills
Plugin Name: Magic Plugin
Plugin URI: http://example.com/magic-plugin
Description: Magic Plugin performs magic
Author: Mr. MagicAuthor