Link Back To Facebook Event

Home Forums Calendar Products Event Aggregator Link Back To Facebook Event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1012614
    Brandon
    Participant

    I know this has been covered before and using the link below I attempted to use the code provided in a previous post

    Facebook Event Times and Link Back To Event

    When I copy and paste into the functions.php and reload a single events page and doesn’t load. With all the updates to The Events Calendar and Facebook Import, does this code snippet still function?

    // Try to add a link to the FB event pages right before the content
    add_action( 'tribe_events_single_event_before_the_content', 'link_to_fb_event' );
     
    function 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
        $fburl = esc_url( "<a href="http://facebook.com/events/$fbid/&quot" rel="nofollow">http://facebook.com/events/$fbid/&quot</a>; );
        echo '<a href="' . $fburl . '">See this event on Facebook</a>';
    }

    Is there new code that will correct this or a function in the current release that I might be overlooking

    Thanks for your time
    Brandon

    • This topic was modified 10 years, 7 months ago by Brandon.
    #1012838
    Brook
    Participant

    Howdy Brandon,

    It would seem that old code does need some tweaking. Thanks for pointing this out. I just reworked it here:

    https://gist.github.com/elimn/d2bfcd659e99771e3abb

    Copy/paste that into your functions.php file. You likely want to remove the first <?php line from the snippet.

    Does that work for you now? Please let me know. Cheers!

    – Brook

    #1013035
    Brandon
    Participant

    Thank you Brook that worked.

    #1013331
    Brook
    Participant

    Excellent. Cheers!

    – Brook

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