Learning WordPress as a Drupal Developer

Posted on May 31, 2019 - 8 Minute Read

I started my career in web development by using Drupal 7 on every project. I just assumed that WordPress could not meet my needs, and that it could not be customized as well as Drupal. However, after working within WordPress for several years, I've learned that WordPress can match Drupal's functionally, and can almost always meet my needs no matter what the project scale.

This is a a guide for any Drupal Developer that wishes to learn WordPress.

Drupal Concept WordPress Equivalent Notes
Views WP_Query Read More
Rules Action Hooks Read More
Blocks Widgets Read More
Roles and Permissions Members Plugin Read More
Custom Content Types register_post_type and ACF Read More
Vocabularies register_taxonomy Read More
Field Collection Module and Paragraphs Module ACF Flexible Content Read More
drush wp_cli Read More
Zen Theme Underscores Theme Read More

Views => WP_Query

Arguably the most powerful Drupal feature is Views. Views lets a site builder create complex database queries without having to write any SQL, or know anything about databases. It also allows site builders to create advanced search features based on user input. If you're like me, then you probably didn't realize WordPress offers the same functionality. However, they key difference is that you write your queries using the WP_Query API.

If you're coming from Drupal, this might seem foreign. However, there are a lot of advantages to writing you're own queries instead of relying on a module.

Advantages

  • Complete control of the output markup. Drupal Views adds a lot of bloat.
  • Changes are stored in the codebase. This means they are saved in version control. You don't need to worry about exporting views, or creating Features.
  • More secure (this is my opinion). The only way to create, edit or delete a custom query is if you have access to the codebase, unlike Drupal.

Examples

Rules => Action Hooks

Another powerful Drupal feature is Rules. The Rules module allows site administrators to define conditionally executed actions based on occurring events. For example, using Rules, a site builder could trigger an email to be sent every time a new post is created, or display a custom message once a user signs in.

However, the same functionality can be achieved in WordPress using the Action Hooks API. The main difference is that you code these conditional triggers instead of building them via a UI.

Advantages

  • Changes are stored in the codebase. This means they are saved in version control. You don't need to worry about exporting rules, or creating Features.
  • More secure (this is my opinion). The only way to create, edit or delete a custom Rule is if you have access to the codebase, unlike Drupal.

Examples

Blocks => Widgets

Drupal has the concept of Blocks, which are boxes of content rendered into an area, or region, of a web page. WordPress has the same concept, only they're called Widgets.

There's not a big difference between Drupal Blocks and WordPress Widgets, but it's important to know that both CMSs offer the same functionality.

Advantages

  • You have more control over the markup of Widgets compared to Blocks.
  • Cleaner markup.

Roles and Permissions => Members Plugin

By default, Drupal has a very robust Roles and Permissions system baked in. In my opinion, WordPress Core is lacking in this area. However, the Members Plugin will add some familiar functionality to your WordPress install.

I've personally had great luck using this plugin when building small to medium sized sites that needed a more customized authorization system.

Custom Content Types => register_post_type and ACF

Drupal lets site builders easily create Custom Content Types. WordPress Core makes this a little more difficult. WordPress has the register_post_type API, which allows you to create a custom post type. However, you need to either use a plugin, or use the wp cli. I strongly recommend using the wp cli since it's one less plugin to install, and you can save your post types into version control. However, the register_post_type API is not enough in most cases. You'll also want to install ACF in order to add fields to your new custom post type. ACF is a staple in the WordPress ecosystem, just like Views is a staple for Drupal 7.

Examples

Vocabularies => register_taxonomy

Drupal lets site builders easily create Vocabularies. WordPress Core makes this a little more difficult. WordPress has the register_taxonomy API, which allows you to create a custom taxonomy. However, you need to either use a plugin, or use the wp cli. I strongly recommend using the wp cli since it's one less plugin to install, and you can save your taxonomies into version control.

Examples

Field Collection and Paragraphs Modules => ACF Flexible Content

Drupal allows site builders to build dynamic layouts using a combination of the Field Collection Module and the Paragraphs Module. WordPress has a similar paradigm in the form of ACF Flexible Content. Unfortunately this is paid solution, but it's well worth the purchase, and also the only real alternative if you're coming from Drupal.

It's important to note that WordPress now ships with Gutenberg, which is a visual editor. This might solve your layout needs as well.

drush => wp_cli

Drupal has a command line tool called drush. WordPress has an equivalent called wp_cli. Both are CMS specific, and are very helpful. If you depend upon drush for your Drupal development, then you'll come to love the wp_cli if you're working in WordPress.

Zen Theme => Underscores Theme

Most Drupal themers use the Zen Theme as a base theme. The WordPress equivalent is Underscores Theme.

Advantages

  • Underscores is developed by the same team that builds WordPress. This means it's stable, and is guaranteed to meet follow practices and meet compatibility standards.

Examples

Categorized In: