Support » Plugin: The Events Calendar » [Plugin: The Events Calendar] Upcoming Event widget fix

  • DanDzina

    (@dandzina)


    I am using The Event Calendar 2.0.7
    When using the Upcoming Event widget inside of another loop, it would cause misbehavior because the original query would end up being lost.

    I revised this function in lib/widget-list.class.php (modified line annotated “cs”) which resolved my issue.

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 7 replies - 1 through 7 (of 7 total)
  • jonahcoyote

    (@jonahcoyote)

    Hey DanDzina,

    Can you please provide a more cleaned up version of your code? You know we have a function for querying events right? http://tri.be/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events

    Cheers,
    – Jonah

    DanDzina

    (@dandzina)

    It’s perhaps a issue with the theme — the theme basically has a loop where it queries the contents of several pages. I am not fully up on WordPress yet as far as best practices go..

    When it encountered the widget for the upcoming events, the query would be lost. I likely could have added the preservation of $original_query in it’s loop.

    On the theme’s page it had a section like this:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    This look would not complete correctly when one of those pages executed the upcoming events widget, I beleive because it used wp_reset_query().
    In place of that, I
    1) captured the $wp_query at the top of your function in $original_query
    2) commented out wp_reset_query
    3) set $wp_query to the value preserved in $original_query

    Just to make thing a bit more complicated perhaps, the page its on is calling the upcoming events widget via a shortcode that is generated with the “amr shorcode any widget” plugin. However the amr pluging doesn’t do much to the execution.

    You can view the upcomming events in this loop at http://stage.thompsonfallschamber.com on the lower left of the page

    jonahcoyote

    (@jonahcoyote)

    Hey DanDzina,

    Want to try posting your code again via Pastebin?

    Thanks,
    Jonah

    DanDzina

    (@dandzina)

    jonahcoyote

    (@jonahcoyote)

    Hey DanDzina,

    That’s fairly complex and there’s a lot going on. Unfortunately we’re not going to be able to help you with this customization. Maybe someone else in the forum will chime in.

    Good luck!

    – Jonah

    DanDzina

    (@dandzina)

    Well, the change I made solved my issue — it was more of a fyi.
    As I said, I am uncertain to the design style recommended for when loops are called inside of other loops so perhaps the issue should really be handled on the theme side instead.
    Thanks for taking the time to look at it though

    Plugin Author Rob La Gatta

    (@roblagatta)

    Thanks for the follow-up, DanDzina. We appreciate the FYI here, and I think at the least this will be value to other users down the road. Sorry we couldn’t offer up more here.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: The Events Calendar] Upcoming Event widget fix’ is closed to new replies.