gtaxi_get_taxonomy_image( array $opts = array() )
Retrieves the image assigned to a term via the Genesis Taxonomy Images plugin.
(array)(Optional) The array of options telling
gtaxi_get_taxonomy_image() what to retrieve.
The array can contain any of the following:
(string) The format to retrieve.
htmlcreates a full HTML markup including srcset;
srcgets just the image url;
idgets the image ID. This is the same as just using
(string) Any built-in or user-defined media size. If missing or invalid,
full is used.
(string|array) Attributes applied to the requested image html. This is passed through to
wp_get_attachment_image() so see its API page for details.
Default is empty
(string) What to return if no term image is assigned.
placeholderwill return the default image in the requested format except for ID, which will return null (because there is no ID for the default image);
- Anything else will return null.
(WP_Term|int) Term object or term ID.
Default is the term taken from the main query.
This example shows the default usage, which will get the full HTML for the image assigned to the current term, or the HTML for the default image.
$url = gtaxi_get_taxonomy_image();
This is the same as the above, except for a specific term. Note that you can supply either a term object or term ID.
$url = gtaxi_get_taxonomy_image( array( 'term' => 123, ) );
This one will get only the URL, and return nothing if an image is not set.
$url = gtaxi_get_taxonomy_image( array( 'format' => 'url', 'fallback' => '' ) );
You can use this function with the many actions and filters that come with genesis to put the image out for a term wherever you like.