We use the elements options in the Generate Press theme to show adverts on our site. Is there any way to create elements that detect the users device and show diffent styled adverts based on the device they are using (e.g. desktop and mobile)?
Are you using an Ad services such as Adsense ? If so then you would choose a responsive ad format. Using PHP to select a different advert is a bit hit and miss.
The simplest but not necessarily the most efficient way is to add all the various HTML blocks for each advert size and add the hide-on- classes to leave the one you want displayed on each device: