• Hey ,

    I added the following code to my theme’s function.php:

    add_action( 'init', 'create_team_post_type' );
    
    function create_team_post_type() {
    	register_post_type( 'teams',
    		array(
    			'labels' => array(
    				'name' => __( 'Teams' ),
    				'singular_name' => __( 'Team' )
    
    			),
    		'public' => true,
    		'has_archive' => true
    		)
    	);
    }

    Then i created a “team” and tried to list the teams with the following code in the nav of my header.php as i saw it on the wordpress codex site:

    $args = array(
                        'post_type'=> 'teams',
                        'title_li'=> __('Teams')
                        );
    
                        wp_list_pages($args);

    But there is no output but the opening and closing ul-tag.

    Furthermore i cannot access the archive site of my new post-type, despite of the activated has_archive option.
    I already tried to access it with
    – myblog.org/teams
    – myblog.org/team
    – myblog.org/post-type/teams
    – myblog.org/?teams

    … but nope…

    Where is my fault?

    Thankful for any advise.

    em_vau

  • The topic ‘list custom post type with wp_list_pages’ is closed to new replies.