Support » Plugin: Widget Logic » [Plugin: Widget Logic] Hiding a widget without content

  • Hello,

    I’m just trying to hide a widget (YARPP) when there isn’t any content. I style my widget areas with borders and they still appear when a widget has no content. Can widget logic do this?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor alanft

    (@alanft)

    It can help

    you could use logic that returns false under the circumstances that the content is empty, of if that logic is too complex you could use the widget_content filter. you’d have to write a function that tested if the full HTML content of the widget was empty, and then return an empty string

    Unfortunately I’m not equipped to write such a function. But you’d think this would be a useful feature of widget logic. Do you happen to know if anyone has attempted it? Or could you suggest where I might start? I’ve created filters before but very basic ones. I don’t know how to test for HTML content or how to say “don’t show the widget”.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Widget Logic] Hiding a widget without content’ is closed to new replies.