WordPress.org

Forums

Weekly Class Schedule
WCS Widget Bug (4 posts)

  1. chakradeo
    Member
    Posted 1 year ago #

    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/

  2. Zofskeez
    Member
    Posted 1 year ago #

    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.

  3. chakradeo
    Member
    Posted 1 year ago #

    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.

  4. David G. Johnson
    Member
    Posted 1 year ago #

    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

    Thanks to both of you for posting!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Weekly Class Schedule
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic