[wp-hackers] Center in WP 2.7 with different code in the editor

Mário Gamito gamito at gmail.com
Wed Jan 14 13:20:39 GMT 2009


Hi,

I've posed here this very same question a long ago in the WP 2.5 time.

Wp 2.7 TinyMCE center aligns objects with <p style="text-align: center;">
And that's fine and what it should be.

My problem is that my blog is in the most important Portuguese Planet
and it doesn't recognise this code, due to technical complications
regarding different blogging platforms and the way their code manage
things in a diferent way.
And the final result is that what is centered in my blog, appears at
left on the Planet, something that is terribly ugly.

The center code it recognizes unversaly is <p align="center"> which is
kind of old-fashioned, but still does the job and above all, works well
with Planet.

When I asked here how to force WP 2.5 TinyMCE to center with <p
align="center"> instead of <p style="text-align: center;">, someone
responded:

"The easiest hack would be to add:

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

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

And it worked.

Problem is that now it doesn't work anymore. Applying the same hack,
does nothing. TinyMCE still centers with <p style="text-align: center;">

So my question to you gurus is: how do I make this work in Wp 2.7 ?

Any help would be appreciated.

Warm Regards,
Mário Gamito


More information about the wp-hackers mailing list