Created
September 15, 2014 09:45
-
-
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
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
| 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