Custom Navigation
In version 1.3 of the Options theme, the way we handle page and category navigation changed greatly. Files were moved in support of the new child theme concept.
To edit your navigation, you need only add a function or two to your child theme’s functions.php file.
Custom page navigation
You can read how the wp_list_pages() function works from the WordPress Codex. It will allow you to customize which pages, the order, and how many other things are displayed.
We need to write a simple function to overwrite the default. Here’s an example with a “Home” link added:
<?php
function my_custom_nav() {
?>
<ul id="nav">
<li class="page_item<?php if(is_home()) { echo ' current_page_item'; } ?>"><a href="<?php bloginfo('url'); ?>" title="Home">Home</a></li>
<?php wp_list_pages('title_li=&depth=3&sort_column=menu_order'); ?>
</ul>
<?php
}
Then, we need to filter the original function:
add_filter( 'op_main_nav', 'my_custom_nav' ); ?>
That’s it.
Custom category navigation
If you need to change the way categories are displayed, then you need to know about the wp_list_categories() function works from the WP Codex. You can control multiple things with this, such as the categories displayed and the order.
We need to create our custom function.
<?php
function my_custom_cat_nav() { ?>
<ul id="sub-nav">
<?php wp_list_categories('title_li=&use_desc_for_title=0&orderby=name'); ?>
</ul>
<?php }
You can change the above to whatever you need. Then, we need to filter the original function:
add_filter( 'op_sub_nav', 'my_custom_cat_nav' ); ?>
Now, you have custom categories.
Switching the navigation
So, maybe you need to change the way things are shown on your page. There are multiple options to select from from your theme settings page, but there’s one that’s missing — the ability to put the sub-navigation (category nav) below the main navigation (page nav).
Well, this couldn’t be any simpler than switching the wp_list_pages() and wp_list_categories() functions in your custom functions from above.
The biggest problem you’d run into here is with your stylesheet. You’d need to switch references to #navigation, #sub-navigation, #nav, and #sub-nav. I’ll assume if you’re getting this advanced with PHP, you know how to handle a little CSS.