@magland
Active 5 years, 7 months ago
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
I’m using this code to add featured images from a custom post type into my activity feed:
/* function to pull content into activity feed from post */ function record_cpt_blog_activity_content( $cpt ) { if (strpos($cpt['type'], 'NAME_OF_YOUR_POST_TYPE') !== false) { $existing = $cpt['content']; $imgSize = 'YOUR_CUSTOM_IMAGE_SIZE'; if(has_post_thumbnail($cpt['secondary_item_id'])) { $content .= '<div class="bpfb_images">'; $content .= '<a href="'.get_permalink($cpt['secondary_item_id']).'">'; $content .= get_the_post_thumbnail($cpt['secondary_item_id'], $imgSize); $content .= '</a>'; $content .= '</div>'; } $content .= '<br /><h1><a href="'.get_permalink($cpt['secondary_item_id']).'">'.get_the_title($cpt['secondary_item_id']).'</a></h1>'; $cpt['content'] = $content; } return $cpt; } add_filter('bp_before_activity_add_parse_args', 'record_cpt_blog_activity_content'); /* This fixes the status update content if the post is subsequently updated */ function update_cpt_blog_activity_content( $content, $cpt ) { if($cpt->secondary_item_id && strpos($cpt->type, 'NAME_OF_YOUR_POST_TYPE') !== false) { $content = ''; $imgSize = 'YOUR_CUSTOM_IMAGE_SIZE'; if(has_post_thumbnail($cpt->secondary_item_id)) { $content .= '<div class="bpfb_images">'; $content .= '<a href="'.get_permalink($cpt->secondary_item_id).'">'; $content .= get_the_post_thumbnail($cpt->secondary_item_id, $imgSize); $content .= '</a>'; $content .= '</div>'; } $content .= '<br /><h1><a href="'.get_permalink($cpt->secondary_item_id).'">'.get_the_title($cpt->secondary_item_id).'</a></h1>'; } return $content; } add_filter('bp_activity_content_before_save', 'update_cpt_blog_activity_content', 10, 2);
The first function catches when the post is added. It may not have a featured image at the point it is posted, so the second function catches when the post is updated and updates the activity. Hope that helps. You’ll need to swap out NAME_OF_YOUR_POST_TYPE and YOUR_CUSTOM_IMAGE_SIZE
Just to add something further I think this is specifically an issue with Safari. Just tried chrome on my iphone and it works ok. Several other people reporting the problem on the iphone and they are also using Safari.
However, the default WordPress media uploader does work in Safari.
Viewing 2 replies - 1 through 2 (of 2 total)