Chief Alchemist - Business Consulting For The 21st Century Via A Holistic & Intelligent Approach
Share RSS 2.0 feed for Sign up for the mailing list. Follow Chief Alchemist on Twitter. 'Like' the Chief Alchemist's page on Facebook. See what Chief Alchemist has been Q&A'ing on Quora. Chief Alchemist bookmarks & highlights on Follow the Chief Alchemist on Chief Alchemist channel on Chief Alchemist on Flickr. Mark 'Chief Alchemist' Simchock on LinkedIn. Free Initial Consultation. Email Chief Alchemist. Phone Chief Alchemist.
  • Mark ‘Chief Alchemist’ Simchock
  • 'Email me.Email => ca .at. ChiefAlchemist .dot. com
  • 'Phone me.Alchemy United => 732 997-0028
  • Free initial consultation.Free => Initial Consultation
  • Please be sure to subscribe to your communication channels of choice.
  • Click To Close => The small green (consultation), red (email) or blue (phone) icons in the top upper right.
Business Consulting For The 21st Century Via A Holistic & Intelligent Approach

WordPress: Taxonomies – Pt 2 (And Counting)

After spending some time yesterday I concluded that WP’s taxonomies are great but somewhat not fully supported by the WordPress core. That said, I’m still researching so please certainly expect an ah-ha moment. I did find a couple good posts on

Still, what I wanted to do was take all my taxonomies, merge them together, sort them so they display alphabetically. Mind you, I admit, this somewhat defeats the purpose of taxonomies but for CA (and possibly others) it does make sense. Multiple tag cloud search options via taxonomy buckets (instead of a single massive tag cloud), but for the posts just list the taxonomies like a normal tag listing. Kinda the best of both world, eh?

Here’s a custom function I whipped up late last night to enhance my WordPress theme. It seems to work just fine. However,  I’d also like the get the title attribute in the HTML that’s spit out from the WordPress get_the_term_list function. This I need to investigate.

// a WordPress function that takes all of a post's taxonomies, merges them and then sorts them
// so they can be displayed as a standard <b> WP post tag list</b>.
function funct_PostAllTaxSorted($parm_PostID, $separator) {
global $wp_taxonomies;
$str_PostTaxList = '';
// Get all the taxonomies
foreach ($wp_taxonomies as $taxonomy) {
// Except those listed in this array
if ( in_array($taxonomy->name, array('category', 'link_category') ) == false ) {
// build a | delimited string of the wanted taxonomies
$str_PostTaxList .= get_the_term_list($parm_PostID, $taxonomy->name,'','|','|');
if (isset($str_PostTaxList)) {
// trim off any blanks as well as the extra | at the end of the string. for some odd reason rtrim didn't want to strip off the extra |
$str_PostTaxList = substr($str_PostTaxList,0,(strlen($str_PostTaxList)-1));
// convert the string into an array
$arr_PostTaxList = explode('|',$str_PostTaxList);
$str_StripTags = '';
$arr_ListByTaxKey = array();
// build a new array using (what is ultimately) the taxonomy->name as the array key
foreach ($arr_PostTaxList as $str_PostTaxSingle) {
$str_StripTags = strip_tags($str_PostTaxSingle);
$arr_ListByTaxKey[$str_StripTags] = $str_PostTaxSingle;
// sort the new array on the key
$str_PostTaxListSorted = '';
// take the sorted array and convert it back into a string of HTMK
foreach ($arr_ListByTaxKey as $str_TaxKeySingle) {
$str_PostTaxListSorted = $str_PostTaxListSorted.$str_TaxKeySingle.$separator;
// remove the extra separator that was appended to the end
$str_PostTaxListSorted = substr($str_PostTaxListSorted,0,(strlen($str_PostTaxListSorted)-strlen($separator)));
// return a string that is all the taxonomies merged and sorted on taxonomy->name.
return $str_PostTaxListSorted;

Will not be published. Required.
Please include http://