Results 1 to 8 of 8

Thread: How to remove php elements on screen resolution?

  1. #1
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default How to remove php elements on screen resolution?

    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. (-

  2. #2
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    Quote Originally Posted by bbilal View Post
    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.

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    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/dhtmltu...queries4.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.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  4. #4
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by styxlawyer View Post
    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.

  5. #5
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Beverleyh View Post
    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/dhtmltu...queries4.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.

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    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.
    Last edited by Beverleyh; 10-07-2015 at 12:18 PM.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    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/googl...-design/25252/

    Google AdSense has approved responsive design with automatic sizing. These articles may prove useful: https://support.google.com/adsense/a...13689?hl=en-GB and http://www.labnol.org/internet/googl...-design/25252/
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  8. #8
    Join Date
    Sep 2007
    Posts
    172
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Beverleyh View Post
    Looking at the ad sizes, it sounds like you're using Google AdSense: http://www.labnol.org/internet/googl...-design/25252/

    Google AdSense has approved responsive design with automatic sizing. These articles may prove useful: https://support.google.com/adsense/a...13689?hl=en-GB and http://www.labnol.org/internet/googl...-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! (-

Similar Threads

  1. Screen Resolution
    By d-machine in forum JavaScript
    Replies: 2
    Last Post: 09-24-2009, 03:17 AM
  2. how to set up screen resolution?
    By ratih in forum CSS
    Replies: 3
    Last Post: 12-04-2008, 11:12 AM
  3. Screen Resolution & Width of the Screen
    By jelumalai in forum Graphics
    Replies: 4
    Last Post: 11-21-2008, 11:22 AM
  4. Screen Resolution
    By sweetboy in forum CSS
    Replies: 1
    Last Post: 05-10-2007, 11:01 AM
  5. screen resolution
    By RazorCap in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 01-28-2005, 01:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •