[wp-hackers] TinyMCE and centered aligning

Alexander Beutl xel at netgra.de
Tue Apr 22 22:04:12 GMT 2008


would try a regexp in the filter function - something like:

add_filter('the_content', 'classic_align');

function classic_align($content)
{
$pattern = '~(\<[^>]*style="[^"]*text-align: center[^>]*)~i';
$replace = '\1 align="center"';
return preg_replace($pattern, $replace, $content);
}
?>

written blindly out of my head but should do it anyway.

2008/4/22, Benedict Eastaugh <ionfish at gmail.com>:
>
> Surely supplementing the inline style with the align attribute would
> be preferable to replacing it.
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list