I really need to use PHP on theme panel -> ADS is there any way to get this working?
Thanks!
Did you try doing it in custom ad box ?
https://forum.tagdiv.com/newsmag-using-other-ads/
Note some php code needs to run either inside or outside of WP loop, or might conflict with WP, or whatever.
In those cases, better to actually put the code directly in the template where you want it.
But TagDiv might have better answer. And probably would like to see example of “what” type of PHP code you’re trying to use exactly. [shortcode] won’t work, I believe.
I want to use wp_is_mobile() function because as far as i understood the way newsmag hide an ad on mobile is by using display:none which is bad because the code loads anyway you just can’t see it, slowing down the site.
-
This reply was modified 9 years by
CreepyRavioli.
-
This reply was modified 9 years by
CreepyRavioli.
It’s not 1 sentence of code we are talking 3 ads to be shown on PC and 3 to be shown on mobile, if all the theme does is hide it, a phone would have to load all 6 Which is very heavy.
How does it hide it? It hide it in a way we can’t see it but it’s there or does it really remove the code? Bceause that’s my whole problem. If it doesn’t remove the code then it’s not useful.
I’m saying that small amount of text doesn’t slow down the mobile load — not all the ads are loading just the TEXT for the code. Once compressed and gzipped by server/browser and cached, not an issue.
If you’re showing (3) ads on mobile then only those 3 ads are loaded, not six.
Same way one menu is hidden for mobile in responsive design but different menu would load on mobile; part of the code works on one but not the other, but both are there so page doesn’t have to ‘reload’ when changing from landscape to portrait.
Again, however, simplest way is to load only a responsive ad unit and load that in the actual templates where you want, like a sidebar widget, and Google would then resize on the fly to the viewport.
Just food for thought. I don’t work here 🙂
I don’t understand how can the code exist on html and not be loaded. If it exist then it’s being loaded. It doesn’t matter if it’s hidden with css it still loads.
These aren’t google ads, they are fixed sizes not responsive.
Hello nico,
Please keep in mind that if you are using the on/off button regarding on Ads from Theme panel, it will be two different cases. So, if you are using AdSense code when you turn off that ad, the source of the code will be blocked from backend but if you are using other ads and if you disable the ads from Theme panel, all of them will be hidden from the front end (with display:none).
Thanks for the message!
