Subscribe widget not recognizing Category Podcasting
-
I operate a website with several podcasts (https://chsrfm.ca/) for our radio station, each one set up as a category. I have activated the Subscribe Widget for Category Podcasting, but it has not been displayed on the page.
I noticed that there is a third field indicating which category id to use, but since this widget is used across all categories, it is a nonsensical field in this case.
I started digging in (being a code monkey, can’t help myself) and discovered that in class.powerpress-subscribe-widget::widget() the variable $instance[‘subscribe_category_id’] was unset. Since this is a category page, I had it check for the query variable instead ( get_query_var(‘cat’) ), which is properly propagated.
By simply modifying the check for an empty $instance[‘subscribe_category_id’] to use the page variable instead, the plug is now being displayed properly.
(Caveat: we sometimes have a show which lives in more than one category; that may be a contributing factor, but there is a specific bug that I have discovered.)
My suggestion is that if “Category Podcasting” is set within the configuration of the widget, it would treat an empty category as a directive to get the category from the page request — just as I have done. Alternatively, a deeper check can be made to see if the page is a category archive and then only display it. In cases where multiple categories cover the same episodes, it will not be confused, because only one category would be listed.
Now, the adaptation on a per-post basis for subscribing to a category, that is a bigger change that I plan to investigate.
- The topic ‘Subscribe widget not recognizing Category Podcasting’ is closed to new replies.