Documentation / Tutorials / Tutorials & How to’s
Device Detection
/ Tutorials & How to’s / Device Detection
If you want to execute a set of block based on the device on the server side you can full this shortcode,
Parameters
mobile: all the code within this block will be executed only if request is coming from mobile phones
tablet: All the code within this block will be executed only if request is coming from a tabled device
mobile_or_tablet: All the code within this block will be executed if request is coming from either mobile or tablet device
desktop: All the code within this block will be executed only if request is coming from deskopt/laptop.
[aw2.query posts_builder part=start]
{
"posts_per_page": -1,
"post_type": "as_banner",
"post_status": "publish",
"order": "DESC",
"orderby": "date"
}
[/aw2.query]
[aw2.query posts_builder part=run set="module.qu" /]
[aw2.loop module.qu.posts device="desktop,tablet"]
HTML goes here
[/aw2.loop]
[aw2.loop module.qu.posts device="mobile"]
HTML goes here
[/aw2.loop]