0

Update: I'm now trying to find a way to echo the metadata of a custom taxonomy's value.

I'm trying to create some PHP to use in a plaintext widget that'll display information in my sidebar. Because some of the information will be identical across some of the parts of the site instead of storing the information in custom fields I'm trying to store it in a MYSQL table. What I'd like the code to do is to identify the post taxonomy, lookup the id field in my table, find the row with that shares the id with the taxonomy and then echo the values of other fields on that row.

I have my taxonomy setup as well as my table but I can't find much of a precedent for this and therefore I'm struggling to know where to start.

So far I'm trying to call the current post taxonomy's value but I can't get it to work outside the loop

<?php
$current_tax = get_query_var('game');
echo $current_tax;
?>

1 Answer 1

0

First of all, what you're calling $current_tax would more appropriately be named $current_term. The taxonomy is 'game'.

Secondly, what you're trying to do is basically adding term metadata. There already are several plugins that provide the custom table and functions for that.

I recommend Simple Term Meta.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.