Home › Forums › Calendar Products › Event Aggregator › Images "Facebook" prefix
- This topic has 6 replies, 3 voices, and was last updated 7 years, 2 months ago by Ivan.
-
AuthorPosts
-
January 19, 2017 at 2:21 am #1220831IvanParticipant
Hi Tribe,
I have a question. In previous facebook events plugin all the images have prefix facebook & unique string, unfortunately the Aggregator not anymore. Is it possible to add the prefix back?
Was much easier to search for images, delete them or just make some order…
January 19, 2017 at 11:42 am #1221091NicoMemberHi there Ivan,
Thanks for getting in touch with us on this!
I’m not sure this prefix will be added again, but you can use the snippet below to customize the attachment name. Paste the snippet in the theme’s (or child theme’s) functions.php file:
function tribe_tag_as_ea_image ( $attachment_id ) {
$attachment = array(
'ID' => $attachment_id,
'post_title' => 'aggregator_image_' . $attachment_id
);wp_update_post( $attachment );
}function tribe_hijack_image_name ( $image_import, $event ) {
tribe_tag_as_ea_image ( $image_import->post_id );
return $image_import;
}
add_filter( 'tribe_aggregator_event_image', 'tribe_hijack_image_name' , 10, 2 );
It’s a tricky snippet, but worked well in my test site. Try it out and let me know if it works for you,
Best,
NicoJanuary 20, 2017 at 12:45 pm #1221690IvanParticipantThanks, I tried, but something went wrong. My page was not able to load after add this code to function.php – just stay blank with no error.
January 23, 2017 at 1:08 pm #1222561NicoMemberThanks for following up Ivan! And sorry to hear that this didn’t work as expected ๐
I just retested the snippet and it’s working fine in my end. Sometimes copying the code directly from the forums lead to erros, try pasting it in a plain text editor first and then from there copy it to the actual file. Copying it from the gist below might help to:
https://gist.github.com/niconerd/59cd5b76382224bd8d84abd065238bc7
Please let me know if this helps,
Best,
NicoJanuary 30, 2017 at 1:55 am #1226052IvanParticipantYes, you are right. This was the mistake! Thank you so much.
January 30, 2017 at 8:17 am #1226172NicoMemberThanks for confirming Ivan! Glad to be of service ๐
Iโll go ahead and close out this thread, but if you need help with anything else please donโt hesitate to create a new one and we will be happy to assist you.
Best,
Nico -
AuthorPosts
- The topic ‘Images "Facebook" prefix’ is closed to new replies.