Custom function to get the Img Src for category in Taxonomy Image Plugin
-
/**
* Returns the image src value for the image linked with the category for the given category id.
*
* @param $cat_id
*
* @return {string} $image_src Image Source for category.
*/
function adforest_get_taxonomy_img_src( $cat_id ) {
/**
* Get the array value of option_name ‘taxonomy_image_plugin’ from wp_options table.
* This array has the image id and category id pair for the corresponding category.
*/
$image_id_array = get_option( ‘taxonomy_image_plugin’ );
// Get the image id for that category id.
$image_id = $image_id_array[ $cat_id ];
$image_src = taxonomy_image_plugin_get_image_src( $image_id );
return $image_src;
}Add CommentCollapseÂ
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom function to get the Img Src for category in Taxonomy Image Plugin’ is closed to new replies.