Developers
Extend Marketers Delight with Hooks and Template Overrides
Hooks, filters, template overrides, and one base class behind every Drop-in. Customize as far as you need and keep taking updates.
Every hook, filter and API ships in the free theme
table-of-contents/Files
table-of-contents/
├─ templates/ ← overridable
│ ├─ html.php
│ └─ meta-box.php
├─ config.json
├─ css.php ← dynamic CSS
└─ table-of-contents.php ← main classtable-of-contents.phpPHP
public function actions() {
$this->name = __( 'Table of Contents', 'md-toc' );
add_action( 'md_hook_layout_after_toggles', array( $this, 'layout_fields' ), 10, 2 );
// …
}GPL
Open source
GitHub
MarketersDelight/marketers-delight
WordPress
6.2+
PHP
7.4+
jQuery
None on the front end
Five ways to extend
Go as Far as You Need
Start with a setting. Reach for code only when a setting can’t do it. Every step lives outside the theme folder, so updating Md never undoes your work.
Settings
Design, layout and header options in the admin. No code at all.
Template parts
Override the PHP/HTML file that renders one part of your site.
Drop-ins
Add features that install like part of the theme.
Hooks & md_api
md_hook_* actions, md_filter_* filters and the md_api base class.
Child theme
Full control of templates and styles, like the Twelve Springs demo.
Md theme core updates on its own. Nothing above it is touched.
✓ Safe on every update
← Lighter
Heavier →
Hooks, filters & templates
Change One Piece. Leave the Rest Alone.
md_hook_* actions and md_filter_* filters run through every part of the page. When markup needs to change, md_template() checks your child theme’s templates/ folder first, then falls back to the theme’s own file.
md_hook_*actions from header to footermd_filter_*filters on settings and output- Override theme and Drop-in templates by path
functions/asset-functions.phpPHP
function md_template( $file, $path = null, $include = null ) {
// …
$template = locate_template( "templates/$file.php" );
if ( ! $template ) {
$directory = MD_DIR;
// …Your child theme’s copy wins. The theme’s stays untouched.
md_api
One Base Class Behind Every Feature
Built-in features and Drop-ins all extend md_api. register() declares where settings appear, actions() wires up hooks, and the fields and settings APIs handle the forms and saving.
register()for admin pages, meta boxes and term screensactions()for hooks and filters- Fields and settings API built in
features/layout/admin.phpPHP
public function register() {
$this->name = __( 'Layout', 'md' );
return array(
'admin_page' => array(
'name' => $this->name,
'group' => 'page_settings',
'fields' => $this->fields()
),
'meta_box' => array(
'name' => $this->name,
'child_of' => 'page_settings',
'fields' => $this->fields()
),
// 'term' => array( … )
);
}One fields() set, two admin screens.
Build your own Drop-in
Ship a Drop-in the Way Md Ships Its Own
A Drop-in is a folder: a main class, a config.json, templates and an optional css.php. Push a version tag and a GitHub Actions workflow builds the release zip. It installs like part of the theme.
- Same structure as the built-in Drop-ins
- Release zip built on every version tag
- Templates overridable from a child theme
md-dropins/table-of-contents/Files
table-of-contents/
├─ .github/workflows/
│ └─ build-release.yml
├─ js/
├─ templates/
│ ├─ html.php
│ └─ meta-box.php
├─ config.json
├─ css.php
└─ table-of-contents.phptable-of-contents.phpPHP
public function actions() {
$this->name = __( 'Table of Contents', 'md-toc' );
$this->id = str_replace( '-', '_', $this->slug );
add_action( 'md_hook_layout_after_toggles', array( $this, 'layout_fields' ), 10, 2 );
add_filter( 'md_filter_save_layout_fields', function( $fields ) {
$fields['toc'] = array(
'type' => 'checkbox',
'options' => array( 'add', 'remove', 'sticky' )
);
// …
} );
}Adds a TOC option to Layout settings without editing the theme.
Helper classes
Lay Out Templates Without Writing CSS
Spacing, columns, gap, stack, color and type helpers ship with the theme. They’re generated from the same spacing scale as everything else, so gap-mid in your template always matches your settings.
stackandgap-*for vertical rhythmcolumns-*grids andmt-*,mb-*spacing- Color and type helpers like
has-muted-colorandcaps
css/helpers.phpPHP
foreach ( array_keys( $spacers ) as $size )
echo ".mt-$size:not(:first-child) { margin-block-start: var(--md-$size); }\n";
echo ".stack > * { --md-stack-gap: var(--md-single); }\n";
// …
echo ".gap-$size, .columns-$size { gap: var(--md-$size); }\n";templates/loop/the-post.phpHTML
<div class="columns-3 gap-mid">
<div class="stack gap-half">
<h3 class="caps small">Step one</h3>
<p class="has-muted-color">…</p>
</div>
</div>Classes in, no stylesheet to maintain.
Dynamic CSS
Compiled, not computed
CSS That Knows Your Settings.
Served as a Plain File.
Md’s stylesheets are PHP templates. Your settings fill them in and the result is saved as static CSS, so you can write targeted, dynamic styles with nothing computed per request.
Template
css/–vars.phpPHP
:root {
--md-half: <?php echo $spacers['half']['desktop']; ?>px;
--md-single: <?php echo $spacers['single']['desktop']; ?>px;
--md-mid: <?php echo $spacers['mid']['desktop']; ?>px;
}CSS with PHP holes. Drop-ins ship a css.php too.
Your settings
Typography › Body
Font size20
Line height32
$single32
$mid48
Spacing follows body line height, so one setting moves the whole scale.
Static file
compiled .cssStatic CSS
:root {
--md-half: 16px;
--md-single: 32px;
--md-mid: 48px;
}Plain CSS, cached like any other file.
About 128 --md-* custom properties compile the same way: colors, spacing, shadows, content box, header and footer.
At a glance
What’s Under the Hood
No jQuery
No front-end feature in Md uses jQuery, so there’s less to load and nothing to conflict with your own scripts.
Accessible markup
aria-expanded and aria-current patterns in the header nav, Table of Contents and Breadcrumbs.
Requirements
Md runs on WordPress 6.2 or newer and PHP 7.4 or newer. Those are the only minimums, so you can check them before you install.
Multisite
Run Md across a WordPress network. Each site keeps its own design, settings and Drop-ins, and your network admin manages the license and Drop-in files. Read the guide →
Integrations
Adobe Fonts and analytics, plus MailChimp, AWeber, ConvertKit, ActiveCampaign, MailerLite and Drip through Optins.
Tested
PHPUnit tests cover the theme, including a dedicated Loop inheritance suite that checks how settings cascade.
Deprecation layer
Older hooks and functions keep working, so Drop-ins written for earlier versions don’t break on update.
GPL, on GitHub
The full theme is GPL. Read every line, open issues, and fork it if you want to. View the repo →
Block & Classic Editor
Both editors share the same styles, so templates render the same either way. Read the explainer →
Documentation
Developer guides for hooks, templates, md_api and building your own Drop-ins. Read the docs →
Why isn’t Md on WordPress.org?
Its Drop-in system and custom fields API fall outside the theme directory’s rules. MD is still GPL, and the full source is on GitHub.
Will updates break my customizations?
Not if they live outside the theme folder. Settings are saved in the database, overrides and code live in your child theme, and Drop-ins have their own folder. An update only replaces the theme’s own files.
Do older Drop-ins keep working?
Yes. A deprecation layer keeps older hooks and functions running, so a Drop-in written for an earlier version still works while you update it.
Can I override a Drop-in’s templates?
Yes. md_template() checks your child theme’s templates/ folder first for theme and Drop-in templates alike, using the same path.
Is there a real child theme to learn from?
Twelve Springs, our demo site, runs on an MD child theme.
Does Md use jQuery?
No front-end feature in MD uses jQuery.
What are the requirements?
WordPress 6.2 or newer and PHP 7.4 or newer.
Keep Exploring
Start Building, Free
The whole theme is GPL. Download it, read the source, and build your first override today.
WordPress 6.2+ · PHP 7.4+