One of my favorite themes for WordPress is the Mandigo theme provided by a great developer named Tom from OneHertz.com. The theme is highly customizable and provides ways to customize things outside of the core files so when you upgrade you are not required to make all the modifications over again. I suggest anyone looking for a 2 or 3 column WordPress theme to check this out. One thing I like to do after installing the Mandigo theme is to modify the order of the header navigation. The header navigation links are dynamically generated from top level pages you have created. Below are brief instructions on how to make sure the order of the header navigation menu is in the order you want them to be in as well as a brief description of the code that allows this to happen.
Modify WordPress Mandigo Theme Header Menu Order:
Modifying the header menu order is very easy but each time you add a page you will need to make sure to keep up with the configuration. To modify the header menu order simply set the Order (located under Attributes) for each top level page created. Attributes is the title of a box in the right column when you are editing or creating each page and is shown in the below image.
As you can see above there are three different configuration items located under Attributes which include Parent, Template, and Order. If the page you are creating is a top level page meaning it has no parent page then you will need to set the Order attribute. The order starts with 0 and moves up from there and if numerous pages have duplicate Order numbers then the page ID will be used. So if you have three pages titled Company, News, and Support that should show up in alphabetical order but they are not just modify the Order attribute of each page. In this example if you make the Company page have Order 1, the News page have Order 2, and the Support page have Order 3 then they will now display in the Mandigo WordPress theme in the proper order.
Mandigo Theme Header Menu Code Location:
The above order is specified in the header.php file which is located in the wp-content/themes/mandigo directory. In the header.php file the top menu is created on lines 315 to 331 as shown below.
Mandigo WordPress Theme Header Navigation Menu Code Snipet:
- 315 <ul>
- 316 <li><a href="<?php echo get_option('home'); ?>/"><?php _e('Home', 'mandigo'); ?></ a></li>
- 317 <?php
- 318 // wordpress pages, minus the ones excluded in the theme options
- 319 wp_list_pages(
- 320 array(
- 321 'sort_column' => 'menu_order',
- 322 'depth' => ($mandigo_options['header_navigation_no_submenus'] ? 1 : 0),
- 323 'title_li' => '',
- 324 'exclude' => @implode(',', $mandigo_options['header_navigation_exclude_pages']),
- 325 )
- 326 );
- 327 // if you want to add custom static links at the end, use something similar to the following
- 328 // <li><a href="http://whatever.com/">Go somewhere</a></li>
- 329 // and put it right before the closing </ul>
- 330 ?>
- 331 </ul>
The specific line that determines the pages order in the array is line 321 which specifies to sort the column by menu order. Again menu order is determined dynamically by whatever you set while editing each page in the WordPress admin.