2015-08-11, 00:35:48
Just to unpack what was said above:
- Download the I18N Custom Fields Plugin
- Use it to create a field with the name 'subtitle'
- For each page that you want to have a subtitle, edit the page and give it a value for the newly created 'subtitle' field
- Create a component (in Theme -> Components) for your menu called 'menu_custom' with the following code:
PHP Code:
<li class="<?php echo $item->classes; ?>">
<a href="<?php echo htmlspecialchars($item->link); ?>">
<!--title-->
<?php echo htmlspecialchars($item->text); ?>
<!--subtitle-->
<span class="subtitle"><?php echo htmlspecialchars($item->subtitle); ?></span>
</a>
<?php if ($item->isOpen) { ?>
<ul><?php $item->outputChildren(); ?></ul>
<?php } ?>
</li>
- Whilst in Theme, edit the template for your active theme. Where your menu is supposed to be rendered (e.g. in the header template in
header.inc.php
or whichever template file has your navigation), replace the call toget_navigation()
with:
PHP Code:
// Get the current page id
$slug = get_page_slug();
// Render the custom navigation with component 'menu_custom'
get_i18n_navigation($slug, 0, 0, I18N_SHOW_NORMAL, 'menu_custom');