Skip to content

Overview

Drop-in multilingual subsystem for Terra WordPress sites. Lives in its own repo β€” terra-hq/wp-multilang β€” and is cloned into functions/framework/ so the Terra Framework auto-loads it. Adds URL prefix routing (/en/, /es/, /eu/), per-field ACF translations, per-language SEO, and a per-language sitemap behind a thin layer of terra_*() template helpers.


In a hurry? Here’s the bare minimum β€” no thinking required.

  1. Clone php-starter-core. Inside functions/, run git clone git@github.com:terra-hq/php-starter-core.git framework (the trailing framework renames the cloned folder).
  2. Clone wp-multilang. Inside functions/framework/, run git clone git@github.com:terra-hq/wp-multilang.git. The Terra Framework auto-loads it.
  3. Drop in the config. Create functions/project/config/multilang_config.php with at least two languages and a default.
  4. Flip the switch. wp-admin β†’ Terra β†’ System β†’ Multilang β†’ Enable.
  5. One line in header.php. Replace <html lang="en"> with <html <?php language_attributes(); ?>>.
  6. Drop the switcher. <?php terra_multilang_switcher(); ?> anywhere in your templates β€” header, footer, sidebar, wherever fits.
  7. Save permalinks. Settings β†’ Permalinks β†’ Save Changes.

That’s it. Anything you don’t translate falls back to the native field, so the site keeps working at your own pace.


Terminal window
cd functions
git clone git@github.com:terra-hq/php-starter-core.git framework

The trailing framework renames the cloned folder, so the framework lands at functions/framework/ (the path the rest of the project expects). Repo: terra-hq/php-starter-core.

Terminal window
cd functions/framework
git clone git@github.com:terra-hq/wp-multilang.git

The Terra Framework loads functions/framework/wp-multilang/load.php automatically β€” no extra require needed in your theme.

3. Create functions/project/config/multilang_config.php

Section titled β€œ3. Create functions/project/config/multilang_config.php”
<?php
return array(
'languages' => array(
'en' => 'πŸ‡ΊπŸ‡Έ English', // first entry = primary language
'es' => 'πŸ‡ͺπŸ‡Έ EspaΓ±ol',
// 'eu' => '🏴 Euskera',
),
'default' => 'en', // fallback when the URL has no prefix
);
  • Key: language code used in URLs (/es/), ACF sub-fields, and the date map.
  • Value: admin-visible label + switcher label.

wp-admin β†’ Terra β†’ System β†’ Multilang tab β†’ check Enable Multilang β†’ Save.

<html lang="en" dir="ltr">
<html <?php language_attributes(); ?>>

In any template (typically the footer or header):

<?php terra_multilang_switcher(); ?>

Auto-hides when there are fewer than 2 languages or when Multilang is OFF.

Settings β†’ Permalinks β†’ Save Changes (no need to change anything, just hit the button). This registers the per-language sitemap rewrite rules.

Knowledge Check

Test your understanding of this section

Loading questions...