• Resolved Lethalmiko

    (@lethalmiko)


    I have created three widgets on a responsive website. One contains the facebook “Like” box with faces, the second and third are identical and have the “Like” button without faces (all three use the iframe version of FB). I want the first two to appear ONLY on the homepage, interchanging according to the view-port size (ie the first one with faces appears at full resolution on a laptop/computer and the second one without faces appears on tablets or smart phones). The third widget (without faces) should appear on any other page except the homepage.

    Trouble is, when I use the “is_home()” and “!is_home()” functions, only the third one appears on all pages including the homepage. The other two fail to appear on the homepage. I tested with the ‘wp_reset_query’ fix but no difference. Even tinkering with when the logic loads also failed. Removing the “is_home()” and “!is_home()” functions from the Widget logic makes them all appear. The site is on a WP Multi-site installation. I have disabled the plugin for now until I get a solution. I have reverted to the first two widgets appearing on all pages and turned off the third one.

    What could be the problem?

    P/S – In case you want to see the website structure, it is at https://zambia.co.zm

    https://www.ads-software.com/extend/plugins/widget-logic/

Viewing 4 replies - 1 through 4 (of 4 total)
  • First thing to check is that you’ve not got caught out by the difference between is_home and is_front_page

    https://codex.www.ads-software.com/Conditional_Tags#The_Main_Page

    Thread Starter Lethalmiko

    (@lethalmiko)

    Tried that and it makes no difference. Also tried leaving one widget only (both the first and second one) and neither shows up unless I remove the widget code.

    alanft

    (@alanft)

    all I can think then is that the theme is getting in the way – manipulating the query or something like that, so is_home() and is_front_page() aren’t evaluating as expected. see if it works as expected with one of the default themes.

    if so you may have to find some ‘proxy’ condition that holds true on the home page – but it’s going to depend massively on the coding of the theme – and it LOOKS like that’s quite bespoke, so I’ve no way to help you with that I’m afraid.

    alanft

    (@alanft)

    This has been marked as resolved! What did you find out?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Widget misbehaving on responsive website’ is closed to new replies.