With over 76 million users, WordPress is the most popular Content Management System (CMS) on the web. There are always people looking for WordPress developers to enhance their website.
Modifying WordPress involves writing standalone code that interfaces with the WordPress core code. If you make any mistakes, the core code is untouched so you can experiment as much as you want without having to reinstall the WordPress software.
You can share your work for free on the WordPress Repositories, or monetize it on your own website or private marketplaces.
In this tutorial we will try to outline what you need to learn to become a WordPress developer.
Table of Contents
What Software Do You Need?
- A text editor such as Notepad++, NetBeans, Sublime Text.
- A local development server
- A working WordPress installation
What Can You Create/Develop?
You can change the look and feel of the site, the core behaviour, the admin panels, and more. With advanced knowledge of any web coding language, you could even create a whole new user profile page or an entirely new admin control panel. What you can do is only limited by your own knowledge and willingness to learn.
You can create:
- Themes – the look and the feel of the site;
- Plugins – changes or extends to the behaviour of WP;
- Widgets – to appear in sidebars and present specific information;
- Entire WordPress websites – combining themes, plugins, and custom code to create a unique website based on a client’s needs;
- New applications that use WordPress as the backend, using the REST API;
Themes effectively sit on top of WordPress. Information such as the title and content of a post are displayed by writing specific PHP functions in the HTML.
You can add new functions, remove default functions, change the content of information before it is displayed (such as adding text to a post title), etc.
Any change to WordPress’ behaviour should be done by creating a plugin. A user should be able to disable the plugin and have their site continue to function without errors.
What Do You Need to Know?
HTML (preferably HTML5)
Semantically valid HTML is required for the sake of the experience for the user. Valid HTML ensures that your pages look the same in every browser. If your code is not valid, browsers may interpret your code incorrectly and display parts of your page poorly. Writing valid HTML means using the correct syntax. Syntax refers to the overall document structure, the order of HTML elements, correctly nesting elements, and correctly formatting attributes.
A HTML document must be structured in the correct order starting with a DOCTYPE declaration, opening <html> tags, then a head section with document metadata such as the title of each page, a body section, and finally a closing </html> tag.
HTML elements are generally split in to flow elements (blocks) and phrasing content (inline).
Above is an example of correctly nested HTML.
Each HTML element has rules for what is allowed inside of it. Paragraph tags are allowed to have phrasing content (inline) inside them such as <b> (bold), <i> (italics), <a> (links) etc. They are not allowed to contain flow elements (blocks) such as <ul>, <div> etc. This differs for each element.
- Download a HTML cheatsheet;
- To learn what is allowed inside each HTML element, you should refer to the W3c HTML language reference;
- To ensure your code is valid, you can run it through the W3C HTML Validator;
CSS3 & Responsive design
Cascading Style Sheets (CSS) are used to style your page and its contents. From the color and font of text to the color of the background, you are able to control any part of the site. You can quickly make significant style changes that are applied to your entire site.
In the United States approximately 71% of internet traffic usage is mobile. Thus ensuring your layout looks perfect on every type of device is very important. Media Queries allow you to define how each part of a page behaves depending on the size or type of screen used to view the page.
PHP (Hypertext Preprocessor) is a scripting language that makes webpages dynamic. WordPress is built on PHP along with MySQL.
PHP takes care of the background tasks such as finding a post in the database and HTML is used to present the result of the PHP script after it has completed its tasks.
The most common features of PHP you will use are:
- Variables – used to store information such as strings of text or numbers;
- Arrays – a collection of information that is assigned to a variable;
- Functions – used to complete a task then give a result which can be used later, the result can be assigned to a variable;
- Conditionals – if 1 == 1 is true do something, if 1 == 1 is false do something else;
- Comparison operators – used to compare values with one another. There is a difference between =, ==, and === – this can affect the result of conditional statements;
For Object Oriented Programming (OOP), knowledge of PHP classes is required. Classes allow you to group variables and functions that are related to each other neatly in to one place.
In WordPress, all information relating to a specific post is stored as an object in the class named WP_Post after being retrieved from the database.
- See WordPress codex page for additional information – Class Reference/WP Object Cache;
A MySQL database is used to store all the information about a WordPress site, and the information is dynamically retrieved using PHP. The actual content of every page and post on a WordPress site is stored in the database.
WordPress provides a set of PHP functions to safely interact with the WordPress database and your statements should always be ran using the appropriate function. Some functions use standard SQL statements, some use arrays of information.
- The SQL functions are explained on the WordPress Developer Codex page – Talking to the Database: The wpdb Class;
WordPress makes use of AJAX in the admin control panel. For example, when writing posts and pages, it uses AJAX to auto-save drafts without you noticing.
Examples of WordPress Coding Standards
When creating themes or plugins for WordPress, you should follow the standards and formatting that the WordPress developers have chosen. Start by looking at any of the core PHP files to get a feel for the patterns used.
Note: Keeping code as clean and readable as possible is important.
Echoing HTML Attributes – esc_attr()
When outputting strings in HTML attributes, always use the WordPress function esc_attr() to escape certain characters and stop quotes breaking the HTML code.
Use tabs and not spaces when indenting. Use spaces between array key => value pairs so that the => are all aligned. Place each key/value on its own line. Place closing parenthesis on its own line.
Naming Variables, Functions and Classes
Variables and functions – always use lowercase and separate words with an underscore. The name should (briefly) explain what the variable or function is for.
Classes – class names must be capitilised words separated with an underscore to make them visually distinct from variables and functions.
Licensing Themes and Plugins
If you are selling your work on your own website, this section does not apply.
However, if you plan on sharing plugins or themes on the WordPress.org repositories, they MUST be free and released under a GPL-compatible licence.
GPL stands for General Public Licence and grants the user of your work certain rights when downloading and using them. WordPress developers recommend the GNU General Public License, version 2 or later.
All files in your work must conform to this license, including any third-party libraries you use. You must have the right to distribute any third-party libraries if included. It’s important that you understand exactly what rights this gives to users of your work.
Generally it ensures you retain appropriate copyrights to the original work. It allows users to modify your work and redistribute it in whole or in part. They must keep the original copyright notices intact and pass along a copy of the license you chose. They must make it clear that no warranty is provided with the software. If the user modifies then distributes the software, it must be clear that they have made changes and are not distributing the original work.
You must not lock any features behind a paywall, any paid functionality must be its own plugin. You can advertise the paid plugin as long as it isn’t intrusive or overly annoying.
For a full list of rules regarding the WordPress.org repositories, visit the Developers Handbook.
Making A WordPress Website For a Client
If you are making a WordPress powered website for a client, you’ll typically need to create themes and plugins. Any features/functions that are independant of the theme should be a plugin, so that in the future the person can easily switch to a new theme without losing important functions. It’s important to get an accurate picture of what the client wants before formally agreeing to do the work.
WordPress is a very popular piece of software. A lot of individuals and small businesses want custom websites with specific functionality that they can’t create themselves.
However, first you should make your own themes or plugins and upload them to the WordPress repository. Nothing sells you more than practical experience. The stronger your portfolio, the more likely you are to find higher paying work. Even just creating a demo WordPress site is valuable for your portfolio – some people just need help getting started.
You should also have a good understanding of what expectations your future clients may have. As well as what skill set you should develop to be a successful freelancer. Thus it would be a good idea to find yourself on the other side and see what kind of WordPress developers people are searching for.
The best way to find work is to look for freelance requests. You can also offer your services on these websites and hope you’re picked out of the thousands of other profiles, but you’re going to have more success proactively seeking clients to work with.
Some popular freelance directories:
Contracts and Invoices
When making an agreement with a client, it’s important to have recorded proof of your agreement. You should always make a contract that both you and the client must sign. It should clearly state your pay rate for the work and the extent of the work. It should state whether you are charging a flat fee or an hourly rate. There should be an agreed deadline or time frame for delivery to the client. You should also give the client a reasonable amount of time to complete payment upon delivery.
After the work is complete you should send the client an invoice that lists your work, the date it was delivered, the final price, etc.
Both of these protect you legally. If you have no proof of an agreement, the client can simply choose not to pay and there’s little you can do about it. They also make sure both parties know exactly what is expected of you to satisfy the client.
There are plenty of online services to generate professional digital contracts and invoices with all the required information. Be sure to proof read anything you are sending to the client.
Tip: Always read up on contract law in your country before generating a contract and taking work.
Taxes and Income
The rules regarding taxes and income differ from country to country. It’s extremely important that you understand when you are considered as self-employed and when you should start paying taxes on your income.
In the U.K. for example, if you regularly sell licenses for a theme you created, you are a self-employed trader. If you sell your service creating WordPress websites to clients, you are self-employed. If your income from self-employment is over £2500, you must pay taxes on it. If your income is as high as £85,000 per year, you must also pay VAT on it. Failing to know the law can lead to a lot of financial and legal problems.
This tutorial outlines everything you need to know about how to become a successful WordPress developer. Once you learn how WordPress uses themes and plugins, applying your own code effectively becomes very easy. What you can achieve is limited only by your own knowledge and willingness to expand it.
This post was last modified on September 21, 2017, 5:33 am