Facebook Event Link not displaying

Home Forums Calendar Products Event Aggregator Facebook Event Link not displaying

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1177923
    Wade
    Participant
    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 class="mt0 mb3"><a class="tribe-events-button" href="' . esc_url( "http://facebook.com/events/$fbid/" ) .'" target="_blank" rel="nofollow">RSVP on Facebook</a></p>';
    }

    The code in the above snippet found in the knowledge base returns nothing now, what is the updated snippet?

    #1177938
    Wade
    Participant

    Found it.

    _EventFacebookID is the new post meta ID…really curious why you thought it was a good idea to change that field…

    #1177953
    Wade
    Participant

    Updated snippet if anyone else needs it, with fallback for the legacy ID:

    <?php // Check if the event is associated with a Facebook event
    			$fbid_legacy = tribe_get_event_meta( get_the_ID(), '_FacebookID' );
    			$fbid_new = tribe_get_event_meta( get_the_ID(), '_EventFacebookID');
    
    			if( !empty($fbid_new )) {
    				$fbid = $fbid_new;
    			} else {
    				$fbid = $fbid_legacy;
    			}
    
    			if ( !empty( $fbid ) ) {
    				// Form and display a link to the FB event page if so
    				echo '<a class="mt1 tribe-events-button" href="' . esc_url( "http://facebook.com/events/$fbid/" ) .'" target="_blank" rel="nofollow">RSVP on Facebook</a>';
    			}
    		?>
    #1178128
    Cliff
    Member

    Hi Wade.

    Sorry to cause you a little extra headache in the transition. It does use a new meta key, as you’ve discovered.

    And thanks for sharing your updated snippet!

    Have a great week.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Facebook Event Link not displaying’ is closed to new replies.