[wp-hackers] WP 2.5 gallery breaking xhtml 1.0

Otto otto at ottodestruct.com
Fri Jun 20 13:43:07 GMT 2008


Do we really want to require themes to remove bits just to make it
work properly for themselves? That's my fundamental issue with all of
this, the core code should not be adding styles and other such
visibility things like that.

The gallery should put a simple unordered list of the pictures into
the post, with useful classes like gallery and such. Then it's up to
the themes to style those.

This is a perfectly acceptable way to do things, and themes and users
*will adapt to it*. We can just tell them to copy the gallery stuff
from the default theme's CSS into their own theme's CSS. There should
not be a need for any particular coding associated with this. All that
has to happen is to remove the styles from the gallery code and move
them into the theme's stylesheets. That's it. Finished.


On Fri, Jun 20, 2008 at 6:24 AM, Andrew Ozz <admin at laptoptips.ca> wrote:
> Javier Aroche wrote:
>>
>> Even better, an hook that themes should remove ;)
>
> I actually don't understand this whole thread. In trunk we have support for
> wp_register_style(), wp_deregister_style(), wp_enqueue_style(), etc. working
> exactly the same way as the similar js functions. Why not use them?
> Something like this should work well:
>
> function register_gallery_css() {
>  $url = WP_CONTENT_URL.'/themes/default/gallery.css';
>  wp_register_style( 'gallery', $url, array(), '20080619', 'screen' );
> }
> add_action('init', 'register_gallery_css', 5);
>
> function print_gallery_css() {
>  global $wp_styles;
>
>  if ( isset($wp_styles) && $wp_styles->query('gallery') )
>    wp_print_styles('gallery');
> }
> add_action('wp_head', 'print_gallery_css');
>
> The gallery.css can be added to the default theme or other appropriate
> place.
>
> Then the themes that have styles for the gallery can do this in the
> functions.php:
>
> function no_gallery_css() {
>  wp_deregister_style( 'gallery' );
> }
> add_action('init', 'no_gallery_css');
>
> Even plugins that want to replace the default gallery.css but only for
> themes that don't have styles for it can do this:
>
> function plugin_gallery_css() {
>  $url = ...
>  wp_register_style( 'gallery', $url, array(), 'ver', 'screen' );
> }
> add_action('init', 'plugin_gallery_css', 4);
>
> (it won't be registered second time if the handle already exists).
>
> Also we may need to do something similar for the .alignleft, .alignright,
> .aligncenter css classes too.
> _______________________________________________
> 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