WordPress.org

Ready to get started?Download WordPress

Forums

Weekly Class Schedule
WCS Widget Bug (3 posts)

  1. chakradeo
    Member
    Posted 5 months 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 3 months 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 3 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic