Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Taxonomy images

$
0
0

Hey there,

and this is the next thing. I see several ideas (won't call them solutions) here but I'm not sure what to do.

I have created a functions.php file in my child theme with just the opening <?php and then added some of the suggested codes. None of them result in any display of taxonomy images.

I have this site here – http://kowisoft.de/31t/book-categories/ – and simply want to display the images I have assigned to the custom taxonomy in the backend of WP. I don't want to alter it manually, simply what I want to do is once I have a new taxonomy item I want to add an image for it and it shows in the categories page (see aforementioned link).

How must my functions.php be adjusted? Currently it looks like this:

<?php

add_shortcode('taximage', 'tax_image');
function tax_image($atts) {
$associations = get_option( 'taxonomy_image_plugin' );
$term = get_term_by('slug', $atts['slug'], $atts['type']);
if ( !empty($term) && isset( $associations[ $term->term_taxonomy_id ] ) ) {
$attachment_id = (int) $associations[ $term->term_taxonomy_id ];
$img = taxonomy_image_plugin_get_image_src( $attachment_id );
return '<img src="' . $img . '" />';
}
}


Viewing all articles
Browse latest Browse all 20145

Trending Articles