• Resolved miruru

    (@miruru)


    I am currently using this code

    $terms = apply_filters( 'taxonomy-images-get-terms', '' );
    if ( ! empty( $terms ) ) {
        print '<ul>';
        foreach( (array) $terms as $term ) {
            print '<li><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
        }
        print '</ul>';
    }

    and I have tried everything including putting this example

    Array
    (
        [0] => stdClass Object
            (
                [term_id] => 8
                [name] => Pirate
                [slug] => pirate
                [term_group] => 0
                [term_taxonomy_id] => 8
                [taxonomy] => category
                [description] => Pirates live in the ocean and ride around on boats.
                [parent] => 0
                [count] => 1
                [image_id] => 44
            )
    )

    to display the list of terms I have in the taxonomy, but (a) nothing is displayed, (b)I have the word “array” displayed or (c) gettings errors about the syntax is incorrect. I can display a single term with the image.

    Version 0.6 did exactly what I wanted and displayed correctly and I have backed this up incase I need to revert to this version, also, this version allowed shortcodes. However, as a person who does not have a great knowledge on php, I am struggling with the example provided for displaying all the taxonomny terms.

    All I want is something simple that would output all the terms for a given taxonomy as well as a description of that term.

    This is still a fantastic plugin and I would recommend it.

    Any help would be most appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Fields

    (@mfields)

    Version 0.7 also supports the old shortcode. I’ve just deprecated it and removed it from the documentation. I don’t want new users using it. I am building better support with full template capabilities into my Taxonomy List Shortcode plugin.

    All I want is something simple that would output all the terms for a given taxonomy as well as a description of that term.

    The shortcode should still work. Have you tried it?

    I see no reason that the first code snippet would not work. Do you intend to display categories or some other taxonomy?

    The second example is not actually code rather a preview of how the filter will modify the term objects.

    Plugin Contributor Michael Fields

    (@mfields)

    Is this the error you are getting?

    Notice: The category taxonomy does not have image support. Manage Settings in /Users/mfields/Sites/plugins/Taxonomy-Images/taxonomy-images.php on line 1102

    If so, it’s not really an error. It’s a notice. You’ll have to choose which taxonomies have image support in the plugin’s settings page.

    Someone asked for this feature a while back and I thought it was a really good idea.

    Thread Starter miruru

    (@miruru)

    Hi Michael, thank you for replying.

    The shortcode does not work. I’m using [taxonomy_image_plugin_list taxonomy="nameoftaxonomy" template="grid" size="thumbnail"] unless this is incorrect.

    Also, i am trying to display a taxonomy.

    When i’m using the first code, nothing is displayed. I’ve even substituted the word taxonomy with the name of the taxonomy. The errors I tend to get are the syntax errors where the coding is incorrect, that is when i’m using the second code, which you have now clarify what it does. I’m putting this into Shortcode EXEC PHP so that I can simply add the shortcode into a widget. I’ve tried using:

    <?php $terms = apply_filters( 'taxonomy-images-get-terms', '' );
    if ( ! empty( $terms ) ) {
        print '<ul>';
        foreach( (array) $terms as $term ) {
            print '<li><a href="' . esc_url( get_term_link( $term, $term->anime-series) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
        }
        print '</ul>';
    }?>

    in a php widget but get a syntax error about the < being unexpected.

    I just don’t know what else to try.

    Thread Starter miruru

    (@miruru)

    I managed to get the plugin working:

    I used:

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy'=> 'tax-name'));
    if ( ! empty( $terms ) ) {
    	foreach( (array) $terms as $term ) {
    		print '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumb' ) . '</a>' ;
    	}
    }

    as opposed to:

    $terms = apply_filters( 'taxonomy-images-get-terms', '') );
    if ( ! empty( $terms ) ) {
    	foreach( (array) $terms as $term ) {
    		print '<a>taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumb' ) . '</a>' ;
    	}
    }

    The main difference was where I added array('taxonomy'=> 'tax-name')
    Also, thank you for a fantastic plugin.

    Plugin Contributor Michael Fields

    (@mfields)

    Awesome! Glad you got it working.

    @miruru
    Your solution also worked for me.
    Thanks so much for sharing!

    Thanks miruru, that worked for me too. Thanks Michael for the sweet plugin.

    @miruru: thanks. That works 😀 you saved the day!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Taxonomy Images] Cannot return list of taxonomy images’ is closed to new replies.