Archived topic
Add two different ad scripts in Head - One for mobile and one for desktop?
1 reply · Started by Emil on November 22, 2019
Hi!
I need to add two different scripts for ads i the head of the website. The thing is that they both should not load at the same time.
One is for desktop only and the other one is for mobile. It´s going to cause problems if both of them loads in the background at the same time.
How can i do this?
I have not set up the website yet so i can´t show you the specific site.
Hi there,
its not completely bullet proof but you can use the wp_is_mobile() function to wrap your scripts
https://developer.wordpress.org/reference/functions/wp_is_mobile/#user-contributed-notes