Can anybody help me, how to display Recent Thread and Most Reply thread with custom query?

I will place this query on the header on my vBulletin forum.

Please Help...