Page Templates
Base wrappers:
- header.php loads templates/partials/header.
- footer.php loads templates/partials/footer.
- page.php is the basic fallback template for regular pages.
Where page templates live:
- wp-content/themes/balinot/templates/page-*.php
Current custom page templates:
- templates/page-home.php
- templates/page-aviso-legal.php
- templates/page-politica-privacidad.php
- templates/page-politica-cookies.php
- templates/page-politicas.php
Common template pattern:
- Call get_header().
- Open a main wrapper.
- Load sections with get_template_part().
- Optionally read ACF fields per section.
- Append global FAQs or reviews if the template needs them.
- Call get_footer().
Home example:
- templates/page-home.php defines an ordered sections array.
- Most sections are rendered from templates/partials/home/
{slug}.php. - FAQs, reviews, and help are handled explicitly because they have extra logic.
Legal pages example:
- templates/page-aviso-legal.php and the other legal templates load a hero partial first.
- Then they load a specific content partial from templates/partials/textos-legales/.
- Then they append the generic FAQ and review blocks.
Recommended structure for a new page template:
- Create templates/page-my-page.php with a Template Name header.
- Keep the wrapper thin.
- Move real section markup into templates/partials/my-page/.
- Read ACF or settings data inside each section partial when the section owns that data.
Recommended naming for a reusable page template:
- Template file: templates/page-about.php
- Partial folder: templates/partials/about/
- Section partials: hero.php, intro.php, values.php, team.php, faq-cta.php
Recommended naming for a one-off page tied to one page record:
- Partial folder: templates/partials/about-10445/
- Use this only when the partial set is intentionally bound to a single page and not meant to become a reusable template family.
Template recipe for a new “About us” page:
- Create templates/page-about.php.
- Define an ordered sections array.
- For each section, load templates/partials/about/
{section}.php. - Keep FAQs, reviews, and other global blocks in templates/partials/general/ when they are shared across pages.
- If the page needs dedicated CSS or JS, register an about rule in modules/00-enqueue.php.
Minimal example:
<?php
/*
Template Name: About
*/
defined('ABSPATH') || exit;
get_header();
$sections = ['hero', 'story', 'values', 'team'];
?>
<div class="w-full max-w-full">
<main class="w-full overflow-hidden">
<?php foreach ($sections as $section) : ?>
<?php get_template_part("templates/partials/about/`{$section}`"); ?>
<?php endforeach; ?>
<?php get_template_part('templates/partials/general/faqs'); ?>
<?php get_template_part('templates/partials/general/reviews'); ?>
</main>
</div>
<?php get_footer(); ?>Good rule:
- Page templates should orchestrate sections.
- Partials should own the actual section markup.
Last updated on