Home › Forums › Calendar Products › Events Calendar PRO › Custom field as the event link
- This topic has 6 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
January 3, 2013 at 9:43 am #30260
Javier
ParticipantHi. I am trying to create a single multi-day (non-consecutive days) event. It would be perfect if the plugin could exclude some dates from the pattern but, at least for now, can’t be done with recurring dates…
But because it is quite urgent to me to get it done, I am trying to get the same result taking a different approach.
Here is my scenario. It’s a five day training course with non-consecutive days. A single event from 2013-01-14 to 2013-01-23, but training days are only the 14th, 16th, 18th, 21st and 23rd. So I want it to show in my calendar just these five days instead of all ten days. As I said, recurring dates doesn’t do the job, because it treats each day as a different event and that’s not what I want, so here is my idea and what it would work for me:
I set manually every single day as a separate single event, all 5 with the same title and descriptions.
The first day (the 14th) is used as a reference because it will contain the register form for the training course. So in the calendar views I will need the rest of the days to point to this first day.
My approach would be creating a Custom Field called i.e. ‘Reference Link’ and filling it up with the first day’s permalink.
Then go for example to table-mini.php template and make an IF statement such as:
“If custom field ‘Reference Link’ exists and is not empty, use it as the event link. ELSE use the tribe_get_event_link() function”
I hope that makes sense… I am not a PHP expert so I am having a hard time trying to figure it out :/
I would appreciate very much your help. thanks.
January 3, 2013 at 12:34 pm #30272Jonah
ParticipantHey Javier,
Sorry for the limitations on recurring events. We hope to improve the flexibility of this in the future. Your solution is a good one though. Let me see if I can help you. What I would do is use this plugin for your custom fields: http://www.advancedcustomfields.com/ – it’s way easier and more powerful than using WP custom fields. You can create the custom reference link field and have it only show for the tribe_events post type too! So what I did was just that, and then in the template, for instance I’m going to modify /wp-content/plugins/the-events-calendar/views/table.php for the big calendar, on line 133 you would change that to: http://snippi.com/s/9jzsbru – make sure to make a copy of /wp-content/plugins/the-events-calendar/views/table.php and place in an ‘events’ folder in your theme first too! Then if any event has a link input, the template will use that link instead of the event link. You could event possibly improve this by using a relationship or post object field to be able to select your reference post directly instead of copy/pasting the URL. You’re on your own with that one though 🙂
Does this help?
– Jonah
January 4, 2013 at 1:50 am #30286Javier
ParticipantThanks for the help Jonah!
The trick works beautifully!! Although I am afraid it works only on the table.php file. Can’t get it to work on table-mini.phpOn line 137 I replaced the code with this one (http://snippi.com/s/kl1dnx2) without any luck, it doesn’t find the custom reference_link field…
I read the ACF documentation about the get_field() function but can’t figure it out.
Many thanks for your help.
January 4, 2013 at 12:40 pm #30308Jonah
ParticipantHey Javier,
You’ve got the right line number but try this code instead: http://snippi.com/s/kngfnfe
I hope that helps!
– JonahJanuary 5, 2013 at 5:05 am #30319Javier
ParticipantThanks very much for the hint Jonah! Although your code didn’t work at first. There was missing the $post->ID parameter in the IF statement. Now it works perfectly (http://snippi.com/s/8x6xya9).
Now I have full control over recurring dates for my training courses! thanks and keep up the good work!!
Javier.
January 5, 2013 at 12:49 pm #30323Jonah
ParticipantOoops, I forgot to add that. Glad you figured it out! Let us know if you need anything else.
– Jonah
July 7, 2015 at 6:26 am #978375Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Custom field as the event link’ is closed to new replies.
