Title: WCS Widget Bug
Last modified: August 21, 2016

---

# WCS Widget Bug

 *  [chakradeo](https://wordpress.org/support/users/chakradeo/)
 * (@chakradeo)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/wcs-widget-bug/)
 * Hi,
 *  The Today’s classes widget displays classes which are hidden! They are not displayed
   in the weekly class schedule table (or list), but is shown in the widget. The
   fix is simple as below, but it needs to be enhanced to take into account if all
   the classes scheduled today are hidden. Hope this fix makes into the next version
   asap.
 * –Amit
 *     ```
       @@ -58,9 +58,11 @@ class WCS3_TodayClassesWidget extends WP_Widget {
                       $output .= '<ul class="wcs3-today-classes-widget-list">';
   
                       foreach ( $schedule as $key => $entry ) {
       +            if($entry['visible'] != 'Hidden') {
                           $start_hour = $entry['start_hour'];
                           $class_name = $entry['class'];
       -                   $output .= "
       <li>$start_hour - $class_name</li>
       ";
       +            $output .= "
       <li>$start_hour - $class_name</li>
       ";
       +            }
                       }
   
                       $output .= '';
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_
 * [https://wordpress.org/plugins/weekly-class-schedule/](https://wordpress.org/plugins/weekly-class-schedule/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Zofskeez](https://wordpress.org/support/users/zofskeez/)
 * (@zofskeez)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/wcs-widget-bug/#post-4610966)
 * Thanks for posting this fix but it didn’t work for me. With some tweaks to the
   code I have the widget now properly displaying the schedule with only the visible
   classes.
 * Here’s the code:
 *     ```
       $output .= '<ul class="wcs3-today-classes-widget-list">';
   
       		foreach ( $schedule as $key => $entry ) {
       		if($entry['visible'] != 'Hidden') {
       		$start_hour = $entry['start_hour'];
       		$class_name = $entry['class'];
       		$output .= "$start_hour - $class_name";
       		$output .= '';
        			}
       		}
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_
 * Hope this helps anyone else who has run into this issue when trying to properly
   display the widget when classes are hidden.
 *  Thread Starter [chakradeo](https://wordpress.org/support/users/chakradeo/)
 * (@chakradeo)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/wcs-widget-bug/#post-4610967)
 * Yes, my code was formatted as a patch (+ indicates added line and – indicates
   removed line). But after applying that patch it should look the same as what 
   you have.
 *  [David G. Johnson](https://wordpress.org/support/users/haveanepiphany/)
 * (@haveanepiphany)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wcs-widget-bug/#post-4610976)
 * I put together a slightly modified version of this code which is working well
   for me in version 3.11 of the plugin and WP 3.9.2 over here:
 * [http://wordpress.org/support/topic/todays-classes-widget-shows-hidden-classes?replies=2#post-5892144](http://wordpress.org/support/topic/todays-classes-widget-shows-hidden-classes?replies=2#post-5892144)
 * Thanks to both of you for posting!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WCS Widget Bug’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/weekly-class-schedule_e7e1ae.svg)
 * [Weekly Class Schedule](https://wordpress.org/plugins/weekly-class-schedule/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/weekly-class-schedule/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/weekly-class-schedule/)
 * [Active Topics](https://wordpress.org/support/plugin/weekly-class-schedule/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/weekly-class-schedule/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/weekly-class-schedule/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [David G. Johnson](https://wordpress.org/support/users/haveanepiphany/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/wcs-widget-bug/#post-4610976)
 * Status: not resolved