Display replies and views

This chunk of code displays the views in the latest tab, not in the categories tab. Any easy way for it also work for the categories tab?