Child themes, template overrides and hooks

Hooks & Filters 5 min read

Everything here survives updates. That is the reason to use these routes rather than editing files directly.

#Getting a child theme

A child theme is not shipped in the package. The download contains the theme and the Pro plugin, and no child theme, because a child theme is yours: it exists to hold your changes and nobody can write it for you in advance.

There are two ways to get one.

The generator built into the toolkit. It creates a correct child theme and activates it in a few clicks, with the right template header and the right stylesheet loading. This is the route to use.

White label and the child theme generatorThe tool does one thing: it creates a child theme. People want one for two different reasons. Most come for the first, so that is where this starts. The generator is on the White-Label tab o...JKD Toolkit

By hand. A child theme is a folder in wp-content/themes/ with a style.css whose header names the parent in a Template: line, plus a functions.php that loads the parent's stylesheet. That is the whole requirement, and WordPress documents it in the child theme guide. Take this route if you want to control every file.

#Overriding templates

One idea covers all three sources: a file placed in the child theme takes precedence over the file in the product.

The theme

The native WordPress mechanism. Copy the template or the template part into the child theme, keeping the same path, and edit the copy.

The Pro plugin

Copy the plugin's templates folder into the child theme and rename it to the plugin slug.

An integration

The same rule, with the folder named after the integration slug.

So the child theme ends up with the theme files at their normal paths, and one folder per plugin or integration whose templates you override.

#Copy as little as possible

An overridden template stops receiving our changes. Every file you copy will slowly drift away from the product.

Before copying anything, check whether a setting already does it, and whether a filter already does it. Both are cheaper than owning a template forever.

An overridden template is your code from that moment on.

If it breaks after an update, that is the expected cost of pinning a file, not a regression in the product, and it is why the advice is to copy the minimum.

#What this means for support

A child theme is not a shelter. Code you wrote is yours wherever it lives, and an override or a snippet in functions.php is still your code after it has been copied into a child theme.

We do look at a bug in one of our own filters or hooks used as documented, because that is ours. The full boundary, including what counts as customization rather than support, is written out separately.

Customizing the code: limits and responsibilityRead this before you open a file. A change to the code moves responsibility for the consequences to whoever made it. If something stops working after your own edits, that is not a support ca...Customization

#Filters, hooks and front end events

This is the supported way to change logic. Customization through these points survives updates; changes made around them do not, and are outside support.

The extension surface is being deliberately widened before release, so the specific names, signatures and examples are documented last. Publishing them early would mean documenting something that changes before anyone reads it.

The surface covers general extension points in the theme and the Pro plugin, filters over the query and the markup of post listings, insertion zones in the single post, and front end events fired when content loads without a page reload, which covers continuous reading and pagination.

If the extension point you need is missing, send a feature request. We consider adding hooks on request.

Sending a feature requestSuggestions go through your account, separately from support requests. They are recorded, and an accepted one becomes a roadmap entry you can follow. How many you get Feature requests are li...Customer Hub

#Common questions

Does a child theme slow the site down?

Not measurably. It loads one extra stylesheet reference, and that is not where a page's weight comes from.

Can I create a child theme after the site is built?

Yes, because content and settings live in the database. Walk the site afterwards, though, since a few settings are stored per theme and start empty on the child.

Which is better, a filter or a template override?

A filter, whenever one exists. It survives updates to the template, while an override pins the file as it was on the day you copied it.

How do I know which template to copy?

Find the one that renders what you want to change and copy only that one. Copying a parent template "just in case" pins a file you never needed to own.

An override stopped working after an update

The template you copied changed on our side. Compare your version against the current one and reapply your edit on top of the new file. That is the standing maintenance cost of every override, and the reason to keep the number of them small.

I am stuck and I want to ask somebody

Inside your support window we answer small, ordinary questions about how to use the extension points, and getting help with your theme explains what to send and where. Writing the customization itself is paid work rather than support.

#Still stuck

Open a support ticket and say what you tried and where it stopped. Your product, your domain, a screenshot and the exact message you saw are usually enough to settle it in one reply.

Last updated

Was this article helpful?

FIND THE ONE THAT FITS YOUR PROJECT

Import a demo, swap the content, adjust the layout. Modern WordPress under the hood, fast even when the site fills up.