Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm stumped on this, it is something I've gotten to work on other sites, but I must be overlooking something here.

I'm trying to create a secondary menu for my custom post types ('staff') with wp_list_pages().

The function works fine if I'm tell it to return regular pages in the array parameter, but for some reason it doesn't return anything for my custom post type.

Here is where I create the custom post type:

    $staff_args = array(
    'public' => true,
    'supports' => array(
        'title', 'editor', 'thumbnail', 'custom_fields'
    ),
    'labels' => array(
        'name' => 'Staff Pages',
        'singular_name' => 'Staff Page',
        'add_new' => 'Add new Staff Page',
        'add_new_item' => 'Add new Staff Page',
        'edit_item' => 'Edit Staff Page',
        'new_item' => 'New Staff Page',
        'view_item' => 'View Staff Page',
        'search_item' => 'Search Staff Pages',
        'not_found' => 'No Staff Pages found',
        'not_found_in_trash' => 'No Staff Pages found in trash'
    ),
    'capability_type' => 'post',
    'hiearchial' => true,
    'rewrite' => array(
        'slug' => 'team',
    ),
    'has_archive' => false,
    'show_in_nav_menus' => true,
    'query_var' => 'staff',
    'menu_position' => 6,
    'menu_icon' =>  $url . '/custom-plugin/standalone_page.png'
);

register_post_type('staff', $staff_args);

Here is where I run wp_list_pages():

    $secondary_menu_args = array(
    'depth'        => 0,
    'show_date'    => '',
    'date_format'  => '',
    'child_of'     => 0,
    'exclude'      => '',
    'include'      => '',
    'title_li'     => _('Staff'),
    'echo'         => 1,
    'authors'      => '',
    'sort_column'  => 'post_title',
    'link_before'  => '',
    'link_after'   => '',
    'walker'       => '',
    'post_type'    => 'staff',
    'post_status'  => 'publish'
);

and

<nav id="secondary-menu" class="staff-menu">
<ul>
    <li <?php if($postID == $post->ID) echo 'class="current_page_item"'; ?>><a href="/<?php echo $menu_url; ?>"><?php echo $menu_title; ?></a></li>
    <?php wp_list_pages($secondary_menu_args); ?>
</ul>

Thanks in advance.

share|improve this question
5  
This happens because you have a typo in your registration: 'hiearchial' => true. Use 'hierarchical' => true, and it should work. –  toscho May 3 '13 at 21:49
    
@toscho as an answer please :) –  Rarst May 4 '13 at 19:38
    
@Rarst Typos ar too localized. Waiting for feedback from asker. –  toscho May 4 '13 at 19:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.