[fr] Prise de tête pour trouver un moyen d'utiliser WordPress pour afficher des événements (des billets spéciaux, mais pour lesquels on précise aussi une date de début et de fin d'événement). Il faudrait qu'on puisse afficher les "événements encore pas terminés" sur une page spéciale.
Deux plugins m'offrent des solutions partielles, mais je suis incapable de les transformer en solutions totales. Toute aide serait bienvenue.
Besides using WordPress as a blogging tool, a client of mine would like to use it to display a page of upcoming events. I’ve dug out a number of plugins which somewhat do the job, but getting things to work exactly as we want is proving to be a pain in the neck.
As I’ve been stuck on this for a few weeks now and still see no light, I’m offering this problem to the collective mind out there in hope that a bright solution pops up somewhere before we go live (which is… very soon — hear my desperate plea for help).
Here’s what we want
- events should be posts (this rules out Shrikee’s Events Plugin)
- events have a start date, and an end date — time is unnecessary (this rules out RS Event)
- events should show up in the normal flow of posts and on their own category page (we don’t want them on the home page, but I can exclude the category manually, so that’s a non-issue)
- we should be able to display upcoming events on a WordPress page (I’ll stick whatever code is needed in the template for that page) — “upcoming”, here, meaning events whose end date is not yet past.
Partial solutions
At first, I thought about using upcoming or eventful, but for quite a few reasons this won’t work out in our situation.
Event Calendar seemed like a good candidate, although we didn’t really need the “calendar” itself. I hacked the layout of the event posts so they displayed OK. However, the main bit is missing. Event Calendar provides a way to list all the events “after today”, by calling http://blog.address/?ec3_after=today
for example. Unfortunately, this doesn’t work on our setup (probably something we did to the rather hacked theme. I’ve had a look at the source code but couldn’t really figure out what happened when that variable was passed, so was unable to reproduce anything ressembling it in a Page template.
Another problem is that this will not show events which have started yesterday but which are not yet over, if I’m not mistaken.
Last but not least, we have two event subcategories, so I’d have to create two (or even three) separate event pages — but I guess that if I manage to make one, filtering posts by category shouldn’t be too hard.
Another solution would be to use Posts Expire and Posts Begin as described in this forum post I stumbled upon yesterday. Again, these plugins provide a way to call “posts which have not yet expired” with a particular URL: home/?orderby=post_end_date
. Again, I haven’t manage to dig out the code and stick it in a Page template — trying to rewrite a pretty URL to that one is source of much hair-tearing upon this server I have very little control on, and I haven’t found a way to make it work.
The other problem I’d have to work around if using these plugins is that expired posts are not displayed in the blog anymore. I’m not sure what code in the plugin takes care of that, but it would have to be commented out.
Help
So, I have two partial solutions here, but I’m stuck making progress on either. Do you have any ideas which could help me out — either to make one of my partial solutions a working one or to find a third one?
I’d really really appreciate help on this one. Thanks a lot.
EventCalendar should do everything you want (I’m the author).
If you want different event categories, then just put your event posts in the “event” category AND another category.
The ec3_after=today query should work. Perhaps you are using the old EC3.1.0 with WP2.1? Try the newest version of EC and let me know how you get on.
Hey Alex, thanks for stopping by! I’ve upgraded to rc1 as you suggested. And yay! I’ve been able to get rid of the custom loop I used on the homepage to hide events, they do display in the archives and on the category pages, and ?ec3_after=today works as I need it to.
So… the only problem now is to change that ugly “?” URL into a pretty WordPress Page address. I’m willing to try rewriting it again, but it failed miserably last time I tried.
Plus, there is still the “two categories” issue. As I’ve set it up, I have an “Events” category and two subcategories “France” and “Switzerland”. So the events are indeed in two categories. Now how could I split the ?ec3_after=today page to display either just France, or just Switzerland?
Here’s the reply Alex e-mailed me — my blog and Safari don’t seem to get along:
The query works — now I just have to figure out if it’s less of a pain to try to get mod_rewrite to work, or to conjure up custom templates for those pages.
At the present moment, this has morphed into a mod_rewrite problem. Here is what wordpress puts in .htaccess:
I’d like to add a rule which goes:
(I’m not 100% sure my rule is correct.) So, above the WP bloc of rules, I stuck this:
But all I get when I test it is a WordPress-powered 404 error. I don’t have access to the error logs. Any ideas, anybody?
I had a similar problem once, but went for the second option: conjure up custom templates for those pages, as an in a new_archive.php. Its quite easier, and it did work properly for the time I used it.
Hi,
If you want the events to show up as regular posts and on a separate page. You can just post the events using a strict layout. Then create a template which accepts ONLY your events category to show them.
With some small hacks i can imagine you don’t need plugins at all to get done what you want 🙂
All of the info you need for this is in http://codex.wordpress.org
Do a search for ‘category page’.
Have fun.
I’m having the mod_rewrite problem and I’d like the solution because I’m working on two client sites right now and both really want the EC to work. The only problem is that since we have pretty permalinks turned on, clicking on an EC event returns a 404 error.
What code do I need to put into what custom WP Page or .htaccess file to get this thing to work. I’ve subscribed to and searched Alex’s mailing list and have found nothing.
So how did you solve that one, Stephanie? Inquiring minds want to know!
Thanks.
Hi Joni — I'm really afraid I absolutely don't remember 🙁
I'm not even sure if I found a fix or not! If it comes back to me I'll let you know, but I'm sorry I don't have time to search now (packing to leave today).
Good luck!