WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Upcoming Event widget fix (8 posts)

  1. DanDzina
    Member
    Posted 2 years ago #

    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/

  2. jonahcoyote
    Member
    Posted 2 years ago #

    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

  3. DanDzina
    Member
    Posted 2 years ago #

    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

  4. jonahcoyote
    Member
    Posted 2 years ago #

    Hey DanDzina,

    Want to try posting your code again via Pastebin?

    Thanks,
    Jonah

  5. DanDzina
    Member
    Posted 2 years ago #

  6. jonahcoyote
    Member
    Posted 2 years ago #

    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

  7. DanDzina
    Member
    Posted 2 years ago #

    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

  8. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.