11.02.2021: There may be a delay in tickets response in the next couple of days. We apologise for any inconvenience caused.


Okay
  Public Ticket #2700196
Organizer Pages
Open

Comments

  • Steve Hancock started the conversation

    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

  •  410
    Zhivko replied

    Hi,

    You can override the default template by adding following filter in your theme or child-theme functions.php file:

    add_filter('page_template', function($template) {
        $post = get_post();
                  
        // Admin_Helper resides in \ Stachethemes \ Stec \ namespace   
        if ($post->ID === \ Stachethemes \ Stec \ Admin_Helper::get_stec_page('organizer')) {
            
            $template = get_stylesheet_directory() . '/' . 'custom-organizers.php';
        }
        return $template;
    }, 9999);
    

    Stachethemes Developer

  • Steve Hancock replied

    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?

  •  410
    Zhivko replied

    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));
            }
        }


    Stachethemes Developer