Skip to content

Instantly share code, notes, and snippets.

@timmse
Created September 15, 2014 09:45
Show Gist options
  • Select an option

  • Save timmse/29b1befe63e9c8e5587c to your computer and use it in GitHub Desktop.

Select an option

Save timmse/29b1befe63e9c8e5587c to your computer and use it in GitHub Desktop.
Tribe Events Facebook Import Image *FIX* / add to functions.php (http://tri.be/support/forums/topic/facebook-events-doesnt-import-event-photo/); Fixes image import
add_filter( 'tribe_fb_event_img', 'fb_import_image_ext_fix' );
function fb_import_image_ext_fix( $event_picture ) {
if ( ! is_array( $event_picture ) ) return $event_picture;
if ( ! isset( $event_picture['url'] ) ) return $event_picture;
$length = strlen( $event_picture['url'] );
$query_starts = strpos( $event_picture['url'], '?' );
if ( false === $query_starts ) return $event_picture;
if ( $query_starts < $length && $query_starts > 0 )
$event_picture['url'] = substr( $event_picture['url'], 0, $query_starts );
return $event_picture;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment