Thread Starter
gekido
(@gekido)
k that didn’t format correctly.
I guess the simple version of my question – if I have a term ID / slug etc is there a way to simply get the value saved in the field for that specific term item?
I need direct function access, although it can be through something like do_shortcode() if need be.
Thanx in advance
Did you find a solution to this?
the shortcode for UTM is as follows, where TAXONOMYNAME is the name of the taxonomy, and TAXONOMYFIELD is the name of that taxonomy’s field, like so:
[xy_TAXONOMYNAME ]
This echoes all of the fields associated with that taxonomy.
[xy_TAXONOMYNAME field="TAXONOMYFIELD"]
This echoes the specific field you’re calling.
You can, of course, use “do_shortcode” to output this within a template:
$VARNAME = do_shortcode('[xy_TAXONOMYNAME field="TAXONOMYFIELD"]'); echo $VARNAME;
I’m also looking for a way to query these fields within a “foreach $terms as $term” loop…
Did you get the “foreach $terms as $term” loop working.
I’m trying to display an overview of my custom taxonomy with its fields that include name + archive link/ description and a custom field managed by this plugin. I can’t figure out how to display the custom field data in the third table column. Any help would be appreciated!
$args = array( 'taxonomy' => 'indicators' );
$terms = get_terms('indicators', $args);
$count = count($terms); $i=0;
if ($count > 0) {
$cape_list = '<p class="indicators-archive">';
foreach ($terms as $term) {
$i++;
$term_list .= '<tr><td><a href="indicators/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a></td><td>' .$term->description. '</td></tr>';
}
echo $term_list;
}
I can’t test it at the moment, but is it a syntax error? Try dropping a space between the two periods in the third table cell like so: . $term->description .
failing that, try print_r($terms);
or print_r($args);
to see exactly what information is within that array, that may shed some light on the issue.
Thanks for the reply xanderashwell.
The code I listed works as is, but I can’t figure out how to add into it a Taxonomy Manager Custom Field.
I was wondering whether you got an answer to this part of your original post:
“I’m also looking for a way to query these fields within a “foreach $terms as $term” loop… “
Since I believe that’s where I’m at.
I got this working in case you’re interested:
$args = array( 'taxonomy' => 'indicators' );
$terms = get_terms('indicators', $args);
$count = count($terms); $i=0;
if ($count > 0) {
$cape_list = '<p class="indicators-archive">';
foreach ($terms as $term) {
$opts = xydac_cloud(indicators,'', 'xo_basics');
$oxc = $opts[$term->slug]['xo_basics'];
$i++;
$term_list .= '<tr><td><a href="indicators/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a></td><td>' .$term->description. '</td><td>' .$oxc. '</td></tr>';
}
echo $term_list;
}