Tribe__Events__Community__Main::get_view_edit_links( int $event_id )
Get the View/Edit link for the post
Contents
Parameters
- $event_id
-
(int) (Required) post ID of event
Return
(string) HTML link
Source
File: src/Tribe/Main.php
public function get_view_edit_links( $event_id ) { $edit_link = $view_link = ''; if ( get_post_status( $event_id ) == 'publish' ) { $view_link = sprintf( '<a href="%s" class="view-event">%s</a>', esc_url( get_permalink( $event_id ) ), __( 'View', 'tribe-events-community' ) ); } if ( current_user_can( 'edit_post', $event_id ) ) { $edit_link = sprintf( '<a href="%s" class="edit-event">%s</a>', esc_url( tribe_community_events_edit_event_link( $event_id ) ), __( 'Edit', 'tribe-events-community' ) ); } // If the user isn't allowed to edit and the post wasn't published, return an empty string if ( empty( $edit_link ) && empty( $view_link ) ) { return ''; } $separator = '<span class="sep"> | </span>'; return '(' . tribe_separated_field( $view_link, $separator, $edit_link ) . ')'; }
Changelog
Version | Description |
---|---|
3.7 | Introduced. |