-
-
Save theeventscalendar/cc47c5ba4206d9907310 to your computer and use it in GitHub Desktop.
Add a link to the original Facebook event from an imported event listing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add a link to the Facebook event pages right before the content | |
*/ | |
function tribe_link_to_fb_event() { | |
// Check if the event is associated with a Facebook event | |
$fbid = tribe_get_event_meta( get_the_ID(), '_FacebookID' ); | |
if ( empty( $fbid ) ) return; | |
// Form and display a link to the FB event page if so | |
echo '<p><a href="' . esc_url( "http://facebook.com/events/$fbid/" ) .'" rel="nofollow">See this event on Facebook</a></p>'; | |
} | |
add_action( 'tribe_events_single_event_before_the_content', 'tribe_link_to_fb_event' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment