I have inmy opinion something simple that needs to be done but I can't get it to work.
I have a custom post type adm_project
with rewrite => array('slug' => 'projecten')
add_action( 'init', 'adm_build_projecten_post_type', 0 );
function adm_build_projecten_post_type() {
register_taxonomy(
'project_werkgebied',
'adm_project',
array(
'label' => 'Werkgebieden',
'singular_label' => 'Werkgebied',
'hierarchical' => true,
'query_var' => true,
)
);
$labels = array(
'name' => 'Projecten',
'singular_name' => 'Project',
'menu_name' => 'Projecten',
'all_items' => 'Alle Projecten',
'add_new' => 'Project toevoegen',
'add_new_item' => 'Nieuwe Project',
'edit' => 'Bewerken',
'edit_item' => 'Project bewerken',
'new_item' => 'Nieuwe Project',
'view' => 'Bekijken',
'view_item' => 'Bekijk Projecten',
'search_items' => 'Zoek Project',
'not_found' => 'Geen Project(en) gevonden',
'not_found_in_trash' => 'Geen Project(en) in prullenbak gevonden',
'parent' => '',
);
$args = array(
'label' => 'Projecten',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-hammer',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'rewrite' => array( 'slug' => 'projecten' )
);
register_post_type( 'adm_project', $args );
}
In the theme I have a file name archive-adm_project.php
which shows all the projects including working pagination as wanted.
What I want is that when I go to
/projecten/%project_werkgebied%
it does exactly the same but only show projects that have the taxonomy that is in the url.