detect mobile using wordpress

Solution:

you can do it via a pluginĀ Mobile Detector

or if you want to create your own you can start by using mobile detection library(PHP)

mobile-detect