Hello,
I would be entirely grateful for help.
I added an individual field to an event and filled it with the url I want this event to link to.
“Kalendertag-link”
Now I want to use this filter
http://codex.wp-event-organiser.com/hook-eventorganiser_calendar_event_link.html
To excute that the event links to each individual link
Here is my code:
//Replace link to eventpage with link from individual field
add_filter('eventorganiser_calendar_event_link','myportfolio_link',10,3);
function myportfolio_link( $link, $event_id, $occurrence_id ){
$the_post = get_post($post_id);
get_post_meta($postid, 'kalendertag-link', true);
$link=kalendertag-link;
}
return $link;
}
I am not entirely sure how to save the new event-organiser-ajax.php in a way that it won’t effected by future updates. I do have a child theme.
Apologies for the n00b questions – I just want to make sure I understand the process right. Thank you.
Fabienne Freymadl
Ok and another question: where do I ad this filter?
Fabienne Freymadl
Hi Fabienne,
This article gives the details: https://wp-event-organiser.com/blog/tutorial/where-should-i-put-code-from-the-tutorials/
But in short, ideally in a custom plug-in but you can get away with putting it in your theme’s functions.php
(or child theme) if you don’t mind maintaining it. If you put it in your child theme’s functions.php
then that lets you update the theme without losing the code
Stephen Harris
Hello
thank you for your help.
I figured out where to place it, but it wont work as desired.
/
/Replace link to eventpage with link from individual field
add_filter('eventorganiser_calendar_event_link','myportfolio_link',10,3);
function myportfolio_link( $link, $event_id, $occurrence_id ){
$the_post = get_post($post_id);
get_post_meta($postid, 'kalendertag-link', true);
$link=kalendertag-link;
return $link;
}
This leads to the dates disappearing from the calendar, it seems they wont load in.
Fabienne Freymadl
f*** hell, I did it:
//Replace link to eventpage with link from individual field
add_filter('eventorganiser_calendar_event_link','myportfolio_link',10,3);
function myportfolio_link( $link, $event_id, $occurrence_id ){
$link=get_post_meta($event_id, 'kalendertag_link', true);
return $link;
};
Fabienne Freymadl
Solved.
I replaced line 49 of shortcode-event-list.php
with
“><?php the_post_thumbnail(‘medium’); // mittlere Größe ?> <?php the_title(); ?>
‘kalendertag_link’ is the custom url I gave the event.
Fabienne Freymadl
The shortcode-event-list.php
file is a “template” file – if you copy it to your theme, the plug-in will use that file instead of the one included in the plug-in (which means you can update the plug-in without losing your changes).
However, I think this has been superseded by this question on how to replace event links everywhere: https://wp-event-organiser.com/forums/topic/individual-link-shortcode-entry/#post-42811
Stephen Harris
Hello,
everything works as desired, thank you for your previous help!
Now I would like to have the link pop up in a new window. How do I manage that?
It should be fairly simple I guess.
Fabienne Freymadl
You’d need to edit the template to that (See this line https://github.com/stephenharris/Event-Organiser/blob/develop/templates/shortcode-event-list.php#L48) – adding target="_blank"
inside the <a ...>
tag should do it.
Stephen Harris