Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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'

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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