WordPress.org

Ready to get started?Download WordPress

Forums

unhandled exception in get_calendar() (9 posts)

  1. t0mmmmmmm
    Member
    Posted 7 years ago #

    Hi,

    get_calendar() is supposed to display the calendar for the last month with any posts in it. However, I've just noticed that today it displays the calendar for January 2007 even though nothing has been posted since last year (actually, a few days ago).

    It also shows a "« Dec" link at the bottom which once clicked shows the correct calendar for December 2006.

    Has anyone else noticed this?

  2. whooami
    Member
    Posted 7 years ago #

    >get_calendar() is supposed to display the calendar for the last month with any posts in it

    are you sure about that? thats ALWAYS showed the current month for me, regardless of posts, by default, when on your index.php *that is*. Once i click a permalink, the calendar changes to the month display that that post belongs in. I think that holds true for 500,000 other wp blogs too :) short answer: yes its been noticed.

    Ive not looked at the function, have you?

    My calendar functions exactly as I expect it would.

  3. Chris_K
    Member
    Posted 7 years ago #

    >get_calendar() is supposed to display the calendar for the last month with any posts in it

    I think the codex documentation is what was quoted, and I think (as does whooami) that the documentation is misleading in that regard.

  4. t0mmmmmmm
    Member
    Posted 7 years ago #

    right, I got the info from the wordpress codex:
    http://codex.wordpress.org/Template_Tags/get_calendar

    It's no big deal, but still weird to have a "December 2006" caption to the Jan 2007 calendar.

    Just wanted to raise the inconsistency.

  5. t0mmmmmmm
    Member
    Posted 7 years ago #

    after a quick investigation it seems like it is rather the codex that makes this assumption

    get_calendar() defaults to the current month:
    lines 437-440 of template-functions-general.php (2.0.5)

    } else {
    $thisyear = gmdate('Y', current_time('timestamp'));
    $thismonth = gmdate('m', current_time('timestamp'));
    }

  6. Chris_K
    Member
    Posted 7 years ago #

    yup. Odds are it might have worked differently in the past. Then, when changed, nobody remembered to update the codex. I suppose one of us in this thread oughta wander over and do that. ;-)

  7. t0mmmmmmm
    Member
    Posted 7 years ago #

    *hint* *hint*

    I'd rather let someone whose primary language is english do it instead (not my case) to prevent ambiguousness.

    *looks at HandySolo* please

    Thanks whooami and HandySolo for helping sort this out.

  8. whooami
    Member
    Posted 7 years ago #

    your welcome, cept i didnt really didnt do anything cept go and look at my own calendar -- you did all the work :)

  9. Chris_K
    Member
    Posted 7 years ago #

    I made a small adjustment to the codex page.

Topic Closed

This topic has been closed to new replies.

About this Topic