How I Learned to Love WordPress

Photo by Luca Bravo on Unsplash

I’ve been using WordPress for over five years now but I’m really just starting to enjoy working with it. Mostly it’s been a love/hate relationship. I never really embraced it and pretty much used it reluctantly because I had no choice.

Lately I’m taking a different attitude toward my WordPress work. I used to say that I like to bend WordPress to my will. But now I’m learning more and more about how to use all the built in wonderful stuff that WordPress offers. Leveraging what’s already there instead of trying to make WordPress into something it’s not.

It’s been a long and difficult journey but I’m finally learning to love WordPress development.

Here is some advice to help new WordPress devs avoid this anxiety.

Learn PHP

You can build a decent WordPress theme without PHP knowledge. But it is very difficult to fully understand WordPress functions and troubleshoot if you don’t understand the code.

Use the best tool for the job

WordPress is a wonderful blogging and content management system. For these kinds of projects it is my go to platform. However, it is not the best data driven application tool.

I learned this from the experience of trying to use it on a side project. It was a disaster. I thought that I could use custom post types and taxonomies to organize a large database of information.

I ended up building this site with Laravel quickly and painlessly. I will never try to build a large data app with WordPress.

Browse the source code for built in goodness

The WordPress codex provides wonderful documentation but one of the best sources I’ve found is the code itself. It’s full of comments and internal documentation.

Its useful for discovering powerful and obscure WordPress functions.  Its also a great PHP learning tool.

Don’t reinvent the wheel

WordPress has a lot of built in functions. If you think you need a custom function make sure that one doesn’t already exist. Don’t fight WordPress, leverage its functions to build your application.

Use custom posts and taxonomies liberally

With the addition of custom posts and taxonomies WordPress became a full cms. Now instead of post and pages we can actually organize content by type. No more service pages now we have a service custom post type with specific metadata.

We can also create custom archives and single templates to display the custom post types and their unique metadata.

Organize your code

One of my biggest frustrations with WordPress is the lack of code organization. There is no separation of views and models. All the logic and queries are embedded in the templates.

Still, some organization is possible. Separate any markup that repeats into partials. Break up any files that get too long. I find that it is much easier to maintain small modular files.

Reuse, reuse, reuse

Organized code is also easy to reuse. Its always best to write code once and move on to other tasks. In WordPress this is easy to accomplish. Focus on writing flexible code that you can use over multiple projects. Build a library of commonly used functions and use it in all your projects.

Build your own framework for consistent workflow

A lot of WordPress theme development involves writing boilerplate code. Most themes have the same basic parts. Posts, pages, header, etc. You will be more productive if you use a framework and focus your energy on custom functionality and style.

You can use one of the many existing frameworks but I recommend building your own. This will help you dig deeper into WordPress and really learn theme development. Even if you use existing frameworks you should know how to code it yourself.

Hopefully these tips can save you some of the pains I had to go through while learning WordPress.

About Beth Rogers

Beth

Beth Rogers is a Web Developer and Consultant living in San Antonio Texas. With over 10 years of experience she helps businesses create beautiful, functional experiences online.

More From Beth Rogers