Feature: the core plugin

A core plugin contains all custom functionalities serving for back-end operation. The front end display is remaining in the theme code.

WordPress custom post type in the core plugin

Recently, I have been working on some projects which the owners want to have some specific data. That requires me to use custom post types. So, how to implement it?

Traditional method

Usually, developers can add all add-on functionalities into functions.php file. The problem is that if you change the theme, all customized features stop working. The data is still there, but no back-end functions, no front-end display. It actually reminded me of a conversation with a friend before. He also develops websites but based on Joomla. What he hates in WordPress is everything included in functions.php file.

The core plugin

There is a better approaching. Instead of writing all code in functions.php, all add-on features now will be written as a plugin, which I call a core plugin. For example, registering a new custom post type, new meta boxes, etc. By that way, if the customer wants to change the theme, the back-end functions are still working, with all intact data. Splitting functions in different files, it also has much better code arrangement, that helps very much in the case of debugging and security.

I am going to deploy this method to all the websites, that are using my custom themes. That will not interrupt the website activities. The tasks include checking, rearranging the code, and they are different between websites. However, it only takes a few seconds for uploading the new functions.php file and activating the core plugin. The result is a better framework for each website ๐Ÿ™‚

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.