Adding taxonomy images before taxonomy term
-
I need to add an image before each taxonomy term to represent the term (ie, Beds might have a bed icon).
I can use the Taxonomy Images plugin (https://www.ads-software.com/plugins/taxonomy-images/) to set the image per taxonomy, but I need some help figuring out where to display the images per taxonomy. Here is what their documentation says about display the taxonomy images:
Display a single image representing the term archive The following filter will display the image associated with the term asked for in the query string of the url. This filter only works in views that naturally use templates like category.php, tag.php taxonomy.php and all of their derivatives. Please read about template hierarchy for more information about these templates. The simplest use of this filter looks like: print apply_filters( 'taxonomy-images-queried-term-image', '' ); This code will generate and print an image tag. It's output can be modifed by passig an optional third parameter to apply filters. This parameter is an array and the following keys may be set: after (string) - Text to append to the image's HTML. attr (array) - Key/value pairs representing the attributes of the img tag. Available options include: alt, class, src and title. This array will be passed as the fourth parameter to WordPress core function wp_get_attachment_image() without modification. before (string) - Text to prepend to the image's HTML. image_size (string) - May be any image size registered with WordPress. If no image size is specified, 'thumbnail' will be used as a default value. In the event that an unregistered size is specified, this filter will return an empty string. Here's an example of what a fully customized version of this filter might look like: print apply_filters( 'taxonomy-images-queried-term-image', '', array( 'after' => '</div>' 'attr' => array( 'alt' => 'Custom alternative text', 'class' => 'my-class-list bunnies turtles', 'src' => 'this-is-where-the-image-lives.png', 'title' => 'Custom Title', ), 'before' => '<div id="my-custom-div">', 'image_size' => 'medium', ) );
Could you help me understand how to display these images prior to the WP Listing taxonomy terms (for features specifically, if it matters).
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding taxonomy images before taxonomy term’ is closed to new replies.