Can there be a good way to instantly wrap any h2 aspect in the div class "entry-content" in another div class "entry-header"

Therefore the finish result would look something similar to:

<div class="entry-content">
  <div class="entry-header">
    <h2>Some Title</h2>

I suppose you can do this with PHP, but I am unsure. Thank you for any input!

When it comes to wordpress I'd most likely verge towards developing a shortcode for example

[header]Some Title[/header]

I'd result in the shortcode go ahead and take content and wrap the given code around it.

See some documentation here:

ugly one:

$content = str_replace('<div class="entry-content">', '<div class="entry-content"><div class="entry-header">', $content);
$content = str_replace('</h2>', '</h2></div>', $content);

Can you're doing so in prototype ? This is my easy solution:

var div = $('entry-content');

$(div).insert ({'top'  : '<div class="entry-header">'} );
$(div).insert ({'bottom'  : '</div>'} );

Maybe I am missing somethig :)