WordPress/Mandigo/FAQ/How do I edit the header navigation links
From onehertz
Contents |
How do I edit the header navigation links?
By default, the links that show up in the header navigation are:
- the Home link, which is hardcoded in the template
- the links to the pages you've created, MINUS the ones checked for exclusion in the Theme Options page
Editing/Removing the Home link
Edit header.php, head to the bottom of the file and look for this line:
<li class="page_item"><a href="<?php echo get_option('home'); ?>/"><?php _e('Home', 'mandigo'); ?></a></li>
Removing
If you want to completely remove the Home link, just delete the whole line and save changes.
Editing
The "_e('Home', 'mandigo')" part in the anchor text is the code that invokes the translation function for "Home". It's fine to get rid of that part and replace the whole line with something like this:
<li class="page_item"><a href="<?php echo get_option('home'); ?>/">Return to Homepage;</a></li>
Adding new links
Just as for editing/removing the home link, open header.php and head to the bottom of the file. You should see a block of code that look like this (version 1.36):
<ul class="pages png<?php echo ($mandigo_options['header_navigation_stripe'] ? ' head_overlay' : ''); ?>">
<li class="page_item"><a href="<?php echo get_option('home'); ?>/"><?php _e('Home', 'mandigo'); ?></a></li>
<?php
// wordpress pages, minus the ones excluded in the theme options
wp_list_pages(
array(
'sort_column' => 'menu_order',
'depth' => ($mandigo_options['header_navigation_no_submenus'] ? 1 : 2),
'title_li' => '',
'exclude' => @implode(',', $mandigo_options['header_navigation_exclude_pages']),
)
);
?>
</ul>
Besides the opening and closing ul tags, as stated in the introduction all we have is:
- the Home link (the li tags)
- the pages created in WordPress: "wp_list_pages()"
- minus the ones you chose to exclude: "'exclude' => @implode(',', $mandigo_options['header_navigation_exclude_pages'])"
From there, all that is left to do add a new link is to clone and edit the Home link, and add it either right after the Home link, or right before the closing </ul> tag, like so:
<ul class="pages png<?php echo ($mandigo_options['header_navigation_stripe'] ? ' head_overlay' : ''); ?>">
<li class="page_item"><a href="<?php echo get_option('home'); ?>/"><?php _e('Home', 'mandigo'); ?></a></li>
<li class="page_item"><a href="http://www.google.com/">Google</a></li>
<?php
// wordpress pages, minus the ones excluded in the theme options
wp_list_pages(
array(
'sort_column' => 'menu_order',
'depth' => ($mandigo_options['header_navigation_no_submenus'] ? 1 : 2),
'title_li' => '',
'exclude' => @implode(',', $mandigo_options['header_navigation_exclude_pages']),
)
);
?>
<li class="page_item"><a href="http://www.yahoo.com/">Yahoo!</a></li>
</ul>
Saves changes, and that's it!
For reference, our example would produce the a navigation bar that looks like this:
Home - Google - WP page1 - WP page2 - Yahoo!
