WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate Taxonomy Manager
How do I show the fields? (7 posts)

  1. gekido
    Member
    Posted 2 years ago #

    So how do I get this to work with a custom loop?

    What I'm trying to do is generate a list of terms on a separate page via get_terms() and display the image associated with them using this and/or any other method that I can find.

    My custom taxonomy is called 'library' and I have the following in a custom page template:

    [Code moderated. Please post code snippets between backticks or use the code button]

    But nothing shows up from the shortcode output. Any ideas?

    http://wordpress.org/extend/plugins/ultimate-taxonomy-manager/

  2. gekido
    Member
    Posted 2 years ago #

    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

  3. xanderashwell
    Member
    Posted 2 years ago #

    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...

  4. trickadee
    Member
    Posted 2 years ago #

    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;
    }
  5. xanderashwell
    Member
    Posted 2 years ago #

    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.

  6. trickadee
    Member
    Posted 2 years ago #

    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.

  7. trickadee
    Member
    Posted 2 years ago #

    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;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic