Archive template for taxonomy terms

I want to document this because I just found the answer recently. The problem with having taxonomy is that most developers have the mindset of expecting the taxonomy to be seen inside the post_type url of: http://hostname/post_type/taxonomy_term Instead, you are going to find the url in: http://hostname/taxonomy_slug/taxonomy_term This means that we often may be creating … Read more

get_terms() returns an empty array

get_terms returns an array of objects. You cannot echo an array, if you do, you will just get Array(). What you can do is print_r($array) or var_dump($array) or echo json_encode($array) to see the data it contains. Otherwise, to get single elements, e.g. the name, from the objects, you need to pass $tax_terms through a foreach … Read more

Custom taxonomies, with custom rewrites/slug, AND loading a taxonomy archive template from a plugin

Background & Core Functionality Why a Taxonomy Path Slug Alone Produces a 404 However this slug doesnt work. mysite.com/wiki/help-topics throws a 404. WordPress does not provide a mechanism for “an archive of taxonomy terms” out of the box – that is, neither the template hierarchy nor the WP_Query/WP_Tax_Query logic support a direct display of terms … Read more

Get the latest taxonomy/category?

The latest edition should always be the term in that taxonomy with the highest term_id, right? Query get_terms and find the latest edition, then use that term to build the rest of your query… $edition = get_terms(‘edition’,’orderby=none&order=DESC&number=1′); $latest_edition = $edition[0]->slug; Then you can either modify the current query, if that’s what you want to do: … Read more