Template Structure and Overrides
Free themeHow BuddyX organizes its templates and template parts, and how to override any of them safely from a child theme.
BuddyX loads every template and partial through WordPress core functions (get_template_part(), get_header(), get_footer(), comments_template()). Nothing custom sits between WordPress and the file system. That means overriding a BuddyX template is the ordinary WordPress child-theme workflow: copy the file from the parent theme into your child theme at the same relative path and edit the copy. WordPress loads the child-theme version first and never touches the parent's original.
Requires PHP 8.0+.
Two kinds of files
BuddyX splits its markup into two layers:
| Layer | Location | Role |
|---|---|---|
| Root templates | Theme root (single.php, archive.php, page.php, ...) |
Chosen by the WordPress template hierarchy for a given request. They set up the page shell and pull in partials. |
| Template parts | template-parts/ |
Small, reusable partials loaded by root templates (and by each other) with get_template_part(). This is where most of the actual output lives. |
Because both layers are plain PHP files loaded by core functions, both are overridable the same way.
Root templates
The files WordPress selects directly for a request. Copy any of these into your child theme root to replace it.
| File | Renders |
|---|---|
index.php |
Fallback for the blog home, archives, and search. Dispatches to a layout part. |
single.php |
A single post or custom post type entry. |
page.php |
A static page. |
archive.php |
Category, tag, taxonomy, date, and author archives. |
search.php (via index.php) |
Search results reuse the index.php flow. |
404.php |
The "not found" page. |
500.php / offline.php |
Server-error and offline (PWA) fallbacks. |
header.php / footer.php |
Site head/top chrome and footer/bottom chrome. |
sidebar.php |
The default widget sidebar. |
sidebar-buddypress.php |
The BuddyPress-specific sidebar. |
buddypress.php / bbpress.php |
Wrappers for BuddyPress and bbPress screens. |
comments.php |
The comment list and comment form. |
searchform.php |
The search form markup. |
single-fluent-products.php |
Single template for the Fluent products post type. |
Template-part folders
Everything under template-parts/ is a partial. Override an individual partial to change one piece of the page without touching the root template that loads it.
| Folder / file | Renders |
|---|---|
template-parts/layout/ |
The four blog/archive list layouts: entry-default-layout.php, entry-list-layout.php, entry-grid-layout.php, entry-masonry-layout.php. index.php picks one based on the customizer layout setting. |
template-parts/content/ |
The building blocks of a single entry: entry_title.php, entry_meta.php, entry_content.php, entry_summary.php, entry_thumbnail.php, entry_media.php, entry_categories.php, entry_tags.php, entry_taxonomies.php, entry_footer.php, entry_actions.php, plus the per-context wrappers entry-post.php, entry-page.php, entry-full-width.php, entry-attachment.php, entry-header-post.php. |
template-parts/content/ (utility) |
pagination.php, page_header.php, and the error states error.php, error-404.php, error-500.php, error-offline.php. |
template-parts/header/ |
Header pieces: branding.php (logo/site title), navigation.php (primary and mobile menu), custom_header.php, buddypress-profile.php. |
template-parts/footer/ |
info.php, the copyright/credit row. |
template-parts/post-format/ |
Per-format entry output: entry-audio.php, entry-video.php, entry-image.php, entry-gallery.php, entry-quote.php, entry-link.php. |
template-parts/content-buddypress.php |
Wrapper for BuddyPress content areas. |
template-parts/content-bbpress.php |
Wrapper for bbPress content areas. |
How part loading resolves the file
get_template_part() takes a slug and an optional name, and looks for {slug}-{name}.php first, then falls back to {slug}.php. BuddyX uses this in two common ways:
// From index.php - loads template-parts/layout/entry-grid-layout.php
// (or entry-default-layout.php, entry-list-layout.php, entry-masonry-layout.php).
get_template_part( 'template-parts/layout/entry', $post_layout, $args );
// From entry-grid-layout.php - loads template-parts/content/entry_meta.php,
// unless a post-type-specific entry_meta-{post_type}.php exists.
get_template_part( 'template-parts/content/entry_meta', get_post_type() );
Two consequences for overriding:
- To replace a partial for all post types, override the base file (for example
entry_meta.php). - To replace it for one post type only, add a name-suffixed file at the same path (for example
entry_meta-product.php). BuddyX does not ship that variant, but core will load it if your child theme provides it.
Data passed as the third argument ($args) is available inside the loaded part as $args, so overrides keep the same variables the parent relied on.
Overriding a template: worked example
Goal: change the post meta line (author + date) shown on blog entries. That markup lives in template-parts/content/entry_meta.php.
1. Have a child theme. A minimal child theme is a folder with a style.css header and a functions.php:
buddyx-child/
├── style.css
└── functions.php
/* style.css */
/*
Theme Name: BuddyX Child
Template: buddyx
*/
<?php
// functions.php - load the parent stylesheet.
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style( 'buddyx-parent', get_template_directory_uri() . '/style.css' );
}, 20 );
2. Copy the file at the same relative path. From the parent theme, copy:
themes/buddyx/template-parts/content/entry_meta.php
into the child theme, preserving the path:
themes/buddyx-child/template-parts/content/entry_meta.php
3. Edit the copy. For example, drop the author avatar and show a plain "Posted on" date. Keep the namespace BuddyX\Buddyx; line at the top - the part runs in that namespace, and functions like buddyx_is_truthy() are resolved against it:
<?php
/**
* Child override: simplified post meta.
*
* @package buddyx
*/
namespace BuddyX\Buddyx;
?>
<div class="entry-meta">
<span class="posted-on">
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
<time class="entry-date published" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>">
<?php echo esc_html( get_the_date() ); ?>
</time>
</a>
</span>
</div><!-- .entry-meta -->
4. Reload. WordPress now loads the child-theme entry_meta.php everywhere BuddyX calls get_template_part( 'template-parts/content/entry_meta', ... ) - blog, grid, list, and masonry layouts all pick it up automatically, because they all resolve through the same slug.
The same three steps work for any file in the tables above: match the relative path, copy, edit.
Prefer hooks and filters when they exist
Copying a template part means you own that markup - if a future BuddyX release changes the original, your copy will not pick up the change. Before overriding, check whether a hook or filter already exposes the behavior you need, and use that instead. BuddyX fires action hooks around most structural regions (for example buddyx_entry_before / buddyx_entry_after in entry-post.php, and buddyx_before_content / buddyx_after_content) and exposes filters for meta such as copyright text (buddyx_footer_copyright_text) and image crops. A hook survives theme updates; a template copy does not. See the hooks and filters references for the full inventory.
Do not edit the parent theme
Never edit files inside themes/buddyx/ directly.
- Any BuddyX update overwrites the parent theme wholesale, silently discarding your edits.
- Direct edits are invisible to the next developer - there is no diff against a pristine parent to review.
- A syntax slip in the parent can take down every site running the theme, not just yours.
Every change belongs in a child theme (template overrides, functions.php, extra CSS) or in a companion plugin (hook and filter callbacks). Treat the parent theme as read-only.
Related
- Developer documentation
- Child theme setup
- Action hooks
- Filter hooks
- Design tokens
- Assets and the manifest