WordPress.org

Ready to get started?Download WordPress

Forums

My Calendar
Upcoming Events - Display next month's events (4 posts)

  1. waretz
    Member
    Posted 2 years ago #

    Does anyone know a way to use my_calendar_upcoming to display events in the future after a certain date? I would like to display all events that occur in the next month, however, I don't want events that occur in the current month.

    Thanks in advance
    Wayne

    http://wordpress.org/extend/plugins/my-calendar/

  2. waretz
    Member
    Posted 2 years ago #

    Wow, no love on this? I would think someone else would have the need to display future events without regard to the current date. For example, I have a client that wants to display all events for next month in a sidebar widget. Maybe the skip parameter could changes to be in line with the before and after parameters, regarding days vs events. So if the type is 'days', the skip parameter would denote days. This way, you could skip the number of days between the current date and your start date for the range desired.

    Regardless, i came up with a work around if anyone is interested.

  3. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

    Hey, Waretz - I'd be interested in seeing your work around. I've been sick for the last week, so haven't really been able to keep up with these kinds of requests.

  4. waretz
    Member
    Posted 2 years ago #

    Sorry to hear you aren't feeling well. I love the plugin, by the way.

    Basically, what I needed was a widget that could display the events for an upcoming time period. For instance, next weekend or next month. What I did isn't very elegant or efficient, but it works. Let's use next month (April 2012) as an example. I first derive my start and end dates for the requested date range. In this case 04-01-2012 and 04-30-2012. Then I calculate the before(days) and after(days) parameters. Before(days) is 0 and after(days) is calculated by using the difference between the current date and my end date. However, I need to ignore any events between the current date and my original start date, so I make a call to my_calendar_upcoming using a daysafter parameter derived from the current date and the original start date. For this example, the days difference between 03-16-2012 and 04-01-2012 minus 1 day, because I want the events for my start day. I return the value from my_calendar_upcoming into a string and then count the number of<li> occurrences using substr_count to get the number of events I need to skip. I then use that as my skip parameter. The shortcode is built and passed back to the widget for display.

    I think a better fix would be to do what I mentioned in my post. Let the skip parameter be used for the number of events or number of days, depending on what the Type parameter is. What do you think?

    Wayne

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic