[wp-testers] CSS in WYSIWYG
Owen Winkler
ringmaster at midnightcircus.com
Wed Dec 14 14:15:13 GMT 2005
Andy Skelton wrote:
> Here's a thought: theme authors now have functions.php. In the editor
> we could do something like this:
>
> $image_classes = apply_filter('editor_image_classes', array());
> if ( count($image_classes) > 0 ) {
> echo "<select ...>";
> foreach ( $image_classes as $label => $class )
> echo "<option value='$class'>$label</option>";
> echo "</select>";
> }
"editor_image_classes"? Are you thinking to limit the dropdown to
applying classes to only images or would there be an additional filter
to supply classes for paragraphs or new spans or whatever else might be
selected?
In regard to the issue brought up about theme authors not being PHP coders:
It should be academic to write a function for functions.php that parses
the CSS to get a list of all classes, or perhaps just classes with a
special comment marker after them:
.img_style_4 { float:left; }
/* EDITORCLASS:FloatLeft=img_style_4 */
Writing such a function is a no-brainer, and should be easy enough for
theme authors to employ generically by dropping in an appropriately
enabled functions.php.
I foresee a future in which theme authors ask each other, "Which
functions.php are you using?"
Owen
More information about the wp-testers
mailing list