New — Sohay now answers WooCommerce product, policy & cart questions. See how →

Overriding a Knowledge Base template

Copy a template into your theme and Sohay steps aside entirely. Which files, where they go, and how block themes behave.

When CSS is not enough — you want different markup, a different page shape, or extra content on the index — copy the template into your theme. Sohay then steps aside for that surface completely.

The files

Copy out of the plugin’s templates/ directory into a sohaychat/ directory in your theme:

Copy this To here
archive-sohaychat_kb.php yourtheme/sohaychat/archive-kb.php
taxonomy-sohaychat_kb_category.php yourtheme/sohaychat/taxonomy-kb-category.php
search-sohaychat_kb.php yourtheme/sohaychat/search-kb.php
parts/{name}.php yourtheme/sohaychat/parts/{name}.php

A conventionally named template in your theme root works too — archive-sohaychat_kb.php, taxonomy-sohaychat_kb_category.php — and wins for the same reason: naming the post type is being explicit about which surface you mean.

What does not count as explicit is a generic archive.php. That is the whole reason these templates exist: a reverse-chronological list of titles is not a knowledge base.

Copy, do not edit in place

Edit the plugin’s own files and your changes disappear at the next update. The theme copy is the supported route, and it survives.

The parts

The templates are built from smaller parts, so you can often override one piece rather than a whole page. Each receives its data as ordinary local variables:

Part Receives
header.php / footer.php
search-form.php the placeholder text and current value
category-card.php one section
section.php one section, and its articles
article-list.php article IDs, and the articles

A “section” is one category’s entry on the index — its name, description, URL, total article count, the IDs actually being listed, and whether there are more. category-card.php is the smallest useful thing to override: it is one card, and it is what most index redesigns are actually about.

Block themes

If your block theme defines a template whose slug is archive-sohaychat_kb, taxonomy-sohaychat_kb_category, or search-sohaychat_kb, Sohay leaves it alone entirely. Core resolves block templates before the filters Sohay hooks, so this is checked explicitly rather than left to chance.

Otherwise Sohay’s PHP templates render, with your theme’s own header and footer template parts inside a document shell the plugin emits. Block themes have no header.php for the classic template functions to find, and letting WordPress fall back would print chrome belonging to no theme at all.

Where to go next

Restyling the Knowledge Base pages if a stylesheet would have been enough after all.

Mithun B.
Mithun B.

More articles by Mithun B..

View all posts

Give your website an assistant that answers from your content

Grounded answers, a team inbox, and store-aware tools — free on WordPress.org.

Add Sohay — Free

Free plugin · You bring your OpenAI key · Works with any theme