Rural Blog docsAll pages

Override templates

Copy a file from the parent theme into your child theme, keeping the same path, and WordPress loads yours instead.

wp-content/themes/rural-blog/template-parts/content.php
                     ↓ copy to
wp-content/themes/rural-blog-child/template-parts/content.php

That is the whole mechanism.

The templates

File Renders
index.php Every listing: blog home, posts page, category, tag, author, date, CPT archive
single.php A single post
page.php A page
search.php Search results
404.php Not found
comments.php The comment thread and form
searchform.php The search form
header.php Everything to the start of the content
footer.php The footer, scroll-to-top and the mobile panel
template-archives.php The Archives page template

The template parts

File Renders
template-parts/content.php One post in a listing — all three display modes
template-parts/content-single.php The body of a single post
template-parts/content-page.php The body of a page
template-parts/content-search.php One search result
template-parts/content-archives.php The Archives page body
template-parts/content-none.php “Nothing here”
template-parts/archive-header.php The title/description block above a listing
template-parts/author-bio.php The author box
template-parts/tags.php The tag list
template-parts/sticky-label.php The Pinned post label

Before you copy anything

Check there is not a setting for it. Most of what people reach for a template override to do is a Customizer control — the meta position, the display mode, whether the author box appears.

Check there is not a hook for it. Adding an ACF field to the meta row is the rural_blog_meta action, not a copy of content.php. See Hooks and filters.

Copy the smallest file that does the job. Overriding template-parts/tags.php is a file you will never have to look at again; overriding index.php is a file you now maintain against every future release.

Functions, not templates

The theme’s template tags are all wrapped in if ( ! function_exists() ), so a child theme can define its own version of one before the parent loads and the parent will step aside. rural_blog_post_meta(), rural_blog_post_thumbnail(), rural_blog_pagination(), rural_blog_site_branding() and the rest are all replaceable this way.

Define yours in the child’s functions.php — it loads first — and the parent skips its own.

This is often cleaner than copying a template: you replace one function rather than inheriting a whole file’s future changes.

Keeping up with updates

An overridden file is frozen at the version you copied. When the parent changes that file in a later release, your copy does not get the change — including bug fixes.

Note which files you have overridden and skim the changelog at each update for changes that touch them.