[wp-hackers] TinyMCE and centered aligning

Andrew Ozz admin at laptoptips.ca
Tue Apr 22 20:29:36 GMT 2008

Mário Gamito wrote:
> TinyMCE that comes with 2.5 uses <p style="text-align: center;"> to 
> center stuff in the page. And that's the way it oughts to be.
> Problem is my blog is aggregated into a planet that ignores this and 
> there, centered text and images goes left.
> Does anyone knows of a tiny hack to make the editor align things with <p 
> align="center"> ?

The easiest hack would be to add:

content = content.replace(/<p style="text-align: center;">/g, '<p 

just above "// Pretty it up for the source editor" in wp-admin/js/editor.js.

If you need it to stick after upgrading WordPress, you'll need to make a 
small plugin for TinyMCE to do that when saving.

More information about the wp-hackers mailing list