I have a CPT registered that is called lessons
with a custom taxonomy (category) that is called courses
. I want the /courses
page (archive-courses.php?) to display the individual courses (i.e. “online marketing”, “paid advertising”) and not the individual posts (lessons).
Would this mean I’d just customize the loop, or a complete custom WP_Query?
If you’d like to list the individual courses, i.e. the taxonomy terms, you’d use neither
WP_Query
nor the WP standard Loop.Instead, make use of the
get_terms
function to retrieve the courses. It returns an array of term objects (if the taxonomy does exist and has terms matching the function arguments). Iterate over that and do something with it, such as displaying a list of links to the lessons:Its look like you calling
Custom Post (archive-courses.php)
not taxonomy. Try thistaxonomy-courses.php
also have a look Custom_Taxonomies_display