Somehow Media-Attachments are an issue.
the </p> gets lost and even if noticed and entered manually in the editor ... it gets eaten.
Absolutely empty post comes up. All there in the editor, no post content online (Titel is there, tags, edit etc at the bottom too - but other than that ... empty
Also, don't know why (no programmer here) but the alignright and alignleft attachments worked fine ... but the aligncenter did not.
So here is my code and that works:
in line 207 I added padding ... otherwise the text would end up directly on the image - issue especially on floating right images:
$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.'class="'.$class.'" style="padding-left: 10px;" />';
return '<div ' . $id . 'class="' . $align . '" style="text-align:center;">' . do_shortcode( $content ) . '<br /><span class="wp-caption-text" style="position:relative;width:'. $width . 'px;padding-left:10px; display:inline-block;text-align:left;"><small>' . $caption . '</small></span></div>';
I am sure there is a more elegant way to solve this issue but know the Images get centered an I can align the caption underneath whereever I won't left right centered.