Creating event, post and category
Many of you ask me the opportunity to specify a category when you declare, in the event creation form, the creation of a post associated.
Yet it’s easy to return edit that post and to select the categories you want. But as the customer is king, I looked into the feasibility of this thing.
As Wordpress is very well designed and that its encoders are geniuses, I was not surprised to discover that this implementation was rather simple to achieve.
So as the next version is somewhat expected - but this is normal since all that will change in the plugin! - I think you propose to do it yourself.
To those who will tell me that it would be nice to be able to select multiple categories for the same post: I say NO! It is a little more complicated. But the most intelligent of you will surely find how
Voila the procedure to be followed scrupulously:
- It is more advisable to work locally than online.
- Everything happens in the ‘ec_management.class.php‘.
- Start by saving this file in another directory.
- We’ll start by adding a dropdown list of categories in the event creation form.
- Just after the line #185, after </tr> and before </table>, insert this :
- Now we will ensure that the category will be selected will be sent to creation of the post in Wordpress. Between line 55 and 56, before the line that starts with $data, insert this line:
- And finally replace this line 61:
- By this one:
<tr> <th width="33%" scope="row" valign="center"><label for="EC_CatPost">< ?php _e('Select category','events-calendar');?></label></th> <td width="67%">< ?php wp_dropdown_categories('name=EC_CatPost');?></td> </tr>
$post_category[0] = $_POST['EC_CatPost'];
, 'post_category' => $wpdb->escape($this->blog_post_author)
, 'post_category' => $post_category
Now he’ll just do the tests.
And if it works well, to write me full of thanks ![]()











Be careful!
In the piece of code into this post there is a small error that I can not correct because the editor does not take into account!
There is no space to put between ‘< ' and '?php'.
that’s great !
i downloaded your wordpress plugins evelt calendar
thx!
I am gmt+8 chinese beijing ,hongkong time!
region,area question!
not is
Hello guangzhou, taking into account the time zone will be included in a future version of Events Calendar. It’s in my ToDo List
Hello,
Thanks for the quick response about my CSS trouble. After poking around a bit, I found that Events Calendar (large) worked fine on both Google Chrome and IE. The problems I was experiencing only showed up when using Mozilla. Is this something you’re aware of? I will check through the CSS and see if I can find an easy fix. If anyone has any ideas, let me know.
Thanks!
I have found that when using Mozilla, it looks better if you go into the CSS folder of Events Calendar and delete the code: border-collapse: collapse; The calendar doesn’t look as good as it did, but it does look the same on Mozilla, IE and Chrome. No open boxes or anything.
merci pour cet ajout.
petite précision : je n’accède dans event calendar qu’aux catégories déjà utilisées. Les catégories pas encore utilisées n’apparaissent pas.
Bonsoir Jean-Pierre, très bonne remarque. Effectivement c’est un petit défaut que je vais m’employer à corriger, dès que j’en aurais un peu le temps.
Mais vous pourriez chercher également de votre coté. En fait c’est probablement une option supplémentaire à ajouter dans le paramètre chaine de la fonction wp_dropdown_categories() qui va permettre de lister toutes les catégories, qu’elles aient été utilisées ou pas.
Soit vous arrivez à trouver un site qui parle de tout cela en détails, soit, comme je l’avais fais, vous vous plonger courageusement dans les sources de Wordpress
Bonsoir Heirem!
I am curious if there is a way to have posts appear in event calendar?
Merci!
To clarify:
When I do ‘Write Post’ to have it create an entry for event calendar automatically…
Merci!
Silly question… where does it get the list of categories from? Do we need to manually add (and populate) a new column to wp_eventscalendar_main?
And thanks… I’ve looked at various calendars and once I got the events list working (thanks to your answer on your previous post), Events Calendar is by the far the best and perfect for what we need.
Picks-at-Flies
Update:
Okay, solved list of categories (waves newbie hat).
It seems that your fix is only useful if you are creating a post from your calendar entry. Which is fine for a quick fix, but it wasn’t clear. It’s not a priority for me just yet, but if I feel coding urges I might have a fiddle.
Thanks again.
PaF
Hello Stephen, Frankly, I try and try again, I really do not understand your question. Even with the clarification. If anyone has understood, I will further explanations.
Merci Heirem!
I will try again - When I write a new post, I would like it to automatically appear in the event calendar as an event with a link to the post. Is this possible?
If not, that is okay - I will just create an event and link the post to it after I am done!
Merci beaucoup!
Hello everybody,
If you have applied the code of this post, and if you want the list of categories also display those are empty, here to make the changes.
Just replace:
by
Dear Heirem,
It would be great if, in addition to choose a category, you could add a specific CSS class to an event: so they would be shown different in the calendar.
And if those CSS-classes were per-category based, better (example: music events-> class event-music; travel event -> class event-travel, etc).
You can see something like this here: http://www.racocatala.cat/agenda.php
ça marche !
Hej!
Nice plugin, Im starting to get hold with it!
One silly question: how do I remove an event? Cant find where they are stored…
Salut!
Dear Xavi Ivars, it is an idea that has already been proposed. And that I find very good. But, as I often say these days, the world was not done in one day
Hello Johan, in your dasboard, managing events, for each event, you do not have a red cross? Click on it to remove the event !
Hi,
is there a way to always create and publish a post with a default category?
This would really save a lot of clicks for our team.
Thx
Hello Cabotine, yes there is a possibility. To replace this parameter function:
With this:
Of course ‘$defcat’ must contain the number of the category you want to default position.
But you can also write this for example:
thanks I ll try this…
and how could I set to create always a post and always publish it?
Thank you
C.
I managed to always create and article and always publish it, but I dont know how to use more than one category for the article…
Can you tell me?
Btw. is the pot-file for german available anywhere? There are some translations missing…
Thanks for your help
C.
another question, where is the post created, I want to add some more default content to all posts…
found how to add the second one (after I re-read this post
) and found where the post is created as well
thx
Dear Cabotine, I think you know what that means “cabotine” in French isn’t it? So I think that you wear your nickname
Better management of the categories of all kinds, and import / export iCal is in my todo list. If you want to supplement or improve the translation file in German, I accept with pleasure
Actually I wasnt aware of the french translation, I use it because of the name of perfume by Gres…
Could you email me the translation file
Thank you
C.
thanks for this - works great
Hello Elana,
Thank you very much for your donation !!
It is a very touching and encouraging attention.
Especially from someone who did not need support with Events Calendar!
Best Regards
Thank You very much. Worked perfectly.