• Resolved [email protected]

    (@senicagmailcom)


    
    $days_of_week = tribe_events_get_days_of_week( 'min' );
    var_dump($days_of_week); exit();
    

    Returns

    
    array(13) { ["Jan"]=> string(3) "Jan" ["Feb"]=> string(3) "Feb" ["Mar"]=> string(3) "Mar" ["Apr"]=> string(3) "Apr" ["May"]=> string(3) "May" ["Jun"]=> string(3) "Jun" ["Jul"]=> string(3) "Jul" ["Aug"]=> string(3) "Aug" ["Sep"]=> string(3) "Sep" ["Oct"]=> string(3) "Oct" ["Nov"]=> string(3) "Nov" ["Dec"]=> string(3) "Dec" [0]=> NULL }
    

    It should return an array of Days of the Week

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter [email protected]

    (@senicagmailcom)

    The bug is located in /Users/senica/projects/matchbook_do_dev/public_html/wp-content/plugins/the-events-calendar/src/Tribe/Main.php

    on line 2177 $this->daysOfWeekShort = Tribe__Date_Utils::get_localized_months_short();

    This should reference days of week, not months.

    Why this not returning week names ?

    Hi.

    tribe_events_get_days_of_week() is at https://github.com/moderntribe/the-events-calendar/blob/4.4.1.1/src/functions/template-tags/general.php#L693-L725

    Your initial response said ‘min’ but then you pointed to get_localized_months_short()

    So are you trying to use ‘min’ or ‘short’?

    And that method is located here: https://github.com/moderntribe/tribe-common/blob/4.4.1/src/Tribe/Date_Utils.php#L588-L614

    For reference, here’s what each of these returns for me:

    That last one caused a WP_DEBUG message:

    [02-Feb-2017 04:01:30 UTC] PHP Notice: Undefined offset: 0 in /wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php on line 719
    [02-Feb-2017 04:01:30 UTC] PHP Stack trace:
    [02-Feb-2017 04:01:30 UTC] PHP 1. {main}() /index.php:0
    [02-Feb-2017 04:01:30 UTC] PHP 2. require() /index.php:17
    [02-Feb-2017 04:01:30 UTC] PHP 3. require_once() /wp-blog-header.php:19
    [02-Feb-2017 04:01:30 UTC] PHP 4. include() /wp-includes/template-loader.php:74
    [02-Feb-2017 04:01:30 UTC] PHP 5. tribe_get_view() /wp-content/plugins/the-events-calendar/src/views/default-template.php:21
    [02-Feb-2017 04:01:30 UTC] PHP 6. include() /wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:45
    [02-Feb-2017 04:01:30 UTC] PHP 7. tribe_get_template_part() /wp-content/plugins/the-events-calendar/src/views/month.php:22
    [02-Feb-2017 04:01:30 UTC] PHP 8. include() /wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:131
    [02-Feb-2017 04:01:30 UTC] PHP 9. tribe_get_template_part() /wp-content/plugins/the-events-calendar/src/views/month/content.php:39
    [02-Feb-2017 04:01:30 UTC] PHP 10. include() /wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:131
    [02-Feb-2017 04:01:30 UTC] PHP 11. tribe_events_get_days_of_week() /wp-content/plugins/the-events-calendar/src/views/month/loop-grid.php:17

    I’ve logged this bug regarding tribe_events_get_days_of_week( 'short' ) and our developers will eventually look into it.

    Please let me know if you think I’ve missed anything else important about this issue.

    Thank you for reporting it.

    Thread Starter [email protected]

    (@senicagmailcom)

    Yes, sorry. I meant short. I think min got in there while debugging.

    Ultimately, ‘short’ should point to get_localized_weeks_short()

    Barry

    (@barryhughes-1)

    This was recently refactored – are you still hitting problems here?

    Thread Starter [email protected]

    (@senicagmailcom)

    I haven’t looked at the recent release, but I’ll close this as it seems like it’s gotten appropriate attention.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘4.4.0.1 tribe_events_get_days_of_week returns months, not days of week’ is closed to new replies.