View Full Version : How to remove php elements on screen resolution?
bbilal
10-06-2015, 09:38 PM
Hello All,
I would like to remove the WordPress widget when re-sizing the browser widow. I am currently working on a responsive design so I would like to change the widgets on lower resolution.
Can anyone help me with this?
Is there any way we can remove PHP element by using Javascript or any other preferred method?
Thanks In advance. (-
styxlawyer
10-06-2015, 10:15 PM
Hello All,
I would like to remove the WordPress widget when re-sizing the browser widow. I am currently working on a responsive design so I would like to change the widgets on lower resolution.
Can anyone help me with this?
Is there any way we can remove PHP element by using Javascript or any other preferred method?
Thanks In advance. (-
You'll have to tell us which Wordpress widget you wish to remove and from which site.
Beverleyh
10-07-2015, 05:02 AM
Not sure what you mean by "PHP element" - you can't remove PHP *code* with JS or CSS but you can hide/remove the HTML *element* that it serves.
JavaScript: matchMedia() may be an option http://www.javascriptkit.com/dhtmltutors/cssmediaqueries4.shtml
CSS: maybe there is a class applied to the <body> element at lower resolutions? Check in the developer toolbar and then you could possible hide the widget with display:none; Be aware that this will not prevent resources from downloading though.
bbilal
10-07-2015, 10:23 AM
You'll have to tell us which Wordpress widget you wish to remove and from which site.
Any widget. The site is not live as I am working on localhost.
I am trying to play with Ads. Many ad networks doesn't have responsive ads. So I would like to switch 300x250 ads on Mobile instead of 728x90 ads.
bbilal
10-07-2015, 10:25 AM
Not sure what you mean by "PHP element" - you can't remove PHP *code* with JS or CSS but you can hide/remove the HTML *element* that it serves.
JavaScript: matchMedia() may be an option http://www.javascriptkit.com/dhtmltutors/cssmediaqueries4.shtml
CSS: maybe there is a class applied to the <body> element at lower resolutions? Check in the developer toolbar and then you could possible hide the widget with display:none; Be aware that this will not prevent resources from downloading though.
PHP element by I mean a PHP "code".
I know we can hide the HTML element through CSS by using display:none; property, however it is against the Ad Networks policies to hide their ads.
I need an alternate solution to display my ads.
Beverleyh
10-07-2015, 11:57 AM
I would like to remove the WordPress widget
I know we can hide the HTML element through CSS by using display:none; property, however it is against the Ad Networks policies to hide their ads.
If it is against their policy to hide the ads, then it will be against their policy to remove them too.
However, you say;
So I would like to switch 300x250 ads on Mobile instead of 728x90 ads How are you switching the size? If you have 2 modules containing different size ads, are you talking about hiding one and showing the other at small screen resolution, and then switching their visibility at larger resolution? If so, were going right back to display:none/removing (although the provider's policy may permit this because ads will continue to be shown at either resolution, just under different conditions)
If you want to detect mobile with PHP and manipulate whatever PHP code is served on mobile, maybe this will help (the PHP option): http://detectmobilebrowsers.com/
I do not know much about Wordpress though so I wouldn't be able to tell you how to use it in that environment.
Beverleyh
10-07-2015, 12:28 PM
So I would like to switch 300x250 ads on Mobile instead of 728x90 ads
Looking at the ad sizes, it sounds like you're using Google AdSense: http://www.labnol.org/internet/google-adsense-responsive-design/25252/
Google AdSense has approved responsive design with automatic sizing. These articles may prove useful: https://support.google.com/adsense/answer/3213689?hl=en-GB and http://www.labnol.org/internet/google-adsense-responsive-design/25252/
bbilal
10-07-2015, 07:26 PM
Looking at the ad sizes, it sounds like you're using Google AdSense: http://www.labnol.org/internet/google-adsense-responsive-design/25252/
Google AdSense has approved responsive design with automatic sizing. These articles may prove useful: https://support.google.com/adsense/answer/3213689?hl=en-GB and http://www.labnol.org/internet/google-adsense-responsive-design/25252/
Thanks for the help!
Hiding an ad is against their policies but not removing or changing the ads.
I know that Google Adsense provide Responsive ads but there are some other ad networks which doesn't provide this service.
Anyways thanks for the help! I found the alternate solution, I have found the WP Plugin > "Responsive Widgets".
Highly appreciate for the help once again! (-
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.