Theme vs Plugin: What Should I Use on WordPress?

What adds beauty and brains to a WordPress website? Theme and Plugin! Themes define the look-and-feel of the website (i.e. design and layout) and  Plugins add new functionality to the website. A WordPress website can have only a single theme set across the whole website. But multiple plugins can be installed to introduce various functionalities.

So when you create a WordPress website, when would you use a theme and when would you use a plugin? Let me explain this through a couple of examples.

EXAMPLE 1: USING A Theme

I have a blog where I write about Books and Movies (i.e. two Categories). I want to create two Category Pages:

  • Books with a two-column style page listing all the books I have read
  • Movies with a three-column style page listing all the movies I have seen

Now apart from the content the key difference between the two pages is the layout – two-column vs three-column. To do this, I can create two php files as part of my theme called page-book.php and page-movie.php. I can define the layout for my two pages in these php files. And Voila!

EXAMPLE 2: USING A Plugin

I have a blog in which I want to introduce a Facebook Like button at the end of each blog post or article. First I create a plugin in which I write the functionality for the Facebook Like button. Then in my theme files, I can refer to my plugin code to display it at the bottom of each blog post or article.

Theme vs Plugin
Though I have cleanly differentiated themes and plugins in my above examples, there will sometimes be overlaps. For example, there are plugins that exist to change certain design elements and sometimes functionality is built into themes.

One way I decide whether to introduce a change through a theme or plugin is by answering the two questions:

  1. Is the change introducing a new functionality?
  2. If I changed the look and feel of the website with a new theme, would I still want the new functionality?

If the answer to both these questions are “Yes”, then I would definitely go with a plugin. Otherwise, I would go for a theme.

Keeping plugin functionality separate from themes is WordPress development best practices. This gives me the added benefit of being able to extend capabilities of one theme to another and to keep the theme less “bloated”.

REFERENCES

Check Also

Website Header with HTML5 and CSS3

A Simple Website Header with HTML5 and CSS3

I have not been writing much about my website development process recently. I recently created …

One comment

  1. One of the best articles on this topic.

Leave a Reply

%d bloggers like this: