Creating custom URL for an event in the calendar
-
Hi,
I’m hoping anyone can help me with this. I would like all the events in the calendar/list to link to a URL that I assign. I don’t want to have /events/event-title, but instead I would like to link the title etc to a URL that I assign, e.g. https://www.custom-url-com. I found this code, but where should I add it? Appreciate all help with this.
<?php /* * This changes the event link to the event website URL if that is set. * NOTE: Comment out the add_filter() line to disable this function. */ function tribe_set_link_website ( $link, $postId ) { $website_url = tribe_get_event_website_url( $postId ); // Only swaps link if set if ( !empty( $website_url ) ) { $link = $website_url; } return $link; } add_filter( 'tribe_get_event_link', 'tribe_set_link_website', 100, 2 ); /* * This changes the venue link to the venue website URL if that is set. * NOTE: Uncomment the add_filter() line to enable this function. */ function tribe_set_venue_website ( $link, $postId, $display, $venue_url ) { $venue_link = tribe_get_venue_website_link( tribe_get_venue_id( $postId ) ); // Only swaps link if set and full HTML <a> link is set if ( !empty( $venue_link ) ) { if ( $display ) { $link = $venue_link; } else { $venue_url = tribe_get_event_meta( tribe_get_venue_id( $postId ), '_VenueURL', true ); $parseUrl = parse_url( $venue_url ); if ( empty( $parseUrl['scheme'] ) ) { $venue_url = "<a href="https://$venue_url"" rel="nofollow">https://$venue_url"</a>;; } $link = $venue_url; } } return $link; } //add_filter( 'tribe_get_venue_link', 'tribe_set_venue_website', 100, 4 ); /* * This changes the organizer link to the organizer website URL if that is set. * NOTE: Uncomment the add_filter() line to enable this function. As of PRO v3.9.1 not all organizer links are filterable. */ function tribe_set_organizer_website ( $link, $postId, $echo, $url, $name ) { $organizer_link = tribe_get_organizer_website_link( tribe_get_organizer_id( $postId ), false); // Only swaps link if set if ( !empty( $organizer_link ) ) { $link = $organizer_link; } return $link; } //add_filter( 'tribe_get_organizer_link', 'tribe_set_organizer_website', 100, 5 );
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Creating custom URL for an event in the calendar’ is closed to new replies.