Customization

Child Themes

March 17, 2026 docsadmin 4 min read

A child theme is a small WordPress theme that depends on Legal as its parent. It inherits everything Legal does — templates, styles, functions, customizer settings — and lets you selectively override anything you need without touching Legal’s own files.

This is the right approach when:

  • You’re customizing Legal for a specific firm and the changes go beyond CSS (different number of practice tiles, different hero layout, custom post types, custom fields)
  • You’re rebranding wholesale (different fonts, different palette, different copy patterns) and your override CSS is creeping past 100 lines
  • You want your customizations to survive Legal updates indefinitely with zero risk

If you’re just changing a color or two, use Customizer → Additional CSS instead. See Adding Custom CSS.

Creating a child theme — minimum viable

A working child theme needs exactly two files. Create a folder under wp-content/themes/; let’s call it legal-mychambers/.

1. style.css

/*
Theme Name:   Legal — My Chambers
Theme URI:    https://example.com
Description:  Custom child theme of Legal for our chambers.
Author:       Your Firm
Version:      1.0.0
Template:     legal
Text Domain:  legal-mychambers
*/

/* Your overrides start here. */

The two non-negotiable headers are Theme Name and Template. The Template value must exactly match the parent theme’s folder name — legal.

2. functions.php

<?php
/**
 * Legal — My Chambers child theme.
 */

defined( 'ABSPATH' ) || exit;

/**
 * Enqueue the parent theme's stylesheet, then ours.
 */
add_action( 'wp_enqueue_scripts', 'legal_mychambers_enqueue', 20 );
function legal_mychambers_enqueue() {
    wp_enqueue_style(
        'legal-parent-style',
        get_template_directory_uri() . '/style.css',
        array(),
        wp_get_theme( 'legal' )->get( 'Version' )
    );
    wp_enqueue_style(
        'legal-mychambers-style',
        get_stylesheet_uri(),
        array( 'legal-parent-style' ),
        wp_get_theme()->get( 'Version' )
    );
}

That’s the minimum. Activate it under Appearance → Themes, and your site is now running the child theme. Visually nothing has changed yet — but you can now start adding overrides.

Overriding a template

To override one of Legal’s templates, copy it from wp-content/themes/legal/ into your child theme folder, keeping the same filename. WordPress will use your version instead of the parent’s.

Common templates to override:

  • template-firm.php — the Firm Home page template. Copy this if you want to add or remove sections, change their order, or restructure the layout.
  • header.php / footer.php — site-wide header and footer markup.
  • single.php — single blog post layout.
  • archive.php — the journal/blog index.

Smaller customizations (e.g., changing one section of the firm template) are often easier to do via filters and actions than full template overrides. The Legal theme exposes a few useful hooks:

Filter and action hooks

Hook What it does
legal_dynamic_css Filter — append CSS to the theme’s inline stylesheet. Used by Pro features.
legal_fonts_url Filter — replace the Google Fonts URL.
legal_pro_active Filter — returns whether Legal Pro license is active. Useful for conditionally adding child-theme features that depend on Pro.
legal_schema_org Action — fires inside <head> with LegalService schema markup. Add additional schema by hooking at priority 11+.
legal_header_extras Action — fires inside the header next to the CTA. Used by Pro for the dark mode toggle. Drop in your own buttons here.

Example — add a custom CSS rule from your child theme:

add_filter( 'legal_dynamic_css', 'mychambers_extra_css' );
function mychambers_extra_css( $css ) {
    return $css . "
        :root {
            --lg-accent: #1e3a5f; /* navy instead of oxblood */
        }
        .lg-hero { padding-bottom: 8rem; }
    ";
}

Adding a new section to the firm page

The cleanest path: copy template-firm.php to your child theme, find the structural comment block where you want to insert your section (the parent template uses clear comment dividers), and add your section there.

Example: adding a “Press” section between Counsel and Ledger:

<?php /* ===== PRESS ===== */ ?>
<section class="lg-press" id="press">
    <div class="lg-container">
        <div class="lg-section-eyebrow">Press</div>
        <h2 class="lg-section-head">
            <?php esc_html_e( 'Selected coverage,', 'legal-mychambers' ); ?>
            <em><?php esc_html_e( 'in the public record.', 'legal-mychambers' ); ?></em>
        </h2>
        <!-- Your press content here -->
    </div>
</section>

Then style it in your child theme’s style.css using Legal’s existing patterns.

Things that don’t need a child theme

Don’t reach for a child theme if all you’re doing is:

  • Tweaking colors → use Additional CSS
  • Replacing copy → use Customizer fields
  • Adding tracking scripts → use a plugin like Insert Headers and Footers
  • Adding analytics → use the Pro plugin’s analytics module if you have it, or a dedicated plugin

Child themes are powerful but add complexity. Use them when you genuinely need template-level overrides or PHP customization, not as the default approach.

Leave a comment