We don't want to output HTML from the PHP code unless absolutely necessary.

Instead you could output $is_category and then on the HTML code output the correct image based on that value.