Last Updated on January 24, 2017
Filed under Dev

Introduction to Customizations

The Sweetness framework is built to be used right out of the box with little fuss. The available options within Theme Options allows you to style and define your layout in a unique way. With that said, there is always a reason to "Customize" your setup either for yourself or for the client beyond what is available from Theme Options. These Developer docs will help guide you in the available tools within Sweetness such as using action hooks, filters, API's, and template parts.

Action Hooks

Action hooks are one of the most defining developer features of WordPress. They are points in the software that you can “hook to” in order to execute your own code. Sweetness is filled with tons of its own custom action hooks. Having most of the framework’s functionality hooked to an action, in one way or another, is crucial in making the theme as extendable for you, as possible.

Learn More

Filters

Filters are technically another type of “hook” — but instead of simply executing code like with an action hook, they allow us to filter a piece of data. Generally speaking, when a piece of data is passed through a filter, it gives you a chance to manipulate that data, before it gets used, executed, or printed out.

Learn More

Template Parts

Template parts in WordPress allow themes to take sections of their larger theme files and reduce them to smaller included files, throughout. The benefit here is that these smaller template part files can then be simply copied from the main, parent theme to your child theme, to make edits.

Learn More

Pluggable Functions

A pluggable function is a function setup in a way that allows you to simply copy it to your child theme’s functions.php, in order to edit it.

Pluggable functions are not as popular around the WordPress community, as they once were. And over time, we’ve made strides to reduce the amount of pluggable functions within our theme framework, but have left many, for the sake of backwards-compatibility.

If you’re new to making PHP customizations from a child theme, pluggable functions are seemingly the easier way to go, at first glance. But as you start copying entire functions, that you didn’t write, to your child theme just to make small changes, you’ll see that things quickly become a mess. I personally would avoid editing functions in this way, and take advantage of hooking in custom functions instead, via actions.

Learn More