BlueTheme Docs

Child theme and overrides

Put every change to the theme's code in the child theme (or a plugin), so theme updates don't overwrite it. BlueTheme ships a ready-made child theme, bluetheme-child.

The child theme

bluetheme-child/
  style.css       theme header; your CSS goes here
  functions.php   loads style.css after the theme's styles, and the child's translations
  languages/      your .po/.mo files for the bluetheme-child text domain
  screenshot.png

Install both zips in Appearance → Themes → Add New, then activate BlueTheme Child. Theme Options, templates, menus and widgets stay as they are: they belong to the site, not to the active theme.

  • CSS: the child's style.css loads after the theme's stylesheets. Use the theme's custom properties (var(--bt-color-primary), var(--bt-radius)) and logical properties (margin-inline-start) so your CSS follows Theme Options and works in both directions.
  • PHP: add actions and filters in functions.php, prefixed with your own name. Every hook the theme offers is in the hooks reference.
  • Translations: strings in the child use the bluetheme-child text domain, loaded from languages/.

Overriding template files

Copy a file from bluetheme/ to the same path in bluetheme-child/ and edit the copy. WordPress loads the child's version.

File What it prints
header.php, footer.php The document head and the start and end of the page. The header and footer themselves come from templates or template-parts/header and template-parts/footer.
index.php, archive.php, search.php, single.php, page.php, 404.php The page types.
template-parts/content/*.php A post in a list, a single post, a page, a search result, "nothing found".
template-parts/blog/*.php Blog parts: the post loop, filters, the author box, related posts, previous and next.
template-parts/header/*.php The classic header (when no header template applies), the mobile header, the menu panel, the search panel, the action bar.
template-parts/footer/site-footer.php The classic footer (when no footer template applies).
template-parts/portfolio/*.php The portfolio archive and project page.
template-parts/page-title.php, pagination.php The title bar and page numbers.
comments.php, searchform.php, sidebar.php As in any theme.

Copy as few files as you can. A copied file doesn't get the theme's later fixes, so prefer a hook when one exists:

  • bluetheme_before_header, bluetheme_after_header, bluetheme_before_content, bluetheme_after_content, bluetheme_before_footer, bluetheme_after_footer: print something at that point on every page. Theme Options → Global → Hooks does the same without code.
  • bluetheme_layout, bluetheme_has_sidebar, bluetheme_subheader_title, bluetheme_copyright: change a value the templates use.

Pages made with the builder and headers, footers and other templates made in Templates are not files; change them in the builder.

WooCommerce templates

BlueTheme styles WooCommerce through hooks and CSS and doesn't replace its template files. Override one the WooCommerce way: copy it from wp-content/plugins/woocommerce/templates/ to bluetheme-child/woocommerce/ at the same path. Single product and shop pages can also be built as templates in the builder, with the product elements.

Adding to the builder

  • Elements: a folder in bluetheme-child/elements/. See adding an element. Every element can be used on pages and in every kind of template; the header category only groups the ones made for headers and footers.
  • Pre-built sections: design the section in the builder, save it as a template and export it (Templates → Export). Then add the exported section with the bluetheme_library_sections filter:
add_filter( 'bluetheme_library_sections', function ( array $sections ): array {
	$file = json_decode( file_get_contents( get_stylesheet_directory() . '/sections/promo.json' ), true );
	// Id => [ label, category, section node ]. Categories: hero, about, services,
	// features, team, pricing, testimonials, cta, contact, stats.
	$sections['child_promo'] = array( __( 'Promo', 'bluetheme-child' ), 'cta', $file['document']['sections'][0] );
	return $sections;
} );

Adding options

Add your own Theme Options sections and fields with the bluetheme_options_sections filter, and read them with Options::get(). See Theme Options internals.

Icons and fonts

  • Icon packs: upload a zip of SVG files with Upload icon pack… in any icon picker, or register a pack with the bluetheme_icon_packs filter.
  • Fonts: upload WOFF2 files in Theme Options → Fonts → Custom fonts, or add families with the bluetheme_fonts_families filter.