Hi, I am currently building a site that has events and content provided by contributors. Because of this, I want to be able to create a custom organizer page for each organizer that showcases their events and posts. Is there a way to either customize the existing Organizer page template, or for the link to the organizer from events on the calendar to be changed so that it points to a custom page rather than the default organizer page? Thanks
Thanks for your reply. Unfortunately, this doesn't really give me the results I need. I am using Elementor to build the site and could do with using this to create the organizer pages. Is there a way to do this, or is there alternatively a way to point the organizer page links to other pages on the site, set up for each individual organizer?
Sorry, the only way to override the organizer's permalink at the moment is by editing the method get_permalink() in file \stachethemes_event_calendar\assets\php\o.organizer.php line 53.
If you don't have too many organizers you could add switch there and point each organizer to their link.
Example:
public function get_permalink() { switch ($this->id) {
case 1: // case for organizer with id#1
return esc_url('https://...');
case 2: // case for organizer with id#2
return esc_url('https://...');
case 3: // case for organizer with id#3 return esc_url('https://...');
default:
// The default behaviour if no case is found
if (null !== $this->permalink) { return esc_url($this->permalink); }
$page_id = Admin_Helper::get_stec_page('organizer');
if (!$page_id) { return null; }
$page = Admin_Helper::get_permalinks('organizer', 'stec_organizer');
if (class_exists('SitePress')) { $default_locale = Admin_Helper::get_default_locale(); if ($default_locale !== ICL_LANGUAGE_CODE) { $page = ICL_LANGUAGE_CODE . '-' . $page; } }
$replace = apply_filters('stec_organizer_get_permalink_replace_name_spaces_with', '_');
$name = str_replace(' ', $replace, $this->get_name());
return esc_url(home_url($page . '/' . $name)); } }
I have now managed to tweak the o.organizer.php to change line 78 from this:
return esc_url(home_url($page . '/' . $name));
to:
return esc_url(home_url('coaches/' . $name));
Which gives me the results I want, as all organizers on the site are set up as posts with the category 'coaches', with permalinks set up as follows: domain.com/coaches/coach_name.
While this is a good proof of concept, this code will obviously be overwritten when the plugin updates, so is not a permanent solution. Is there a chance of something like this being implemented in future versions? All I really need is a way to input an organizer permalink without an actual page being created, so that I can create a custom page in the correct location. Does that make sense?
Then open your theme or child-theme functions.php file and implement a filter similar to the one I've sent you previously:
add_filter('stec_organizer_get_permalink', function($link, $organizer) {
switch ($organizer->get_id()) {
case 1: // case for organizer with id#1
return esc_url('https://...');
case 2: // case for organizer with id#2 return esc_url('https://...');
case 3: // case for organizer with id#3 return esc_url('https://...');
default: return $link; } }, 10, 2);
This way the changes will be preserved on calendar update.
Hi,
I am currently building a site that has events and content provided by contributors. Because of this, I want to be able to create a custom organizer page for each organizer that showcases their events and posts. Is there a way to either customize the existing Organizer page template, or for the link to the organizer from events on the calendar to be changed so that it points to a custom page rather than the default organizer page?
Thanks
Hi,
You can override the default template by adding following filter in your theme or child-theme functions.php file:
Stachethemes Developer
Thanks for your reply. Unfortunately, this doesn't really give me the results I need. I am using Elementor to build the site and could do with using this to create the organizer pages. Is there a way to do this, or is there alternatively a way to point the organizer page links to other pages on the site, set up for each individual organizer?
Sorry, the only way to override the organizer's permalink at the moment is by editing the method get_permalink() in file \stachethemes_event_calendar\assets\php\o.organizer.php line 53.
If you don't have too many organizers you could add switch there and point each organizer to their link.
Example:
Stachethemes Developer
Thanks for the response.
I have now managed to tweak the o.organizer.php to change line 78 from this:
to:
Which gives me the results I want, as all organizers on the site are set up as posts with the category 'coaches', with permalinks set up as follows: domain.com/coaches/coach_name.
While this is a good proof of concept, this code will obviously be overwritten when the plugin updates, so is not a permanent solution. Is there a chance of something like this being implemented in future versions? All I really need is a way to input an organizer permalink without an actual page being created, so that I can create a custom page in the correct location.
Does that make sense?
Sorry for the late reply.
Indeed, modifying the core can't be permanent solution.
Therefore I'll place filter in the next update for the organizer permalinks.
Meanwhile you can do following:
Open file stachethemes_event_calendar\assets\php\o.organizer.php
and on line 53 replace the whole function get_permalink() { ... }
with this one:
Then open your theme or child-theme functions.php file and implement a filter similar to the one I've sent you previously:
This way the changes will be preserved on calendar update.
Stachethemes Developer