I have this code for the tag list in Wordpress:
$tags_list = get_the_tag_list( '', __( '</li><li>', 'wp-theme') );
if ( $tags_list ) {
printf( '' . __( '<ul><li>%1$s</li></ul>', 'wp-theme' ) . '', $tags_list );
}
It becomes this HTML:
<ul>
<li><a href="http://internal-link/tag1/>TAG NAME 1</a></li>
<li><a href="http://internal-link/tag2/>TAG NAME 2</a></li>
</ul>
But I need to get this:
<ul>
<li><a href="http://internal-link/tag1/>TAG NAME 1</a> <a href="https://external-link/?search=TAG+NAME+1">img</a></li>
<li><a href="http://internal-link/tag2/>TAG NAME 2</a> <a href="https://external-link/?search=TAG+NAME+2">img</a></li>
</ul>
How should I edit the code above to add the external link after each tag and how do I get the tag name without its own link, so I can add it to the external link?
Thank you!