0

Hey guys, I'm using a calendar plugin that provides a sidebar widget to show current calendar dates.

However this widget always shows N/A if I don't set a category for a specific event. Any idea how I could add a filter to that widget and match N/A and remove it?

thank you for your help

1 Answer 1

2

In the method "widget" look for the line that sets the category then add either:

$cat = empty($instance['cat']) ? 'N/A' : $instance['cat'];

(where you replace N/A with something you like) or... better... add a filter instead like this:

$cat = apply_filters( 'widget_my_cat', empty($instance['cat']) ? 'N/A' : $instance['cat'], $instance, $this->id_base);

And then hook into 'widget_my_cat' to set it to something else if the value is 'N/A'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.