WordPress.org

Forums

Widget Logic
Hiding a widget without content (3 posts)

  1. Jamil Jonna
    Member
    Posted 4 years ago #

    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.

  2. alanft
    Member
    Plugin Author

    Posted 4 years ago #

    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

  3. Jamil Jonna
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic