• Hi all, hope someone can help.

    I’m building a site which uses both custom post types and taxonomies each with their own custom fields/meta data. I have used a plugin to create this information but the same can be achieved by registering both using functions.php.

    I have a custom post type of trophy-recipients and within that post type is a combo-box selector for trophy – Trophies are my custom taxonomy. I have about 14 trophies to select from. Within each trophy is a custom field called tr_grade which stores what level of competition that the trophy is awarded to.

    I have built a page which goes through trophy and displays the description of the trophy but then lists the trophy recipient (a post) underneath the title. BUT I need the trophies to be sorted by Grade (custom tax custom field tr_grade).

    I haven’t found this information anywhere, maybe I’m not searching for the right thing, but I’m putting it out there, because I’m stumped. Any help is appreciated.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter DazVision

    (@dazvision)

    just an update, I found the function get_metadata() and have included a conditional statement within my foreach term loop as follows:

    $tgrade = get_metadata('taxonomy',$term->term_id,'tr_grade',true);
    if ($tgrade == $grade) {

    However, this is still very inefficient code as it still loops through all trophies per grade.

    I would like to query a taxonomy based on a taxonomy field, so, any takers?

Viewing 1 replies (of 1 total)
  • The topic ‘How to query specific custom fields within a custom taxonomy?’ is closed to new replies.